Revision 4e71fc51 src/vmm_mad/remotes/lib/vcenter_driver/host.rb
src/vmm_mad/remotes/lib/vcenter_driver/host.rb | ||
---|---|---|
670 | 670 |
|
671 | 671 |
#Compare current configuration and return if switch hasn't changed |
672 | 672 |
same_switch = false |
673 |
|
|
674 |
switch_has_pnics = switch.spec.respond_to?(:bridge) && switch.spec.bridge.respond_to?(:nicDevice) |
|
675 |
|
|
676 |
|
|
677 |
|
|
673 | 678 |
same_switch = switch.spec.respond_to?(:mtu) && switch.spec.mtu == mtu && |
674 |
switch.spec.respond_to?(:numPorts) && switch.spec.mtu == num_ports && |
|
675 |
(!pnics || (pnics && switch.spec.respond_to?(:bridge) && |
|
676 |
switch.spec.bridge.respond_to?(:nicDevice) && |
|
677 |
switch.spec.bridge.nicDevice.uniq.sort == pnics.uniq.sort)) |
|
679 |
switch.spec.respond_to?(:numPorts) && switch.spec.numPorts == num_ports && |
|
680 |
(!switch_has_pnics && pnics.empty? || |
|
681 |
switch_has_pnics && switch.spec.bridge.nicDevice.uniq.sort == pnics.uniq.sort) |
|
678 | 682 |
return if same_switch |
679 | 683 |
|
680 | 684 |
# Let's create a new spec and update the switch |
... | ... | |
754 | 758 |
def assign_proxy_switch(dvs, switch_name, pnics, pnics_available) |
755 | 759 |
dvs = dvs.item |
756 | 760 |
|
761 |
# Return if host is already assigned |
|
762 |
return dvs if !dvs['config.host'].select { |host| host.config.host._ref == self['_ref'] }.empty? |
|
763 |
|
|
757 | 764 |
# Prepare spec for DVS reconfiguration |
758 | 765 |
configSpec = RbVmomi::VIM::VMwareDVSConfigSpec.new |
759 | 766 |
configSpec.name = switch_name |
... | ... | |
761 | 768 |
|
762 | 769 |
# Check if host is already assigned to distributed switch |
763 | 770 |
operation = "add" |
764 |
operation = "edit" if !dvs['config.host'].select { |host| host.config.host._ref == self['_ref'] }.empty? |
|
771 |
##operation = "edit" if !dvs['config.host'].select { |host| host.config.host._ref == self['_ref'] }.empty?
|
|
765 | 772 |
|
766 | 773 |
# Add host members to the distributed virtual switch |
767 | 774 |
host_member_spec = RbVmomi::VIM::DistributedVirtualSwitchHostMemberConfigSpec.new |
Also available in: Unified diff