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

B #5740: Reference disks before migrate (#1809)

This commit is contained in:
Christian González 2022-02-23 18:11:10 +01:00 committed by GitHub
parent c14729e522
commit 6df55bfa0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -1319,8 +1319,14 @@ end
def sync(deploy = {})
extraconfig = []
device_change = []
sync_opt = nil
# Disk are only synced with :all option when VM is first created
# NOTE: Detach actions are implemented through TM (not sync)
sync_opt = :all if deploy[:new] == true
disks = sync_disks(sync_opt, false)
disks = sync_disks(:all, false)
resize_unmanaged_disks
if deploy[:boot] && !deploy[:boot].empty?
@ -1736,10 +1742,6 @@ end
extra_config = []
keys = get_disk_keys.invert
if keys.nil? || keys.empty?
raise 'Unable to find disk mapping information on vmx file.'
end
ipool = VCenterDriver::VIHelper.one_pool(OpenNebula::ImagePool)
disks_each(:detached?) do |d|
key = d.key.to_s
@ -2682,6 +2684,7 @@ end
config[:esx_migration_list] = "Selected_by_DRS"
end
vc_vm.reference_all_disks
vc_vm.migrate(config)
vm.replace({ 'VCENTER_CCR_REF' => ccr_ref})

View File

@ -81,9 +81,11 @@ begin
if deploy_id_valid?(deploy_id)
# VM is not new, we just need to reconfigure it and to power it on
deploy[:new] = false
vm = VCenterDriver::VirtualMachine.new_one(vi_client, deploy_id, one_vm)
else
deploy[:boot] = drv_action['TEMPLATE/OS']
deploy[:new] = true
vm = VCenterDriver::VirtualMachine.new_from_clone(vi_client,
drv_action,
vm_id)
@ -107,6 +109,7 @@ begin
end
if vm.is_powered_off?
vm.reference_all_disks
vm.sync(deploy)
# Only mark the VM as running if we are deploying it for the first time
set_running = !deploy_id_valid?(deploy_id)