rxjoseph
Enthusiast
Enthusiast

vMotion between VDS and NSX-T

Hi Experts

I have a script to simple vMotion a VM between vDS portgroup and NSX-T Opaque Network

See script below

The error happen during the Move-VM operation 

Move-VM -vm $VM -Destination $destination -NetworkAdapter $networkAdapter -Network $destinationNSXPortGroup

I have filtered the Opaque network so itchnically it should do the job but it dosent  can i get some help please

PS C:\> $destinationNSXPortGroup

Name                                        NetworkType
---- -----------
Sample-VLAN-600-XX-VMN    Opaque

Error

PS C:\> Move-VM -vm $VM -Destination $destination -NetworkAdapter $networkAdapter -Network $destinationNSXPortGroup
Move-VM : 16-9-2021 12:43:22 Move-VM The operation for the entity "NSXmigtst001" fai
led with the following message: "Currently connected network interface 'Network adapt
er 1' cannot use network 'OTA-VLAN-633-BB-VMN (nsx.LogicalSwitch:15d096f6-0527-4c6b-9
5de-ff73eefdb7a0)', because the type of the destination network is not supported for
vMotion based on the source network type.". See KB article 56991 for more details.
At line:1 char:1
+ Move-VM -vm $VM -Destination $destination -NetworkAdapter $networkAda ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Move-VM], CannotUseNetwork
+ FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpdates_Op
erationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

 

###################################################################

Foreach ($VMdetail in $VMdetails) {


$VM = Get-VM -Name $VMdetail.VMNAME -ErrorAction SilentlyContinue


If ($VM) {
Write-Host "VM ==> $VM is a alive on the source VC ==>$global:DefaultVIServer" -ForegroundColor Yellow
}
Else {
Write-Host 'VM' $VMdetail.VMNAME' Cannot be found' -ForegroundColor Magenta
continue
}

# End the loop
#}

####################################################################################################################################
# Check if there is a Destination ESXi host on the specified cluster
# If found proceed or skip to next record
####################################################################################################################################



$destination = Get-cluster $vmdetail.ClusterNSXT -ErrorAction SilentlyContinue |Get-VMHost -Name $VMdetail.ESXiNSXT

if ($destination){
Write-Host "VM will be placed on ESXi host ==>" -ForegroundColor Yellow $destination
}
Else {
Write-host "Destination ESXi host" $vmdetail.ClusterNSXT "is not Accessible" -ForegroundColor Magenta
continue
}

# End loop
# }

 

######################################################
## Check if the Network Adapter for the VM is found ##
## If found proceed or skip to next record ##
######################################################

 

$networkAdapter = Get-NetworkAdapter -vm $VM -ErrorAction SilentlyContinue

If ($networkAdapter){
Write-Host "VM Network Adaptor info ==>$networkAdapter" -ForegroundColor Yellow
}
Else {
Write-Host "Network Adpater cannot be attahced and migration will fail" -ForegroundColor Magenta
continue
}

# End loop
# }


#########################################################################################
## Check if the destination NSXT Portgroup is available, also check if the destination ##
## NetworkAdapteNSXT PortGroup is found, if unavailable skip to the next record ##
#########################################################################################


$destinationNSXPortGroup = Get-VirtualNetwork -name $VMdetail.PortGroupNSXT |where {$_.networktype -eq "Opaque"} -ErrorAction SilentlyContinue

If ($destinationNSXPortGroup){
Write-Host "VM will be moved to following PortGroup ==>$destinationNSXPortGroup " -ForegroundColor Yellow
}
Else {
Write-Host "NSX-T Overlay Switch or PortGroup cannot be found " -ForegroundColor Magenta
continue
}


####################################################################################################################################
# Move VM
# Change Network Adapter

####################################################################################################################################

Move-VM -vm $VM -Destination $destination -NetworkAdapter $networkAdapter -Network $destinationNSXPortGroup

}

############################################################################################

 

0 Kudos
4 Replies
LucD
Leadership
Leadership

Did you check if you meet the requirement mention in KB56991, as the error message suggests?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
rxjoseph
Enthusiast
Enthusiast

Hi LucD

 

Yes we are on vCenter

VersionRelease DateVAMI/Release NotesClient/MOB/vpxd.log
vCenter Appliance 6.7 Update 3n (6.7.0.48000)2021-05-251801053118010599

 

Also we are on NSX-T 3.51

 

Many thanks

 

Roshan

0 Kudos
rxjoseph
Enthusiast
Enthusiast

Hi LucD

Also I can do this task from the HTML client, its just the powercli is not working

Many thanks

 

Roshan

0 Kudos
LucD
Leadership
Leadership

Then I suggest you open an SR.

If GSS should incorrectly claim that PowerCLI is not supported without a Dev Support contract, point them to PowerCLI Support Breakdown


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos