lamw / lamw/vmware-scripts

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

Open
#119 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
951
Forks
504
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in xNew-VM around line 145 and inspect how destination VM network adapters are configured for existing switch types. Compare that logic with the supplied NSX-T opaque-network example, then verify that cloned VMs in an Azure VMware Services destination vCenter receive the expected NIC connections.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.