VMware Cloud Community
MD1988
Contributor
Contributor

Migrating from vds to vss

Hello together,

I´m searching for the possibility to migrate the vmkernel and nics for management and vmotion from a virtual distributed switch to a virtual standard switch. At the moment I have esxi-servers with 6 physical nics (2 x management hypervisor, 2 x vmotion lan and 2 x vm-lan).

Now i would like to move the management and vmotion from the vds to the vss and since a lot of esxi-servers are concerned I would like to do that automatically by a powercli script. Is there any possibility for it?

I have already started putting some script lines together but i am just able to remove respectively one nic for management and one for vmotion create a standard switch connected to them. What i am not able to is to migrate the vmkernel for management and vmotion and creating a new one doesnt work since the ip-adresses cant be used twice.

Do you have any idea how to get this done? I have already found several scripts on the internet but none of them really helped me to get it done.

Thanks in advance for your help.

Best regards

MichDo

Reply
0 Kudos
7 Replies
linotelera
Hot Shot
Hot Shot

Try this: http://www.virtuallyghetto.com/2013/11/automate-reverse-migrating-from-vsphere.html William Lam docet!

The cmdlet to use is Add-VirtualSwitchPhysicalNetworkAdapter

Reply
0 Kudos
MD1988
Contributor
Contributor

Thanks for your help. This cmdlet helped me to get the migration done. But now I got the problem how to define which networkadapter should be used as active and standby for vmotion and management since all adapters are defined as active after the migration.

On the internet I have found an article using the cmdlet Get-NicTeamingPolicy and Set-NicTeamingPolicy but when I try those cmdlets I always get an error for example when using this line:

Get-VirtualPortGroup -VMHost $myVMHost -VirtualSwitch $myStandardSwitch -Name vMotion | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicActive 'vmnic2'

Do you have any idea how to solve that?

Reply
0 Kudos
linotelera
Hot Shot
Hot Shot

Could you post the error message...

How many nics you have attached to this vSwitch?

Regards

Reply
0 Kudos
MD1988
Contributor
Contributor

For both of the functions I have attached 2 vmnics on the virtual switch, but all of them are marked as active after the migration from the vds.

Since the output of the error is german I try to give you a translation: The error says that the input object cant be attached to the commands of the cmdlet get-nicteampolicy, since this cmdlet doesnet accept any pipelineinput.

Reply
0 Kudos
linotelera
Hot Shot
Hot Shot

Reading docs try to split the command as a workaround:

$policy = Get-VirtualPortGroup -VMHost $myVMHost -VirtualSwitch $myStandardSwitch -Name vMotion | Get-NicTeamingPolicy

$policy | Set-NicTeamingPolicy -MakeNicActive 'vmnic2'

Reply
0 Kudos
MD1988
Contributor
Contributor

Thanks a lot for your help, this helped me get the it done mostly.

I have managed now to create a virtual switch, move the network adapters and the vmkernels and define the settings for the switch and mostly for the portgroups.

The only problem left is that on the one hand the standybynic for the management portgroup is not defined and on the other hand I always get the same error as I have posted before when getting the nicteampolicy for the vmotionnics. Nevertheless it is working and all the nics are defined as they should. Do you have any idea?

To give you a overview. Here is the complete script.

#Einlesen der Hosts in eine Variable

$VMHost = Get-Cluster cl-migration-test | Get-VMHost

foreach ($myVMHost in $VMHost) {

#Einlesen des virtual distributed switches in eine Variable

$myVDSwitch = Get-VDSwitch "dvSwitch_TEST"

#Einlesen der Infos der physischen Netzwerkkarten vmnic0 und vmnic1 und des virtuellen Netzwerkadapters vmk0 (Management-Karten)

$physicalNic = Get-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -Name 'vmnic0','vmnic1'

$virtualNic = Get-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -Name 'vmk0'

#Einlesen der Infos der physischen Netzwerkkarten vmnic2 und vmnic3 und des virtuellen Netzwerkadapters vmk1 (VMotion-Karten)

$physicalNic2 = Get-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -Name 'vmnic2', 'vmnic3'

$virtualNic2 = Get-VMHostNetworkAdapter -VMHost $myVMHost -VirtualSwitch $myVDSwitch -Name 'vmk1'

#Anlegen eines virtuellen Switches mit dem Namen "vSwitch0" auf dem Host aus der Variable $myVMHost

New-VirtualSwitch -VMHost $myVMHost -Name "vSwitch0"

#Defintion der Security-Settings auf dem virtuellen Standardswitch

Get-VirtualSwitch $myVMHost -Name "vSwitch0" | Get-SecurityPolicy | Set-SecurityPolicy -MacChanges $false

Get-VirtualSwitch $myVMHost -Name "vSwitch0" | Get-SecurityPolicy | Set-SecurityPolicy -ForgedTransmits $false

#Einlesen der Infos des angelegten Standardswitches in eine Variable

$myStandardSwitch = Get-VirtualSwitch -VMHost $myVMHost -Name 'vSwitch0'

#Migration der physischen Netzwerkkarte und des virtuellen Netzwerkadapters für das Management vom virtuellen distributed switch auf den angelegten virtuellen Standardswitch

Add-VirtualSwitchPhysicalNetworkAdapter -VirtualSwitch $myStandardSwitch -VMHostPhysicalNic $physicalNic -VMHostVirtualNic $virtualNic -Confirm:$false

#Umbennen der angelegten vmkernel für das Management

Get-VirtualPortGroup $myVMHost -VirtualSwitch $myVDSwitch -Name "VMkernel" | Set-VirtualPortGroup -Name "vManagement"

#Einlesen und Definieren der jeweiligen Netzwerkkarten für das Management

$policymanagement = Get-VirtualPortGroup -VMHost $myVMHost -VirtualSwitch $myStandardSwitch -Name vManagement | Get-NicTeamingPolicy

$policymanagement | Set-NicTeamingPolicy -MakeNicActive 'vmnic0' -MakeNicStandby 'vmnic1'

$policymanagement | Set-NicTeamingPolicy -LoadBalancingPolicy ExplicitFailover

#Migration der physischen Netzwerkkarte und des virtuellen Netzwerkadapters für das Management vom virtuellen distributed switch auf den angelegten virtuellen Standardswitch

Add-VirtualSwitchPhysicalNetworkAdapter -VirtualSwitch $myStandardSwitch -VMHostPhysicalNic $physicalNic2 -VMHostVirtualNic $virtualNic2 -Confirm:$false

#Umbennen der angelegten vmkernel für das VMotion

Get-VirtualPortGroup $myVMHost -VirtualSwitch $myVDSwitch -Name "VMkernel" | Set-VirtualPortGroup -Name "VMotion"

#Einlesen und Definieren der jeweiligen Netzwerkkarten für das VMotion

$policyvmotion = Get-VirtualPortGroup -VMHost $myVMHost -VirtualSwitch $myStandardSwitch -Name VMotion | Get-NicTeamingPolicy

$policyvmotion | Set-NicTeamingPolicy -MakeNicActive 'vmnic2', 'vmnic3'

$policyvmotion | Set-NicTeamingPolicy -LoadBalancingPolicy LoadBalanceIP

Reply
0 Kudos
linotelera
Hot Shot
Hot Shot

Ok... try to split command in 2 policy settings:

$policyvmotion | Set-NicTeamingPolicy -MakeNicActive 'vmnic2'

$policyvmotion | Set-NicTeamingPolicy -MakeNicActive 'vmnic3'

Reply
0 Kudos