Skip to content

Commit e249a03

Browse files
authored
Fix vmware_guest idempotency when using dvswitch (fixes #498) (#2000)
SUMMARY This fixes the idempotency issue reported in #498 caused by nic.device.deviceInfo.summary containing DVSwitch: d5 6e 22 50 dd f2 94 7b-a6 1f b2 c2 e6 aa 0f instead of a readable portgroup name. ISSUE TYPE Bugfix Pull Request COMPONENT NAME vmware_guest Reviewed-by: Mario Lenz <[email protected]>
1 parent 394a5a6 commit e249a03

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bugfixes:
2+
- vmware_guest - Fix vmware_guest always reporting change when using dvswitch.
3+
(https://github.com/ansible-collections/community.vmware/pull/2000).

plugins/modules/vmware_guest.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1936,8 +1936,15 @@ def configure_network(self, vm_obj):
19361936
nic_change_detected = True
19371937

19381938
if nic.device.deviceInfo.summary != network_name:
1939-
nic.device.deviceInfo.summary = network_name
1940-
nic_change_detected = True
1939+
if 'DVSwitch' not in nic.device.deviceInfo.summary:
1940+
nic.device.deviceInfo.summary = network_name
1941+
nic_change_detected = True
1942+
else:
1943+
pg = find_obj(self.content, [vim.DistributedVirtualPortgroup], network_name)
1944+
if pg is None or nic.device.backing.port.portgroupKey != pg.key:
1945+
nic.device.deviceInfo.summary = network_name
1946+
nic_change_detected = True
1947+
19411948
if 'device_type' in network_devices[key]:
19421949
device = self.device_helper.nic_device_type.get(network_devices[key]['device_type'])
19431950
if not isinstance(nic.device, device):

0 commit comments

Comments
 (0)