-
Notifications
You must be signed in to change notification settings - Fork 897
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
Update vm transformation status in a plan #17027
Conversation
@miq-bot add_label transformation |
@@ -201,9 +201,13 @@ def after_ae_delivery(ae_result) | |||
def update_and_notify_parent(*args) | |||
prev_state = state | |||
super | |||
return task_activated if state == "active" && prev_state != "active" | |||
task_finished if state == "finished" && prev_state != "finished" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about refactoring this to be more generic:
self.try("task_#{state}") if state != prev_state
The existing task_finished
line on 205 can be deleted, task_activated
would be renamed task_active
and would not be required in the base model.
|
||
def vm_request | ||
miq_request.vm_requests.find_by(:resource => source) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be private methods.
|
||
def task_finished | ||
# update the status of vm transformation status in the plan | ||
vm_request.update_attributes(:status => status == 'Ok' ? 'Completed' : 'Failed') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As each task finishes the request status
will be updated based on the results of this single task? I'm not sure how this is going to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the miq_request, but service_resource wrapper for vm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name vm_request
seems like it will be easily confused. I'm open to other ideas but maybe resource_status
or vm_status
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot be status
., vm_transformation_demand
or vm_resource
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with vm_resource
.
b583709
to
1b885b6
Compare
0cfb2f3
to
c50a2f0
Compare
Checked commits bzwei/manageiq@1b885b6~...c50a2f0 with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0 |
@gmcculloug Shouldn't this be |
@gmcculloug ^ ping |
Yes, I'll add the label. |
Update vm transformation status in a plan (cherry picked from commit 68544e0)
Gaprindashvili backport details:
|
Each selected vm in a transformation plan has status column needs to be updated. This work enables the status update during the course of miq_request_task execution.