VMware: Update other parameters in vSwitch (#43883)

Allow parameter update for vSwitch without any NICs

Fixes: #43821

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-08-20 10:00:57 +05:30 committed by GitHub
parent d06d1d4840
commit e6f0f8073d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -308,16 +308,11 @@ class VMwareHostVirtualSwitch(PyVmomi):
vswitch_pnic_info['num_ports'] != self.number_of_ports: vswitch_pnic_info['num_ports'] != self.number_of_ports:
diff = True diff = True
if not all_nics:
diff = False
results['result'] += " as no NICs provided / found which are required while updating vSwitch."
try: try:
if diff: if diff:
# vSwitch needs every parameter again while updating,
# even if we are updating any one of them
vss_spec = vim.host.VirtualSwitch.Specification() vss_spec = vim.host.VirtualSwitch.Specification()
vss_spec.bridge = vim.host.VirtualSwitch.BondBridge(nicDevice=all_nics) if all_nics:
vss_spec.bridge = vim.host.VirtualSwitch.BondBridge(nicDevice=all_nics)
vss_spec.numPorts = self.number_of_ports vss_spec.numPorts = self.number_of_ports
vss_spec.mtu = self.mtu vss_spec.mtu = self.mtu