Skip to content

Commit

Permalink
Merge pull request #18570 from fdupont-redhat/v2v_throttling_use_migr…
Browse files Browse the repository at this point in the history
…ate_state

[V2V] Fix ConversionHost active_tasks method to use state == 'migrate'

(cherry picked from commit 7407f63)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1686877
  • Loading branch information
agrare authored and simaishi committed Mar 19, 2019
1 parent b8aa100 commit 4304a7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/conversion_host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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
has_many :active_tasks, -> { where(:state => ['active', 'migrate']) }, :class_name => ServiceTemplateTransformationPlanTask, :inverse_of => :conversion_host
delegate :ext_management_system, :hostname, :ems_ref, :to => :resource, :allow_nil => true

include_concern 'Configurations'
Expand Down
2 changes: 1 addition & 1 deletion spec/models/conversion_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let(:conversion_host_2) { FactoryGirl.create(:conversion_host, :resource => vm) }
let(:task_1) { FactoryGirl.create(:service_template_transformation_plan_task, :state => 'active', :conversion_host => conversion_host_1) }
let(:task_2) { FactoryGirl.create(:service_template_transformation_plan_task, :conversion_host => conversion_host_1) }
let(:task_3) { FactoryGirl.create(:service_template_transformation_plan_task, :state => 'active', :conversion_host => conversion_host_2) }
let(:task_3) { FactoryBot.create(:service_template_transformation_plan_task, :state => 'migrate', :conversion_host => conversion_host_2) }

before do
allow(conversion_host_1).to receive(:active_tasks).and_return([task_1])
Expand Down

0 comments on commit 4304a7d

Please sign in to comment.