VMware Cloud Community
markdjones82
Expert
Expert

Migrate physical adapter to DVS(1000v)

All,

  I am working on a migration script where we have to remove from an existing 1000v and then move onto another.  My remove part works great, but when trying to add the adapter to the other side I am having problems because it does not add to the right uplink group.  Is there a way to tell the physical interface vmnic1 to be part of an uplink port group.

My original script (just the vmnic1 part)

#remove 1 interface from standard to be added to DVS
 
#Add to new DVSwitch and swing leg over
Get-VirtualSwitch -VMHost $VMHost -name "vSwitch0" | Set-VirtualSwitch -Nic "vmnic0" -Confirm:$false
$VDSwitch = Get-VDSwitch | Where {$_.Name -eq "VSM01"}
$VDSwitchAdd-VDSwitchVMHost -VMHost $VMHost -Confirm:$false
$vmhostadapter = $VMhostObj | Get-VMHostNetworkAdapter -Physical -Name vmnic1 
$VDSwitch | Add-VDSwitchPhysicalNetworkAdapter -VMHostNetworkAdapter $vmhostadapter -Confirm:$false

How can i tell vmnic1 to use uplink port group 10G-Phys?

I tried this but got error below:

$uplinkportgroup = Get-VDPortgroup -name phys-10g -VDSwitch $VDSwitch
Set-VMHostNetworkAdapter -PortGroup $uplinkportgroup -PhysicalNic $vmhostadapter

PowerCLI U:\> Set-VMHostNetworkAdapter -PortGroup $uplinkportgroup -Physicalnic $vmhostadapter Set-VMHostNetworkAdapter : Parameter set cannot be resolved using the specified named parameters. At line:1 char:1 + Set-VMHostNetworkAdapter -PortGroup $uplinkportgroup -Physicalnic $vmhostadapter + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : InvalidArgument: (:) [Set-VMHostNetworkAdapter], ParameterBindingException     + FullyQualifiedErrorId : AmbiguousParameterSet,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.SetVMHostNetwork   Adapter

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
7 Replies
LucD
Leadership
Leadership

You have to use the VirtualNic parameter instead of the PhysicalNic parameter.

Those 2 lines should be

$uplinkportgroup = Get-VDPortgroup -name phys-10g -VDSwitch $VDSwitch
Set-VMHostNetworkAdapter -PortGroup $uplinkportgroup -VirtualNic $vmhostadapter


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

0 Kudos
markdjones82
Expert
Expert

Luc,

I thought this to be the case myself and I tried it, but it doesn't work.  The problem I am having is our 1000v has a uplink portgroup called "unused/quarantined" and it is adding the physical interface to that on this command:

$VDSwitch | Add-VDSwitchPhysicalNetworkAdapter -VMHostNetworkAdapter $vmhostadapter -Confirm:$false

From there I am trying to have the physical adapter added to a uplink port group 10G-phys.  I think it may be something wierd going on with our 1000v though because i sear this command used to work.

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos
LucD
Leadership
Leadership

That looks indeed as if something is missing from the current cmdlets.

You might have a look at my dvSwitch scripting – Part 4 – NIC teaming post.

The functions in there add some pNICs and then combine them with already present pNICs in a team for a specific portgroup.


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

0 Kudos
markdjones82
Expert
Expert

Thanks Luc, I think it has something to do with the odd way the 1000v on our side works not adding to the right uplink group 😕  There is a specific way you have to add a physical nic and the management interface.  Suffice to say we are probably moving to the VDS on 5.1

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos
sastre
Enthusiast
Enthusiast

I too am having this problem with specifying the correct uplink port group for a NIC to use when moving to the 1000V.

0 Kudos
markdjones82
Expert
Expert

Sastre,

  I still have not been able to find a solution with the 1000v unfortunately.  We are most likely moving to the vmware DVS when we move to 5.1 for reasons like this.  If I find a solution I will be sure to post it to this thread.

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
sastre
Enthusiast
Enthusiast

Thanks for the reply Smiley Happy

0 Kudos