Skip to content

Commit 361c82a

Browse files
committed
Fix vmware_guest idempotency when using dvswitch (fixes ansible-collections#498)
1 parent 371cea3 commit 361c82a

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+
minor_changes:
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)