Skip to content

Commit

Permalink
Fix vmware_guest idempotency when using dvswitch (fixes ansible-colle…
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannik committed Feb 16, 2024
1 parent 322f0c2 commit 7fc61f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- vmware_guest - Fix vmware_guest always reporting change when using dvswitch.
(https://github.com/ansible-collections/community.vmware/pull/2000).
11 changes: 9 additions & 2 deletions plugins/modules/vmware_guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1951,8 +1951,15 @@ def configure_network(self, vm_obj):
nic_change_detected = True

if nic.device.deviceInfo.summary != network_name:
nic.device.deviceInfo.summary = network_name
nic_change_detected = True
if 'DVSwitch' not in nic.device.deviceInfo.summary:
nic.device.deviceInfo.summary = network_name
nic_change_detected = True
else:
pg = find_obj(self.content, [vim.DistributedVirtualPortgroup], network_name)
if pg is None or nic.device.backing.port.portgroupKey != pg.key:
nic.device.deviceInfo.summary = network_name
nic_change_detected = True

if 'device_type' in network_devices[key]:
device = self.device_helper.nic_device_type.get(network_devices[key]['device_type'])
if not isinstance(nic.device, device):
Expand Down

0 comments on commit 7fc61f6

Please sign in to comment.