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

B #5368: Add snapshot and metadata earlier check

Wild VMs won't be imported and left for delete-db action
if they have snapshosts and not disk metadata
This commit is contained in:
Tino Vazquez 2021-05-13 19:41:47 +02:00 committed by Ruben S. Montero
parent 82fd8177ba
commit 5b0d816f1a
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 10 additions and 1 deletions

View File

@ -1054,7 +1054,8 @@ end
else
if snapshots?
error = 'Disk metadata not present and snapshots exist. ' \
'OpenNebula cannot manage this VM.'
'Please remove imported VM with "onevm recover ' \
'--delete-db".'
raise error
end

View File

@ -54,6 +54,14 @@ module VCenterDriver
vc_vm = VCenterDriver::VirtualMachine.new_without_id(@vi_client,
vm_ref)
# Importing Wild VMs with snapshots is not supported
# https://github.com/OpenNebula/one/issues/1268
if vc_vm.snapshots? && vc_vm.disk_keys.empty?
raise 'Disk metadata not present and snapshots exist, '\
'cannot import this VM'
end
vname = vc_vm['name']
type = { :object => 'VM', :id => vname }