1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-13 12:58:17 +03:00

F #4913: Fix assign_proxy_switch and update_vss for enhanced network

This commit is contained in:
mcabrerizo 2017-06-11 19:23:54 +02:00
parent 23e86e012b
commit 4e71fc51a3

View File

@ -670,11 +670,15 @@ class ESXHost
#Compare current configuration and return if switch hasn't changed
same_switch = false
switch_has_pnics = switch.spec.respond_to?(:bridge) && switch.spec.bridge.respond_to?(:nicDevice)
same_switch = switch.spec.respond_to?(:mtu) && switch.spec.mtu == mtu &&
switch.spec.respond_to?(:numPorts) && switch.spec.mtu == num_ports &&
(!pnics || (pnics && switch.spec.respond_to?(:bridge) &&
switch.spec.bridge.respond_to?(:nicDevice) &&
switch.spec.bridge.nicDevice.uniq.sort == pnics.uniq.sort))
switch.spec.respond_to?(:numPorts) && switch.spec.numPorts == num_ports &&
(!switch_has_pnics && pnics.empty? ||
switch_has_pnics && switch.spec.bridge.nicDevice.uniq.sort == pnics.uniq.sort)
return if same_switch
# Let's create a new spec and update the switch
@ -754,6 +758,9 @@ class ESXHost
def assign_proxy_switch(dvs, switch_name, pnics, pnics_available)
dvs = dvs.item
# Return if host is already assigned
return dvs if !dvs['config.host'].select { |host| host.config.host._ref == self['_ref'] }.empty?
# Prepare spec for DVS reconfiguration
configSpec = RbVmomi::VIM::VMwareDVSConfigSpec.new
configSpec.name = switch_name
@ -761,7 +768,7 @@ class ESXHost
# Check if host is already assigned to distributed switch
operation = "add"
operation = "edit" if !dvs['config.host'].select { |host| host.config.host._ref == self['_ref'] }.empty?
##operation = "edit" if !dvs['config.host'].select { |host| host.config.host._ref == self['_ref'] }.empty?
# Add host members to the distributed virtual switch
host_member_spec = RbVmomi::VIM::DistributedVirtualSwitchHostMemberConfigSpec.new