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

Unify VM Operations queue handling and set queue_name #19544

Merged
merged 1 commit into from
Nov 22, 2019

Conversation

agrare
Copy link
Member

@agrare agrare commented Nov 21, 2019

Move the queue handling for VM operations into common methods, set the
queue_name, and queue operations after check_policy_prevent.

Any operations run from a check_policy_prevent_callback were being run in the context of the automate role which was preventing these ems_operations from being run on an operations worker.

Issue: #19543

@agrare agrare force-pushed the set_queue_name_for_vm_operations branch 2 times, most recently from 8db3148 to 0beb804 Compare November 21, 2019 18:12
@agrare agrare requested a review from djberg96 November 21, 2019 18:19
@agrare agrare force-pushed the set_queue_name_for_vm_operations branch from 0beb804 to 0195916 Compare November 21, 2019 20:02
@miq-bot
Copy link
Member

miq-bot commented Nov 21, 2019

Some comments on commit agrare@0195916

spec/models/vm_spec.rb

  • ⚠️ - 176 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 185 - Detected expect_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Nov 21, 2019

Checked commit agrare@0195916 with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
5 files checked, 1 offense detected

app/models/vm_or_template/operations/snapshot.rb

@@ -336,6 +337,15 @@ def run_command_via_parent(verb, options = {})
ext_management_system.send(verb, self, options)
end

def run_command_via_task(task_options, queue_options)
MiqTask.generic_action_with_callback(task_options, command_queue_options(queue_options))
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to return only the task ID or the full task object here? I would generally prefer the latter, unless the UI needs the former for some reason.

https://github.com/ManageIQ/manageiq/blob/master/app/models/miq_task.rb#L303

Copy link
Member Author

Choose a reason for hiding this comment

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

This maintains compatibility with what is currently being returned, https://github.com/ManageIQ/manageiq/pull/19544/files#diff-6002b94a939143e9dcfa4873f9fe003bL87

I'm okay changing it but we need to find and update all the callers as well.

@djberg96
Copy link
Contributor

I don't suppose there's any chance of documenting these methods is there? I know that you understand it all at a glance, but it would help me and potentially future maintainers. :)

@agrare
Copy link
Member Author

agrare commented Nov 21, 2019

I'd love to document all of the "interface" methods (e.g. start, start_queue) but that is unrelated to the changes being made here. Would rather go through all the operations not just the ones that I happened to have to update here and have a PR just to add documentation.

@agrare
Copy link
Member Author

agrare commented Nov 21, 2019

@djberg96 #19546

@kbrock kbrock self-assigned this Nov 22, 2019
@kbrock kbrock added this to the Sprint 125 Ending Nov 25, 2019 milestone Nov 22, 2019
@kbrock kbrock merged commit d243330 into ManageIQ:master Nov 22, 2019
@agrare agrare deleted the set_queue_name_for_vm_operations branch November 22, 2019 19:35
}

MiqTask.generic_action_with_callback(task_opts, queue_opts)
run_command_via_queue(task_opts, :method_name => "rename", :args => [new_name])
Copy link
Contributor

@himdel himdel Nov 25, 2019

Choose a reason for hiding this comment

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

This looks like a typo, should have been run_command_via_task, right?

The params do match the _task signature, not _queue,
and so does the code (MiqQueue.put vs MiqTask.generic_action_with_callback).

And, so does UI travis ;)... https://travis-ci.org/ManageIQ/manageiq-ui-classic/jobs/615790473#L2060

(

-    run_command_via_queue(task_opts, :method_name => "rename", :args => [new_name])
+    run_command_via_task(task_opts, :method_name => "rename", :args => [new_name])

passes, creating a PR (#19553))

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.

5 participants