Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xNew-VM does not accommodate NSX-T Opaque Networks in the destination vCenter #119

Open
chriskoch99 opened this issue May 13, 2022 · 0 comments

Comments

@chriskoch99
Copy link

chriskoch99 commented May 13, 2022

Hello,

We're using Azure VMware Services as a DR destination for Horizon, and using xNew-VM to clone on-prem parent VMs up to the Azure SDDC. xNew-VM (as-written) does not correctly create NICs on new VMs in the AVS SDDC because it does not have code coverage for NSX-T "Opaque" networks. I have added the code below, starting after line 145 in the original script, and it seems to work correctly.

     } elseif ($switchtype -eq "nsx") {
        foreach ($vmNetworkAdapter in $vmNetworkAdapters) {
            # New VM Network to assign vNIC
            $vmnetworkname = ($vmnetworks -split ",")[$count]

            # Target the Opaque Network to which we need to connect
            $opaqueNetwork = Get-View -ViewType OpaqueNetwork | ? {$_.Name -eq $vmnetworkname}
            
            # Device Change spec for Opaque Network
            $dev = New-Object VMware.Vim.VirtualDeviceConfigSpec
            $dev.Operation = "edit"
            $dev.Device = $vmNetworkAdapter
            $dev.device.backing = New-Object VMware.Vim.VirtualEthernetCardOpaqueNetworkBackingInfo
            $dev.device.backing.OpaqueNetworkId = $opaqueNetwork.Summary.OpaqueNetworkId
            $dev.device.backing.OpaqueNetworkType = $opaqueNetwork.Summary.OpaqueNetworkType
            $locationSpec.DeviceChange += $dev
            $count++
        } 

Reference:
https://networkinferno.net/powercli-and-opaque-networks
https://blogs.vmware.com/PowerCLI/2019/02/configuring-vms-opaque-networks.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant