-
Notifications
You must be signed in to change notification settings - Fork 898
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
Add ext_management_system method to conversion host #18097
Conversation
app/models/conversion_host.rb
Outdated
@@ -7,6 +7,10 @@ class ConversionHost < ApplicationRecord | |||
has_many :service_template_transformation_plan_tasks, :dependent => :nullify | |||
has_many :active_tasks, -> { where(:state => 'active') }, :class_name => ServiceTemplateTransformationPlanTask, :inverse_of => :conversion_host | |||
|
|||
def ext_management_system | |||
resource.ext_management_system |
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.
You'd be better off using delegate :ext_management_system, :to => :resource
Ha I beat miq-bot by 1.5min! |
app/models/conversion_host.rb
Outdated
@@ -6,6 +6,7 @@ class ConversionHost < ApplicationRecord | |||
belongs_to :resource, :polymorphic => true | |||
has_many :service_template_transformation_plan_tasks, :dependent => :nullify | |||
has_many :active_tasks, -> { where(:state => 'active') }, :class_name => ServiceTemplateTransformationPlanTask, :inverse_of => :conversion_host | |||
delegate :ext_management_system, :to => :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.
You might also want :allow_nil => true
so that if the conversion host isn't linked to any inventory item this doesn't raise a NoMethodError but just returns nil
Checked commits fabiendupont/manageiq@7646495~...90da9fa with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Add ext_management_system method to conversion host (cherry picked from commit 8bc0049) https://bugzilla.redhat.com/show_bug.cgi?id=1634029
Hammer backport details:
|
When working with the conversion host, it might be useful to filter by EMS. For example, when throttling the migrations, one of the metrics is the number of concurrent tasks per EMS. So, getting the conversion hosts per EMS will be useful. This PR adds the
ext_management_system
method that returns the EMS of the resource. Currently, throttling is done in Automate and this PR requires it: ManageIQ/manageiq-content#441Associated RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1634029