Skip to content

Commit

Permalink
B OpenNebula#2477 VCENTER_ESX_HOST fail with DRS in vCenter
Browse files Browse the repository at this point in the history
  • Loading branch information
joseangelgm committed Oct 5, 2018
1 parent 04c09dd commit cc2457d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/sunstone/OpenNebulaVNC.rb
Original file line number Diff line number Diff line change
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
5 changes: 2 additions & 3 deletions src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,6 @@ def migrate(config = {})

@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 @@ -2367,9 +2366,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
1 change: 0 additions & 1 deletion src/vmm_mad/remotes/lib/vcenter_driver/vm_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,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
2 changes: 0 additions & 2 deletions src/vmm_mad/remotes/vcenter/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ begin
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} " \
Expand Down

0 comments on commit cc2457d

Please sign in to comment.