1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

Support for live migration

This commit is contained in:
Sergio Vega 2019-01-28 13:52:15 -06:00
parent c13d29b505
commit 7309696678
2 changed files with 15 additions and 4 deletions

View File

@ -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,
}

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 '\