I am still a learner when it comes to the Scripting part. I am currently supporing a client who wants to completely migrate an VC from 5.5 to 6 and he wants to do it with a clean install of VCenter 6.
So we created a new Virtual Center 6.0.0 and We have already created roles and datacenters and the folder structure similar to the VC5.5. The problem here is that the VCenter 5.5 is configured on DVS and no stardard switches are available.
The problem now is that we need to move the hosts from the OLD VC to new one without having downtimes. Also there are not enough nic cards to create standard switches and migrate.
The one way that i have thought about is - Exporting the DVS config from OLD VC, Disconnecting host from old VC, Connecting host to new VC and then importing the DVS Config on new VC.
I wanted to know if this will work fine ?
Also if it does, does anyone have a script which will just disconnect the host from the old vc and add it in the new VC under the correct cluster ?
Any help will be appreciated.
you cannot migrate ESXi host with dvswitch from one vCenter to another.
I would suggest you follow below steps for Migrating all VMs from One vCenter to another.
Most of below task you can automate using PowerCLI. for VM network migration you can use dvswitch Network migration Wizard.
I have tried to document most of the below task and PowerCLI scripts here - Virtual Admin: vCenter Migration
High level task details for Migrating ESXi Host from Old vCenter to new vCenter -
Existing vCenter -
1. Remove second Physical NIC of each ESXi Host from dvswitch e.g. NIC2 ( I hope you have at least 2 Physical NICs connected to dvswitch from each ESXi, other wise you are going to have downtime)
2. Create standard switch on each ESXi Host and add second NIC2 to standard switch.
3. Create VM PortGroup on standard switch as you have on dvswitch.
4. Migrate Vmkernel PortGroup from dvswitch to Standard Switch.
5. Migrate VMs from dvswitch to standard switch.
6. Migrate Templates from dvswitch to standard switch ( first export Template list to csv, you will need to convert Template to VMs, then migrate PortGroup to SS, keep the templates as VM till the migration get finished)
7. Remove First NIC or any other Physical NICs of ESXi Host from dvswitch and Add it to each ESXi Host. ( make sure you have migrated all VMs from dvswitch to standard switch)
8. Remove Host from dvswitch
At this stage you can export dvswitch configuration from old vCenter and import to new vCenter. ( I have not used this step, so am not 100% certain about this )
Proceed further Once you have all VMs migrate to Standard Switch.
9. Export VMs and Resource Pool structure ( if you have too many VMs and resource pools. and post vCenter migration you can move back to its own Resource Pool)
10. Export VMs and Folder structure. ( post vCenter migration you can move Vm to its own folder where it was in old vCenter)
11. Export vCenter roles, User permissions, again this is useful if your vCenter is accessed by too many users.
Migrate ESXi Hosts and VMs to new vCenter -
12. Disable HA in ESXi Cluster.
13. Create ESXi Cluster with HA and DRS in new vCenter.
14. Disconnect ESXi Hosts from old vCenter and add it to new vCenter in ESXi Cluster. ( simply keep removing/adding Hosts at this stage)
Once you migrate all ESXi host and VMs to new vCenter, perform below Steps in new vCenter -
15. Import Folder structure and move VMs to its folder ( to the folder where it was in old vCenter )
16. Import Resource Pool Structure.
17. Move VMs to its resource Pool ( to the resource pool where it was in old vCenter )
18. Import vCenter user permissions, Roles
19. Convert Template VMs from csv back to Template ( Step 6 )
Once you complete migration and everything is stable then you can migrate all VMs from standard Switch.
20. Remove second NIC from each ESXi Host and add it to dvswitch
21. Create required PortGroups on dvswitch.
22. Migrate VMs from standard Switch to dvswitch.
23. Migrate Templates to dvswitch.
24. Migrate Vmkernel ports to dvswitch of each ESXi Hosts.
25. Migrate First or any remaining NICs of each ESXi Host to dvswitch.
as I said, you can automate all of the above task using PowerCLI, see my post where I tried to document these steps with scripts.
I have migrated multiple vCenter with more than 10K VMs and 200 ESXi Hosts without any single VM/host downtime.
Thanks Haridas for your time.
Like i said i am not great at scripting. Do you have a script which will Disconnect Host from one VCenter and attach it to another, Also import the VMs to the correct folder ?
I already have an entire datacenter , cluster and folder structure already made with the correct roles and permissions on the new VC. All that is remaining is disconnecting the host from old vc, connecting it to new VC and importing the VMs to the correct folders.
For above all task I have copied scripts at my blogpost.
Not all scripts are written by me, where possible I have provided references to original scripts, blogs, community questions URLs.
Also you can just google or search community for above task and you can get scripts.