Revision 50ab7527 src/tm_mad/vcenter/cpds

View differences:

src/tm_mad/vcenter/cpds
55 55
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, hostname)
56 56
host_id = host['ID']
57 57

  
58
# Get OpenNebula VM
58
# Get OpenNebula VM (state, disks and deploy_id)
59 59
one_vm = VCenterDriver::VIHelper.one_item(OpenNebula::VirtualMachine, vmid)
60 60
disks = one_vm.retrieve_xmlelements("TEMPLATE/DISK[DISK_ID=#{disk_id}]")
61 61
src_path = VCenterDriver::FileHelper.get_img_name(disks.first, vmid)
62
vm_ref = one_vm['DEPLOY_ID']
63

  
62 64
if one_vm['LCM_STATE'] == 26 #ACTIVE / HOTPLUG_SAVEAS
63 65
    STDERR.puts "'disk-saveas' operation is not supported for running VMs."
64 66
    exit 1
......
74 76
begin
75 77
    vi_client = VCenterDriver::VIClient.new_from_host(host_id)
76 78

  
79
    vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
80

  
81
    if vm.has_snapshots?
82
        STDERR.puts "'disk-saveas' operation is not supported for VMs with system snapshots."
83
        exit 1
84
    end
85

  
77 86
    source_ds_vc = VCenterDriver::Datastore.new_from_ref(source_ds_ref, vi_client)
78 87

  
79 88
    target_ds_vc = VCenterDriver::Datastore.new_from_ref(target_ds_ref, vi_client)

Also available in: Unified diff