From 9260ad67c9b6c3601d1531a842e7774cf24c2ab8 Mon Sep 17 00:00:00 2001 From: Leonid Plisov Date: Thu, 26 Dec 2024 00:58:57 +0300 Subject: [PATCH] add one more fix --- plugins/modules/vmware_guest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/modules/vmware_guest.py b/plugins/modules/vmware_guest.py index 864a8dfc7..ff386e4ef 100644 --- a/plugins/modules/vmware_guest.py +++ b/plugins/modules/vmware_guest.py @@ -1940,7 +1940,12 @@ def configure_network(self, vm_obj): nic.device.deviceInfo.summary = network_name nic_change_detected = True else: - pg = find_obj(self.content, [vim.DistributedVirtualPortgroup], network_name) + pgs = self.find_network_by_name(network_name) + if len(pgs) == 1: + pg = pgs[0] + 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