Revision 50ab7527 src/tm_mad/vcenter/delete

View differences:

src/tm_mad/vcenter/delete
79 79
    img_path = VCenterDriver::FileHelper.get_img_name(disk, vmid)
80 80

  
81 81
    begin
82
        # TODO: if the deploy has failed, the disks may exist, but the vm may
83
        # not exist...
84
        vm.one_item = one_vm
82
        if !vm.has_snapshots?
83
            # TODO: if the deploy has failed, the disks may exist, but the vm may
84
            # not exist...
85
            vm.one_item = one_vm
85 86

  
86
        # detach the disk
87
        vm.detach_disk(disk)
87
            # detach the disk
88
            vm.detach_disk(disk)
89

  
90
            # delete the disk
91
            ds = VCenterDriver::Datastore.new_from_ref(ds_ref, vi_client)
92
            ds.delete_virtual_disk(img_path)
93
        end
88 94

  
89
        # delete the disk
90
        ds = VCenterDriver::Datastore.new_from_ref(ds_ref, vi_client)
91
        ds.delete_virtual_disk(img_path)
92 95
    rescue Exception => e
93 96
        STDERR.puts "Error delete virtual disk #{img_path} in datastore #{dsid}."\
94 97
                    " Reason: #{e.message}\n#{e.backtrace}"
......
100 103
    # Remove the VM
101 104
    begin
102 105
        # All OpenNebula managed disks have been detached. The VM may have still
103
        # disks that belong to the template (VCENTER_MANAGED disks). These disks
106
        # disks that belong to the template (OPENNEBULA_MANAGED disks). These disks
104 107
        # will be deleted with the destroy operation. If the user wants to
105 108
        # save them to a VM, it can be done using the disk-saveas operation.
106 109
        vm.destroy

Also available in: Unified diff