Revision e3b9f6f7 src/vmm_mad/remotes/lib/vcenter_driver/importer.rb

View differences:

src/vmm_mad/remotes/lib/vcenter_driver/importer.rb
53 53

  
54 54
        #template << template_nics
55 55

  
56
        # Get DS_ID for the deployment, the wild VM needs a System DS
57
        dc_ref = vcenter_vm.get_dc.item._ref
58
        ds_ref = template.match(/^VCENTER_DS_REF *= *"(.*)" *$/)[1]
59

  
60
        begin
61
            ds_one = dpool.select do |e|
62
                e["TEMPLATE/TYPE"]                == "SYSTEM_DS" &&
63
                e["TEMPLATE/VCENTER_DS_REF"]      == ds_ref &&
64
                e["TEMPLATE/VCENTER_DC_REF"]      == dc_ref &&
65
                e["TEMPLATE/VCENTER_INSTANCE_ID"] == vc_uuid
66
            end.first
67
        rescue
68
            raise "DS with ref #{ds_ref} is not imported in OpenNebula, aborting Wild VM import."
69
        end
70

  
56 71
        rc = one_vm.allocate(template)
57 72
        return rc if OpenNebula.is_error?(rc)
58 73

  
59
        rc = one_vm.deploy(host_id, false)
74
        rc = one_vm.deploy(host_id, false, ds_one.id)
60 75
        return rc if OpenNebula.is_error?(rc)
61 76

  
62 77
        # Set reference to template disks and nics in VM template

Also available in: Unified diff