Skip to content

Commit

Permalink
Merge pull request #463 from thearifismail/bug1760040
Browse files Browse the repository at this point in the history
[V2V] Added support query for warm migration

(cherry picked from commit 9d595b8)

https://bugzilla.redhat.com/show_bug.cgi?id=1790538
  • Loading branch information
agrare authored and simaishi committed Feb 21, 2020
1 parent 9430feb commit 434a563
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/vmware/infra_manager/vm.rb
Expand Up @@ -9,6 +9,10 @@ class ManageIQ::Providers::Vmware::InfraManager::Vm < ManageIQ::Providers::Infra
unsupported_reason_add(:clone, _('Clone operation is not supported')) if blank? || orphaned? || archived?
end

supports :warm_migrate do
unsupported_reason_add(:warm_migrate, _('Warm migratiobn can not migrate a VM with snapshots')) if snapshots.present?
end

supports :reconfigure_disks
supports :reconfigure_network_adapters
supports :reconfigure_disksize do
Expand Down
13 changes: 13 additions & 0 deletions spec/models/manageiq/providers/vmware/infra_manager/vm_spec.rb
@@ -1,4 +1,6 @@
describe ManageIQ::Providers::Vmware::InfraManager::Vm do
before { EvmSpecHelper.local_miq_server } # required for creating snapshots needed for warm migrate tests

let(:ems) { FactoryBot.create(:ems_vmware) }
let(:host) { FactoryBot.create(:host_vmware_esx, :ext_management_system => ems) }
let(:vm) { FactoryBot.create(:vm_vmware, :ext_management_system => ems, :host => host) }
Expand Down Expand Up @@ -43,6 +45,17 @@
end
end

context "supports_warm_migrate?" do
it "returns true" do
expect(vm.supports?(:warm_migrate)).to eq(true)
end

it "returns false" do
FactoryBot.create_list(:snapshot, 2, :create_time => 1.minute.ago, :vm_or_template => vm)
expect(vm.supports?(:warm_migrate)).to eq(false)
end
end

context "supports_shutdown_guest?" do
let(:op) { 'shutdown_guest' }

Expand Down

0 comments on commit 434a563

Please sign in to comment.