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

B #2951: persistent disks problem with snapshot solved

This commit is contained in:
sergio semedi 2019-02-15 12:52:58 +01:00
parent e778335bf6
commit 53cd9541e0
3 changed files with 6 additions and 4 deletions

View File

@ -70,7 +70,7 @@ begin
vm = VCenterDriver::VirtualMachine.new(vi_client, vm_ref, vmid)
if vm.has_snapshots?
STDERR.puts "'disk-saveas' operation is not supported for VMs with system snapshots."
raise "'disk-saveas' operation is not supported for VMs with system snapshots."
exit 1
end

View File

@ -61,11 +61,13 @@ disk_id = img_path.split(".")[-1]
begin
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
vm = VCenterDriver::VirtualMachine.new(vi_client, vm_ref, vmid)
disk = vm.disk(disk_id)
vmperst = vm.instantiated_as_persistent?
vm.remove_all_snapshots if vm.has_snapshots?
disk = vm.disk(disk_id)
# Don't detach persistent disks if the VM has snapshots
if disk && disk.exists? && !vm.has_snapshots?
if disk && disk.exists?
vm.one_item = one_vm
# Do not detach persistent unmanaged disk, we need them for mark as a template

View File

@ -1009,8 +1009,8 @@ class VirtualMachine < VCenterDriver::Template
if key
query = vc_disks.select {|dev| key == dev[:key]}
else
error = 'disk metadata is corrupted and you have snapshots'
if has_snapshots?
error = 'disk metadata is corrupted and you have snapshots'
raise error
end