Revision 080460e3

View differences:

src/tm_mad/vcenter/cpds
75 75

  
76 76
    # Get source and target ds ref
77 77
    disk = one_vm.retrieve_xmlelements("TEMPLATE/DISK[DISK_ID=#{disk_id}]").first
78
    source_ds_ref = disk["VCENTER_DS_REF"]
78

  
79
    source_ds_ref = ""
80

  
81
    # If disk is unmanaged get the reference from template
82
    if disk["OPENNEBULA_MANAGED"] && disk["OPENNEBULA_MANAGED"] == "NO"
83
        image_path = one_vm["USER_TEMPLATE/VCENTER_TEMPLATE_DISK_#{disk["DISK_ID"]}"]
84
        src_path = image_path.sub(/^\[(.*?)\] /, "")
85
        source_ds_ref = one_vm["USER_TEMPLATE/VCENTER_TEMPLATE_DS_DISK_#{disk["DISK_ID"]}"]
86
    else
87
        # Get image source path
88
        src_path = VCenterDriver::FileHelper.get_img_name(disk, vmid, vm['name'])
89
        source_ds_ref = disk["VCENTER_DS_REF"]
90
    end
91

  
79 92
    source_ds_vc = VCenterDriver::Datastore.new_from_ref(source_ds_ref, vi_client)
80 93

  
81
    # Get image source path
82
    src_path = VCenterDriver::FileHelper.get_img_name(disk, vmid, vm['name'])
94

  
95

  
83 96

  
84 97
    # Get target ds ref
85 98
    target_ds = VCenterDriver::VIHelper.one_item(OpenNebula::Datastore, target_ds_id)

Also available in: Unified diff