Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing subservice task creation for service bundles #18283

Conversation

d-m-u
Copy link
Contributor

@d-m-u d-m-u commented Dec 11, 2018

Subservices aren't being correctly retired. The task creation should be using src_ids, and the recursive call to create tasks for subservices is wrong. Also, the service retireable check should handle subservices for bundles, and the request and task should be able to mark themselves as finished after the status update to "retired", just like we do for provisioning.

req_state = (states.length == 1) ? states.keys.first : "active", the check we're currently using at https://github.com/ManageIQ/manageiq/blob/master/app/models/miq_request.rb#L383 is being overriden here to set the request to finished to work for bundles. We should be checking state and status for all the child tasks and if they're all ok and finished, then the parent can be updated.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1608958
Also fixes https://bugzilla.redhat.com/show_bug.cgi?id=1653648

They're related.

@miq-bot miq-bot added the wip label Dec 11, 2018
@d-m-u
Copy link
Contributor Author

d-m-u commented Dec 11, 2018

@miq-bot add_label bug

@miq-bot miq-bot added the bug label Dec 11, 2018
@d-m-u d-m-u force-pushed the fixing_subservice_task_creation_for_bundled_service_bundles branch 8 times, most recently from fd5ce90 to 1345539 Compare December 18, 2018 20:45
@d-m-u d-m-u force-pushed the fixing_subservice_task_creation_for_bundled_service_bundles branch 2 times, most recently from e220d96 to 10bf5c6 Compare January 3, 2019 18:17
@d-m-u d-m-u changed the title [WIP] Fixing subservice task creation for bundled service bundles Fixing subservice task creation for bundled service bundles Jan 3, 2019
@d-m-u d-m-u changed the title Fixing subservice task creation for bundled service bundles Fixing subservice task creation for service bundles Jan 3, 2019
@d-m-u
Copy link
Contributor Author

d-m-u commented Jan 3, 2019

@miq-bot remove_label wip
@miq-bot add_label blocker
@miq-bot assign @gmcculloug
@miq-bot add_reviewer @tinaafitz

@@ -218,10 +218,6 @@ def composite?
children.present?
end

def retireable?
type.present?
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is now included from the CiFeatureMixin which always returns true. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rational for changing this check is that, while the blanket check for type being present has some logical issues since not all services have types but all are retireable, the part that's being omitted at the moment is subservices. Per #17317 (comment), I think checking to see if the service is a subservice first makes more sense.

@d-m-u
Copy link
Contributor Author

d-m-u commented Jan 3, 2019

@miq-bot add_label hammer/yes

@d-m-u d-m-u force-pushed the fixing_subservice_task_creation_for_bundled_service_bundles branch 2 times, most recently from 54cdfa5 to 9da82b4 Compare January 4, 2019 13:45
@d-m-u d-m-u changed the title Fixing subservice task creation for service bundles [WIP] Fixing subservice task creation for service bundles Jan 4, 2019
@miq-bot miq-bot added the wip label Jan 7, 2019
@d-m-u d-m-u force-pushed the fixing_subservice_task_creation_for_bundled_service_bundles branch 2 times, most recently from 225556e to 1cba151 Compare January 8, 2019 00:52
@d-m-u
Copy link
Contributor Author

d-m-u commented Jan 8, 2019

@miq-bot remove_label wip

@d-m-u d-m-u changed the title [WIP] Fixing subservice task creation for service bundles Fixing subservice task creation for service bundles Jan 8, 2019
@miq-bot miq-bot removed the wip label Jan 8, 2019
@d-m-u d-m-u force-pushed the fixing_subservice_task_creation_for_bundled_service_bundles branch 6 times, most recently from 5d05837 to 0136071 Compare January 8, 2019 15:24
@d-m-u
Copy link
Contributor Author

d-m-u commented Jan 8, 2019

Failures look unrelated to this code.

app/models/miq_retire_request.rb Outdated Show resolved Hide resolved
app/models/service_retire_task.rb Outdated Show resolved Hide resolved
app/models/service_retire_task.rb Show resolved Hide resolved
app/models/vm_retire_task.rb Outdated Show resolved Hide resolved
end
end

context "without type" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this still need to be tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec/models/service_spec.rb Outdated Show resolved Hide resolved
@d-m-u d-m-u force-pushed the fixing_subservice_task_creation_for_bundled_service_bundles branch 3 times, most recently from 43a3771 to c5ef83f Compare January 8, 2019 17:48
@d-m-u d-m-u force-pushed the fixing_subservice_task_creation_for_bundled_service_bundles branch from c5ef83f to 97537a4 Compare January 8, 2019 18:06
@miq-bot
Copy link
Member

miq-bot commented Jan 8, 2019

Checked commit d-m-u@97537a4 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
8 files checked, 0 offenses detected
Everything looks fine. 🏆

@@ -16,7 +16,9 @@ def update_and_notify_parent(*args)
end

def task_finished
update_attributes(:status => status == 'Ok' ? 'Completed' : 'Failed')
if status != 'Ok'
update_attributes(:status => 'Error')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this already set to "Completed" before this method is called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we needed the completed gone, because it's not a valid state for the task. It should either be ok or error.

@bdunne bdunne merged commit 7889bd0 into ManageIQ:master Jan 8, 2019
@bdunne bdunne assigned bdunne and unassigned gmcculloug Jan 8, 2019
@bdunne bdunne added this to the Sprint 103 Ending Jan 21, 2019 milestone Jan 8, 2019
simaishi pushed a commit that referenced this pull request Jan 8, 2019
…for_bundled_service_bundles

Fixing subservice task creation for service bundles

(cherry picked from commit 7889bd0)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1608958
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1653648
@simaishi
Copy link
Contributor

simaishi commented Jan 8, 2019

Hammer backport details:

$ git log -1
commit a0968c86246cd63fec12eb8e85b8cc5cbc544eb4
Author: Brandon Dunne <brandondunne@hotmail.com>
Date:   Tue Jan 8 13:37:37 2019 -0500

    Merge pull request #18283 from d-m-u/fixing_subservice_task_creation_for_bundled_service_bundles
    
    Fixing subservice task creation for service bundles
    
    (cherry picked from commit 7889bd00d0305cc9e56c6f918047d75a3cfbfafb)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1608958
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1653648

@d-m-u d-m-u deleted the fixing_subservice_task_creation_for_bundled_service_bundles branch February 1, 2019 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants