From b4debfad9a19da2d28aa58b93897445531c8f886 Mon Sep 17 00:00:00 2001 From: Yasen Simeonov Date: Mon, 2 Apr 2018 11:35:13 +0200 Subject: [PATCH] Add NSX-T Logical Switch support in vmware_guest (#37979) * Add NSX-T Logical Switch support in vmware_guest * Update vmware_guest.py add space after % operator --- lib/ansible/modules/cloud/vmware/vmware_guest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index 7504a73d5ed..6985ca5497c 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py @@ -1117,6 +1117,14 @@ class PyVmomiHelper(PyVmomi): dvs_port_connection.switchUuid = pg_obj.config.distributedVirtualSwitch.uuid nic.device.backing = vim.vm.device.VirtualEthernetCard.DistributedVirtualPortBackingInfo() nic.device.backing.port = dvs_port_connection + + elif isinstance(self.cache.get_network(network_name), vim.OpaqueNetwork): + # NSX-T Logical Switch + nic.device.backing = vim.vm.device.VirtualEthernetCard.OpaqueNetworkBackingInfo() + nic.device.backing.opaqueNetworkType = 'nsx.LogicalSwitch' + nic.device.backing.opaqueNetworkId = self.cache.get_network(network_name).summary.opaqueNetworkId + nic.device.deviceInfo.summary = 'nsx.LogicalSwitch: %s' % (self.cache.get_network(network_name).summary.opaqueNetworkId) + else: # vSwitch if not isinstance(nic.device.backing, vim.vm.device.VirtualEthernetCard.NetworkBackingInfo):