I promised an article on this topic several times and finally I found the time to do some further testing on this issue I saw a few months ago.

With a customer I had this discussion of how to migrate to a newly created vCenter while keeping ESXi hosts running with the old distributed switch. (There might be several reasons, e.g. migrating the vCenter & DB to a new OS, data-loss and recovery problems, migration p2v or v2p, etc.)

Starting out with a vCenter 5.0, we were thinking about ways to achieve a seamless migration. We came up with 4 solutions:

  1. Migrate virtual machines from vDS to vSS. Then connect ESXi servers to the new vCenter, create a new vDS and migrate VMs back to vDS. Since this can get very complex and also prune to mistakes in a larger environment, we looked for other possibilities….
  2. Automating those steps via scripts… Gabrie van Zanten have written about this and distributed a script for exactly this scenario
  3. The third idea was to check if we can export the vDS settings out of the vCenter database and include it in the new instance…. Since I work around directly in databases only when I see no other options the last idea came in mind by using a new feature in vSphere 5.1
  4. Upgrade the old vCenter… Install a new vCenter 5.1 and use the export/import feature of the web client like it’s explained here

This new feature was exactly what we were looking for…. unfortunately it never really worked out in my environment…

In my opinion the following process should do what I want:

  1. Backup the vDS on the old vCenter
  2. Restore the vDS on the new vCenter (preserve the original distributed switch and port group identifiers)
  3. Disconnect and remove the ESXi hosts from the old vCenter
  4. Connect the ESXi to the new vCenter

Unfortunately my result were the following

Capture21

Even though the import was showing no errors and the vDS ID in net-dvs showed the same ID as in the backup file I wasn’t able to get some harmony between the ESXi and the vCenter (even a second recovery of the vDS now hasn’t worked)

After some troubleshooting I found out that it’s necessary to keep the right order in this migration process:

  1. Backup the vDS on the old vCenter
  2. Disconnect and remove all of the ESXi hosts on the old vCenter
  3. Connect all ESXi hosts to the new vCenter
  4. Restore the vDS on the new vCenter (preserve the original distributed switch and port group identifiers)

Keeping this order is the only way the migration works as expected. If you have done the migration like I have described it the first time or if you don’t migrate all ESXi hosts at the same time (can’t recommend this), you need to add the ESXi hosts to the recovered vDS manually.

Capture5

Capture6

Just make sure you select the same vmnics as you have configured it in the original vDS.

Capture7

and finally the error was gone…migration successful

Capture8

All of those operations can be done without interrupting the Service of the VM….so a seamless migration to a new vCenter can be done very easily once you keep in mind the correct order how to do it