VMware Cloud Community
andstein85
Contributor
Contributor

Intelligent vDS to vSS Migrator Script - no vm downtime

DISCLAIMER: USE COMMON SENSE! Don't go crazy and use this on a production environment without testing it first.

I've attached 2 scripts, the first being an information gathering script which saves networking config data about your hosts to a csv file.

The second intelligently migrates everything on a VDS to a VSS or VSS's depending on your VDS's Uplink configuration:

1. physical adapters

2. vmkernel adapters

3. VM's

This will migrate an environment that uses a single vDS with up to 8 uplinks where only 3 or fewer uplinks are assigned to a particular portgroup or multiple portgroups at a time. It will also take into consideration hosts that have different vmnics assigned to different uplinks.

Example environment where each host has 6 uplinks grouped by 2's:

PortgroupsActive UplinkvDS Name
Vlan1000, Vlan1100, Vlan1200{Uplink 1, Uplink 2}dvSwitch1
Mgmt, vMotion
{Uplink 3, Uplink 6}dvSwitch1
VlanA, VlanB, VlanC
{Uplink 4, Uplink 5}dvSwitch1

HostnamePhysical AdapterUplink assignmentdvswitch
vmhost01.local.orgvmnic0Uplink 1dvSwitch1
vmhost01.local.orgvmnic1Uplink 2dvSwitch1
vmhost01.local.orgvmnic2Uplink 3dvSwitch1
vmhost01.local.orgvmnic3Uplink 4dvSwitch1
vmhost01.local.orgvmnic4Uplink 5dvSwitch1
vmhost01.local.orgvmnic5Uplink 6dvSwitch1
vmhost02.local.orgvmnic2Uplink 1dvSwitch1
vmhost02.local.orgvmnic4Uplink 2dvSwitch1
vmhost02.local.orgvmnic3Uplink 3dvSwitch1
vmhost02.local.orgvmnic1Uplink 4dvSwitch1
vmhost02.local.orgvmnic5Uplink 5dvSwitch1
vmhost02.local.orgvmnic0Uplink 6dvSwitch1

Take note of the fact that different vmnics on vmhost02 are assigned to different uplinks than vmhost01, meaning the nics on each host are physically wired differently from one another.

Caveats:

1. If you the portgroup(s) that your vmkernels belong to have names that are similar to other portgroup(s) that aren't VMKernel portgroups, the script will detect it and try to move a vmkernel that doesn't actually exist, causing the Add-VirtualSwitchPhysicalNetworkAdapter cmdlet to fail to move the vmnic to the vSS its currently working on.

2. If you have 1 uplink assigned to vmotion1 and another uplink assigned to vmotion2, and only 2 physical NICs total on each host, it will try to create 3 standard switches even though there aren't enough nics to do that.

Otherwise, this script is fairly intelligent enough to account for most configurations under 8 physical nics, so enjoy!

0 Kudos
0 Replies