From bc3db437e8d0e86270d0ff54200b2e559baec7f1 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 19 Jul 2018 16:46:44 +0530 Subject: [PATCH] VMware: handle pnic in proxyswitch Fixes: #42943 Signed-off-by: Abhijeet Kasurde (cherry picked from commit f2640d339493bd827dad3cfbcb5b18467fac0155) --- changelogs/fragments/42943_vmware_vmnic_fix.yaml | 2 ++ lib/ansible/modules/cloud/vmware/vmware_host_vmnic_facts.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/42943_vmware_vmnic_fix.yaml diff --git a/changelogs/fragments/42943_vmware_vmnic_fix.yaml b/changelogs/fragments/42943_vmware_vmnic_fix.yaml new file mode 100644 index 00000000000..b01909360ef --- /dev/null +++ b/changelogs/fragments/42943_vmware_vmnic_fix.yaml @@ -0,0 +1,2 @@ +bugfixes: +- VMware handle pnic in proxyswitch (https://github.com/ansible/ansible/pull/42996) diff --git a/lib/ansible/modules/cloud/vmware/vmware_host_vmnic_facts.py b/lib/ansible/modules/cloud/vmware/vmware_host_vmnic_facts.py index 6c2007c666f..c64b8ab701b 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host_vmnic_facts.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host_vmnic_facts.py @@ -92,15 +92,15 @@ class HostVmnicMgr(PyVmomi): host_vmnic_facts['all'] = [pnic.device for pnic in nw_config.pnic] vswitch_vmnics = [] + proxy_switch_vmnics = [] if nw_config.vswitch: for vswitch in nw_config.vswitch: for vnic in vswitch.spec.bridge.nicDevice: vswitch_vmnics.append(vnic) - proxy_switch_vmnics = [] - if nw_config.vswitch: + if nw_config.proxySwitch: for proxy_config in nw_config.proxySwitch: - for proxy_nic in proxy_config.spec.bridge.nicDevice: + for proxy_nic in proxy_config.spec.backing.pnicSpec: proxy_switch_vmnics.append(proxy_nic.pnicDevice) used_vmics = proxy_switch_vmnics + vswitch_vmnics