Revision 50ab7527 src/vmm_mad/remotes/vcenter/snapshot_create

View differences:

src/vmm_mad/remotes/vcenter/snapshot_create
46 46

  
47 47
    vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
48 48

  
49
    vm.create_snapshot(snap_id, snap_name)
49
    one_vm = drv_action.retrieve_xmlelements("VM").first
50

  
51
    vm.one_item = one_vm
52

  
53
    persistent_disks = one_vm.retrieve_xmlelements("TEMPLATE/DISK[PERSISTENT=YES]")
54

  
55
    if !persistent_disks.empty?
56
        STDERR.puts "Snapshot of VM #{vm_ref} on vCenter cluster "\
57
                    "#{vc_cluster_name} cannot be performed if "\
58
                    "it contains persistent disks"
59
        exit 1
60
    end
61

  
62
    puts vm.create_snapshot(snap_id, snap_name)
50 63

  
51 64
rescue Exception => e
52 65
    STDERR.puts "Snapshot of VM #{vm_ref} on vCenter cluster "\
53 66
                "#{vc_cluster_name} failed due to "\
54 67
                "\"#{e.message}\"\n#{e.backtrace}"
55
    exit(-1)
68
    exit -1
56 69
ensure
57 70
    vi_client.close_connection
58
end
71
end

Also available in: Unified diff