Support for live migration

This commit is contained in:
Sergio Vega committed 2019-01-28 13:52:15 -06:00
1 parent c13d29b505
commit 7309696678
2 files changed
+15 -4

No files matched your search

@@ -2460,11 +2460,13 @@ class VirtualMachine < VCenterDriver::Template
begin
# retrieve host from DRS
resourcepool = config[:cluster].resourcePool
host = config[:cluster].host.first
datastore = config[:datastore]
if datastore
relocate_spec_params = {
pool: resourcepool,
host: host,
datastore: datastore,
}
+13 -4
View File
@@ -32,12 +32,21 @@ require 'vcenter_driver'
vm_id = ARGV[-2]
src_host = ARGV[-3]
dst_host = ARGV[-4]
dsid = "111"
begin
# TODO: grab destination ds
VCenterDriver::VirtualMachine.migrate_routine(vm_id,
src_host,
dst_host)
one_client = OpenNebula::Client.new
vm = OpenNebula::VirtualMachine.new_with_id(vm_id, one_client)
vm.info
src_ds = vm.retrieve_elements("HISTORY_RECORDS/HISTORY/DS_ID")[-2]
if src_ds == dsid
VCenterDriver::VirtualMachine.migrate_routine(vm_id, src_host, dst_host)
else
VCenterDriver::VirtualMachine.migrate_routine(vm_id, src_host, dst_host, dsid)
end
rescue StandardError => e
message = "Cannot migrate for VM #{vm_id}"\
'failed due to '\