1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-26 10:03:37 +03:00

B #3844: Add references when import wilds (#4055)

Signed-off-by: Carlos Herrera <cherrera@opennebula.systems>
This commit is contained in:
Carlos J. Herrera 2019-12-18 10:34:12 -05:00 committed by Tino Vázquez
parent 58f8354015
commit 6141ebbb86
2 changed files with 22 additions and 0 deletions

View File

@ -930,6 +930,25 @@ module VCenterDriver
{}
end
def reference_all_disks
extraconfig = []
disks_each(:synced?) do |disk|
begin
key_prefix = disk.managed? ? "opennebula.mdisk." : "opennebula.disk."
k = "#{key_prefix}#{disk.id}"
v = "#{disk.key}"
extraconfig << {key: k, value: v}
rescue StandardError => e
next
end
end
spec_hash = {:extraConfig => extraconfig}
spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)
@item.ReconfigVM_Task(:spec => spec).wait_for_completion
end
# Build extraconfig section to reference disks
# by key and avoid problems with changing paths
# (mainly due to snapshots)

View File

@ -105,6 +105,9 @@ module VCenterDriver
request_vnc(vc_vm)
# Sync disks with extraConfig
vc_vm.reference_all_disks
vm.id
end