-
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
Queue reporting work for any zone #18041
Queue reporting work for any zone #18041
Conversation
Notifier is a regional role, so there's no need to set the zone for it here. It's done lower in the stack, when 'put' calls 'determine_queue_zone'. https://bugzilla.redhat.com/show_bug.cgi?id=1629945
@@ -164,8 +164,8 @@ def queue_generate_table(options = {}) | |||
if sync | |||
_async_generate_table(task.id, options) | |||
else | |||
MiqQueue.put( | |||
:queue_name => "reporting", |
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 was most likely the cause of the reporting bug where reporting work would be enqueued for a zone without a reporting role. The absence of the :role => "reporting"
and :zone => nil
causes this message to be queued for :zone => Zone.my_zone
(the current server's zone)
@@ -792,9 +792,8 @@ def queue_report_result(options, res_opts) | |||
_log.info("Adding generate report task to the message queue...") | |||
task = MiqTask.create(:name => "Generate Report: '#{name}'", :userid => options[:userid]) | |||
|
|||
MiqQueue.put( | |||
:queue_name => "reporting", | |||
:role => "reporting", |
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.
Note, this was probably not causing the issue seen above because it specified the role as reporting, which should set the zone to nil. To simplify things, I moved this code to use the submit_job
method to be more consistent.
@@ -108,6 +108,7 @@ def queue_generate_content_for_users_or_group(*args) | |||
MiqQueue.create_with(callback).put_unless_exists( | |||
:queue_name => "reporting", | |||
:role => "reporting", | |||
:zone => nil, # any zone |
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.
Note, I didn't change this to use submit_job
because that method doesn't support put_unless_exists
. Therefore, I have to set the zone to nil.
it "#queue_generate_table" do | ||
report.queue_generate_table(:userid => "admin") | ||
task = MiqTask.first | ||
expect(task.name).to eq("Generate Report: '#{report.name}'") |
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.
expect(task).to have_attributes(:name => ...)
it "#queue_report_result" do | ||
task_id = report.queue_report_result({:userid => "admin"}, {}) | ||
task = MiqTask.find(task_id) | ||
expect(task.name).to eq("Generate Report: '#{report.name}'") |
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.
same here?
9547007
to
01f6f3f
Compare
MiqQueue.put( | ||
:queue_name => "reporting", | ||
MiqQueue.submit_job( | ||
:service => "reporting", |
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.
To be clear, submit_job
will set the role
as reporting
and because of this, determine_queue_zone
, from put
, will set the zone to nil
for "any" zone.
) | ||
|
||
message = MiqQueue.where(:method_name => "_async_generate_table") | ||
message = message.first |
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.
find_by
?
) | ||
|
||
message = MiqQueue.where(:method_name => "build_report_result") | ||
message = message.first |
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.
same here
https://bugzilla.redhat.com/show_bug.cgi?id=1629945 Because the queue put was specifying a queue_name without a role OR zone, the zone was being set to MiqServer.my_zone. By leveraging the higher level method, submit_job, specifying the service of "reporting" sets the role and because reporting is a regional role, there's no need to specify the zone, it will default to the "nil" (any) zone.
01f6f3f
to
c5c004c
Compare
Ok, I think I got all the things cleaned up |
Checked commits jrafanie/manageiq@68dad68~...c5c004c with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
…zone Queue reporting work for any zone (cherry picked from commit 65ef49c) https://bugzilla.redhat.com/show_bug.cgi?id=1629945
Hammer backport details:
|
…zone Queue reporting work for any zone (cherry picked from commit 65ef49c) https://bugzilla.redhat.com/show_bug.cgi?id=1635255
Gaprindashvili backport details:
|
Required after changes from PR ManageIQ/manageiq#18041
…for_any_zone Queue reporting work for any zone (cherry picked from commit 65ef49c) https://bugzilla.redhat.com/show_bug.cgi?id=1635255
Because reporting is a regional role, meaning, it's possible to do the same reporting work from different zones in the same region, we need to queue reporting work for the nil ("any") zone. By allowing queue put to choose the current server's zone, it was possible for UI appliances without the reporting role to create reporting queue messages that would never get processed.
https://bugzilla.redhat.com/show_bug.cgi?id=1629945