VMware Cloud Community
JayScheponik
Contributor
Contributor

Issues migrating Management VSS to VDS

So I am trying to migrate my management VSS to my management VDS. Below is the code I am using.

Get-VDSwitch -Name "LVA-Management" | Add-VDSwitchVMHost -VMHost $vmh -Confirm:$false

$dvSw = Get-VDSwitch -Name "LVA-Management"

$vmnic0 = Get-VMHost $vmh | Get-VMHostNetworkAdapter -Physical -Name vmnic0
$vmnic7 = Get-VMHost $vmh | Get-VMHostNetworkAdapter -Physical -Name vmnic7

$vSwitch = Get-VMHost $vmh | `
  Get-VirtualSwitch | Where-Object {$_.Name -eq "vSwitch0"}
$Nics = $vSwitch.Nic
$ArrayList = New-Object System.Collections.ArrayList
$Nics | ForEach-Object {$ArrayList.Add($_)}
$ArrayList.Remove("vmnic0")
$vSwitch | Set-VirtualSwitch -Nic $ArrayList -Confirm:$false

Get-VDSwitch "LVA-Management" | Add-VDSwitchPhysicalNetworkAdapter -VMHostNetworkAdapter $vmnic0 -Confirm:$false

Remove-VirtualSwitch -VirtualSwitch $vSwitch

Get-VDSwitch "LVA-Management" | Add-VDSwitchPhysicalNetworkAdapter -VMHostNetworkAdapter $vmnic7 -Confirm:$false

The problem I run into is that while vmnic0 is added to the VDS, it isn't added to dvPG which causes vmnic7 piece to fail since it would cause the host to not have a management network. I am running 5.1U2 which has the VDS components as part of the client. Any help on this would be appreciated.

0 Kudos
12 Replies
LucD
Leadership
Leadership

Did you create that dvPG with the New-VMHostNetworkAdapter cmdlet with the Console switch ?

For the VirtualSwitch parameter you can specify the vDSW


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

0 Kudos
JayScheponik
Contributor
Contributor

I created the VDS and dvPG with the following ($cboLoc is just a drop down list):

New-VDSwitch -Name "$($cboLoc.Text)-Management" -Location $myDC -MaxPorts 136

Get-VDSwitch -Name "$($cboLoc.Text)-Management" | New-VDPortgroup -Name "Management Network" -NumPorts 128

At this point, I am trying to migrate the existing management VSS to the new VDS as we are getting ready to migrate to VDS.

0 Kudos
LucD
Leadership
Leadership

You will have to define that you are creating console vNIC.

Try adding something like this

New-VMHostNetworkAdapter -VMHost $vmh -PortGroup "Management Network" -VirtualSwitch $dvSw -ConsoleNic


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

0 Kudos
JayScheponik
Contributor
Contributor

PS \Documents> New-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -portgroup "Management Network" -ConsoleNic

New-VMHostNetworkAdapter : 5/10/2013 7:32:12 AM    New-VMHostNetworkAdapter        The operation is not supported on

the object.  

At line:1 char:25

+ New-VMHostNetworkAdapter <<<<  -VMHost $myVMHost -VirtualSwitch $myVDSwitch -portgroup "Management Network" -ConsoleNic

    + CategoryInfo          : NotSpecified: (:) [New-VMHostNetworkAdapter], NotSupported

    + FullyQualifiedErrorId : Client20_VmHostServiceImpl_NewVMHostNetworkAdapter_ViError,VMware.VimAutomation.ViCor

   e.Cmdlets.Commands.Host.NewVMHostNetworkAdapter

0 Kudos
LucD
Leadership
Leadership

I get the same message now, I'll have to have a look


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

0 Kudos
JayScheponik
Contributor
Contributor

I will also keep hacking away at it as well. Thanks for the assist.

0 Kudos
LucD
Leadership
Leadership

I think I might have found a way to to define the vNic for the console.

Try like this

$dvSwitchName = "LVA-Management"
$dvPortgroupName = "Management Network"
$dvSCIp = "192.168.1.1"
$dvSCMask = "255.255.255.0"

$netSys = Get-View $vmh.ExtensionData.ConfigManager.NetworkSystem

$nic = New-Object VMware.Vim.HostVirtualNicSpec
$nic.ip = New-Object VMware.Vim.HostIpConfig
$nic.ip.dhcp = $false
$nic.ip.ipAddress = $dvSCIp
$nic.ip.subnetMask = $dvSCMask
$nic.distributedVirtualPort = New-Object VMware.Vim.DistributedVirtualSwitchPortConnection
$nic.distributedVirtualPort.switchUuid = $vds.ExtensionData.Uuid
$nic.distributedVirtualPort.portgroupKey = $vpg.ExtensionData.MoRef.Value

$vnicName = $netSys.AddVirtualNic("", $nic)

$vnicMgr = Get-View $vmh.ExtensionData.ConfigManager.VirtualNicManager
$vnicMgr.SelectVnicForNicType("management", $vnicName)


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

0 Kudos
JayScheponik
Contributor
Contributor

So I ran this:

$vmh = Get-VMHost -Name "myhost" (assumed needed for extension data reference)
$vds = Get-VDSwitch -Name "LVA-Management" (assumed needed for extension data reference)
$vpg = $vds | Get-VDPortgroup -Name "Management Network"  (assumed needed for extension data reference)


$dvSwitchName = "LVA-Management"
$dvPortgroupName = "Management Network"
$dvSCIp = "192.168.1.1"
$dvSCMask = "255.255.255.0"

$netSys = Get-View $vmh.ExtensionData.ConfigManager.NetworkSystem

$nic = New-Object VMware.Vim.HostVirtualNicSpec
$nic.ip = New-Object VMware.Vim.HostIpConfig
$nic.ip.dhcp = $false
$nic.ip.ipAddress = $dvSCIp
$nic.ip.subnetMask = $dvSCMask
$nic.distributedVirtualPort = New-Object VMware.Vim.DistributedVirtualSwitchPortConnection
$nic.distributedVirtualPort.switchUuid = $vds.ExtensionData.Uuid
$nic.distributedVirtualPort.portgroupKey = $vpg.ExtensionData.MoRef.Value

$vnicName = $netSys.AddVirtualNic("", $nic)

$vnicMgr = Get-View $vmh.ExtensionData.ConfigManager.VirtualNicManager
$vnicMgr.SelectVnicForNicType("management", $vnicName)

And get this...

Exception calling "AddVirtualNic" with "2" argument(s): "A specified parameter was not correct.

PortConnection.switchUuid"

At line:22 char:34

+ $vnicName = $netSys.AddVirtualNic <<<< ($dvPortgroupName, $nic)

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : DotNetMethodException

Exception calling "SelectVnicForNicType" with "2" argument(s): "A specified parameter was not correct.

"

At line:25 char:30

+ $vnicMgr.SelectVnicForNicType <<<< ("management", $vnicName)

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : DotNetMethodException

I'm sure im missing something....

0 Kudos
LucD
Leadership
Leadership

Which vSphere version and which distributed switch versions are you running this against ?

And yes, your assumptions at the top are correct.


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

0 Kudos
JayScheponik
Contributor
Contributor

vCenter - 5.1.0, 947673

VDS - 5.1.0 00000

PowerCLI Version

----------------

   VMware vSphere PowerCLI 5.1 Release 2 build 1012425

---------------

Snapin Versions

---------------

   VMWare AutoDeploy PowerCLI Component 5.1 build 768137

   VMWare ImageBuilder PowerCLI Component 5.1 build 768137

   VMware vCloud Director PowerCLI Component 5.1 build 1012427

   VMware License PowerCLI Component 5.1 build 669840

   VMware VDS PowerCLI Component 5.1 build 1012428

   VMware VDS vSphere PowerCLI Component 4.1.1 build 000001

   VMware vSphere PowerCLI Component 5.1 build 1012428

0 Kudos
JayScheponik
Contributor
Contributor

OK so the script runs if you are creating a new VMKernel Port with a new IP, which is nice to know. This doesn't fix the initial issue, but for new builds, it's quite handy. It does not however add the vmnic to the uplink. Will continue to plug away.

0 Kudos
markdjones82
Expert
Expert

Are you trying to migrate your management vmkeernel port to the VDS?  I had the same problem with the 1000v, but my issue was it would get knocked offline every time because it would add it to the incorrect uplink port group.  On the 1000v we have a "quarantine" port group that it would keep adding it to :/.

I have not found a way to specify the Uplink portgroup with the existing commands on 1000v, but maybe they will work with the VDS. If not I'm sure Luc can figure it out!

EDIT: I attempted the below, but you can't set the port group on the physical adapter.

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

When you add the physical adapter to the VDS what port group does it add it to?

EDIT again:


I just tested in my lab and adding the physical adapter to a VDS with this command adds it to my DVuplinks port group. I am on 5.0 U2 though. Try swinging one interface first, then moving the management in another command:

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

$portgroup = $VDSwitch | Get-VirtualPortGroup | where { $_.Name -eq "management"}

Get-VMHostNetworkAdapter -VMHost $vmhost -Name "vmk0" | Set-VMHostNetworkAdapter -PortGroup $portgroup

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