From 9d1fc8e2cd86f49b096bd39619c3f901f0d08308 Mon Sep 17 00:00:00 2001 From: Leonid Plisov Date: Mon, 23 Dec 2024 23:12:47 +0300 Subject: [PATCH] return old code --- plugins/modules/vmware_guest_network.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/modules/vmware_guest_network.py b/plugins/modules/vmware_guest_network.py index 90707c50c..aa66caa55 100644 --- a/plugins/modules/vmware_guest_network.py +++ b/plugins/modules/vmware_guest_network.py @@ -336,6 +336,8 @@ def _get_network_object(self, vm_obj): if isinstance(network, vim.dvs.DistributedVirtualPortgroup): dvs = network.config.distributedVirtualSwitch if (switch_name and dvs.config.name == switch_name) or not switch_name: + if network.config.name == network_name: + return network if hasattr(network.config.defaultPortConfig.vlan, 'vlanId') and \ network.config.defaultPortConfig.vlan.vlanId == vlan_id: return network @@ -343,6 +345,8 @@ def _get_network_object(self, vm_obj): network.config.defaultPortConfig.vlan.pvlanId == vlan_id: return network elif isinstance(network, vim.Network): + if network_name and network_name == network.name: + return network if vlan_id: for k in pg_lookup.keys(): if vlan_id == pg_lookup[k]['vlan_id']: