-
Notifications
You must be signed in to change notification settings - Fork 900
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
[V2V] Add conversion_host.id to task options #18540
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,12 +41,20 @@ def enable(params) | |
params = params.symbolize_keys | ||
_log.info("Enabling a conversion_host with parameters: #{params}") | ||
|
||
params.delete(:task_id) # In case this is being called through *_queue which will stick in a :task_id | ||
params.delete(:miq_task_id) # The miq_queue.activate_miq_task will stick in a :miq_task_id | ||
task_id = params.delete(:task_id) # In case this is being called through *_queue which will stick in a :task_id | ||
miq_task_id = params.delete(:miq_task_id) # The miq_queue.activate_miq_task will stick in a :miq_task_id | ||
task_id ||= miq_task_id | ||
|
||
vddk_url = params.delete(:param_v2v_vddk_package_url) | ||
|
||
conversion_host = new(params) | ||
|
||
unless task_id.nil? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably change this to |
||
task = MiqTask.find(task_id) | ||
task.options[:conversion_host_id] = conversion_host.id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean is options even an attribute of an miq_task?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fdupont-redhat you're probably thinking of an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @agrare Now I'm curious what the difference between those two. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They're different models? |
||
task.save! | ||
end | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm ok with this, but I'm thinking it should only happen if we know the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't |
||
conversion_host.enable_conversion_host_role(vddk_url) | ||
conversion_host.save! | ||
conversion_host | ||
|
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? no no lets just fix enable_queue to set
:miq_task_id
and standardize on a single keyThere 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.
Yup. I didn't like it neither. How would you fix
enable_queue
?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.
Actually it looks like the only caller (./manageiq-api/app/controllers/api/conversion_hosts_controller.rb) just does
task_id = ConversionHost.enable_queue(data.except('auth_user'), data['auth_user'])
so where were you seeing atask_id
parameter coming from? Because from that it looks like it gets the task_id back rather than passing one in.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.
I took that from existing code... @djberg96 could you shed some light here ?
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.
Yes, the
enable_queue
method will return thetask_id
on a create request, but we don't have a direct way to associate the task back to the conversion instance after that.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.
But enable_queue isn't passing in the task_id as a parameter right? So the only option should be
miq_task_id
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.
They're injected into the params via the
MiqTask.generic_action_with_callback
at https://github.com/ManageIQ/manageiq/blob/master/app/models/miq_task.rb#L290-L292There 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.
But those are different hashes, only
task_id
is passed in to the method opts