Skip to content

Commit

Permalink
B #2477 VCENTER_ESX_HOST fail with DRS in vCenter (#2478)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2571365)
  • Loading branch information
joseangelgm authored and Tino Vazquez committed Oct 5, 2018
1 parent 3d8f6c0 commit 2d4b7cb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/sunstone/OpenNebulaVNC.rb
Expand Up @@ -213,9 +213,7 @@ def proxy(vm_resource)

# 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")
Expand Down
1 change: 0 additions & 1 deletion src/vmm_mad/remotes/lib/vcenter_driver/importer.rb
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb
Expand Up @@ -2903,8 +2903,6 @@ def migrate(config = {})
#@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
Expand Down Expand Up @@ -3363,9 +3361,9 @@ def self.migrate_routine(vm_id, src_host, dst_host, ds = nil)
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
Expand Down
4 changes: 1 addition & 3 deletions src/vmm_mad/remotes/vcenter/deploy
Expand Up @@ -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}\"."
Expand Down

0 comments on commit 2d4b7cb

Please sign in to comment.