B #2477 VCENTER_ESX_HOST fail with DRS in vCenter (#2478)

This commit is contained in:
Jose Angel Garrido Montoya authored and Tino Vázquez committed 2018-10-05 15:43:34 +02:00
1 parent 7bcc29befc
commit 2571365186
4 files changed
+4 -11

No files matched your search

+1 -3
View File
@@ -213,9 +213,7 @@ class OpenNebulaVNC
# If it is a vCenter VM
if vm_resource['USER_TEMPLATE/HYPERVISOR'] == "vcenter"
if vm_resource['USER_TEMPLATE/VCENTER_ESX_HOST']
host = vm_resource['USER_TEMPLATE/VCENTER_ESX_HOST']
elsif vm_resource['MONITORING/VCENTER_ESX_HOST']
if vm_resource['MONITORING/VCENTER_ESX_HOST']
host = vm_resource['MONITORING/VCENTER_ESX_HOST']
else
return error(400,"Could not determine the vCenter ESX host where the VM is running. Wait till the VCENTER_ESX_HOST attribute is retrieved once the host has been monitored")
@@ -71,7 +71,6 @@ def self.import_wild(host_id, vm_ref, one_vm, template)
end
template << template_nics
template << "VCENTER_ESX_HOST = #{vcenter_vm["runtime.host.name"].to_s}\n"
# Get DS_ID for the deployment, the wild VM needs a System DS
dc_ref = vcenter_vm.get_dc.item._ref
@@ -2903,8 +2903,6 @@ class VirtualMachine < Template
#@item.RelocateVM_Task(spec: relocate_spec, priority: "defaultPriority").wait_for_completion
@item.MigrateVM_Task(:pool=> resourcepool, :priority => "defaultPriority").wait_for_completion
return get_esx_name
rescue Exception => e
raise "Cannot migrate VM #{e.message}\n#{e.backtrace.join("\n")}"
end
@@ -3363,9 +3361,9 @@ class VirtualMachine < Template
vc_host = VCenterDriver::ClusterComputeResource.new_from_ref(ccr_ref, vi_client).item
config = { :cluster => vc_host }
esx = vc_vm.migrate(config)
vc_vm.migrate(config)
vm.replace({ 'VCENTER_CCR_REF' => ccr_ref, 'VCENTER_ESX_HOST' => esx })
vm.replace({'VCENTER_CCR_REF' => ccr_ref})
end
# Try to build the vcenterdriver virtualmachine without
+1 -3
View File
@@ -68,10 +68,8 @@ begin
vm.reconfigure
vm.poweron
vm.set_running(true)
vm.one_item.update("VCENTER_ESX_HOST = #{vm['runtime.host.name']}", true)
puts vm['_ref']
rescue StandardError => e
message = "Deploy of VM #{vm_id} on vCenter cluster #{cluster_name} " \
"with #{dfile} failed due to \"#{e.message}\"."