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:
parent
e778335bf6
commit
53cd9541e0
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user