Configuring NSX-T opaque network as a VM port group with PowerCLI
book
Article ID: 324798
calendar_today
Updated On:
Products
VMware NSXVMware vSphere ESXi
Issue/Introduction
Symptoms: Managing a virtual machine’s network configuration specific to port groups being sourced from NSX-T based opaque networks may fail because the network is unable to be found on the host.
Error Example: Set-NetworkAdapter : 22/03/2018 15:56:17 Set-NetworkAdapter The network "network-name" doesn't exist on the host. At line:1 char:38 + ... rkAdapter | Set-NetworkAdapter -NetworkName “network-name” + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (Network-name:String) [Set-NetworkAdapter], iError + FullyQualifiedErrorId : Client20_VmHostServiceImpl_TryGetHostNetworkByName_NonexistentNetwork,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.SetNetworkAdapter
Environment
VMware NSX-T
Resolution
Currently, there is no resolution.
Workaround: To work around this issue, a new object for the opaque network has to be created to properly configure the port group setting on a virtual machine.
The function Set-NetworkAdapterOpaqueNetwork will create that new object and will replace the usage of Set-NetworkAdapter in the meantime.
function Set-NetworkAdapterOpaqueNetwork { param( [Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 1)] [VMware.VimAutomation.Types.NetworkAdapter] $NetworkAdapter,
[Parameter(Mandatory = $true, Position = 2)] [string] $OpaqueNetworkName,
[Parameter()] [switch] $Connected,
[Parameter()] [switch] $StartConnected ) process { $opaqueNetwork = Get-View -ViewType OpaqueNetwork | ? {$_.Name -eq $OpaqueNetworkName} if (-not $opaqueNetwork) { throw "'$OpaqueNetworkName' network not found." }