Skip to content

Commit

Permalink
Fix vmware_guest idempotency when using dvswitch (fixes #498)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannik committed Sep 12, 2024
1 parent 50595f1 commit b385e03
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 @@
bugfixes:
- 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 @@ -1936,8 +1936,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 b385e03

Please sign in to comment.