This is a static archive of JasonPearce.com, as it looked from September 2012 to May 2014.

Posted on Mar 6, 2014

How to move automated persistent desktops to another cluster

My objective was to upgrade vSphere host from 1 gigabt Ethernet to 10 gigabit Ethernet connections.

All of my VMware Horizon View 5.2 linked-clone desktops resided in a single cluster of 10 hosts that I’ll call Cluster A. I had an even mix of persistent and non-persistent desktops.

Cluster B was needed

Through trial and error, I determined that I would need to create and use a second cluster in my process of upgrading my hosts to 10 Gig Ethernet.

I made use of Distributed Virtual Switches. And since no two port groups could have the same name, the linked-clone desktops (built from a parent virtual machine with specific port group settings) would run correctly on the 1 Gig hosts in the cluster but fail if they ran on the 10 Gig hosts because they used a different Distributed Virtual Switch and port group.

Also, VMware View Composer would build new linked-clone desktops on any host in the cluster without first checking if the desktop was configured to use a port group that existed on that host.

So began my task of figuring out how to move persistent and non-persistent linked-clone desktops from Cluster A to Cluster B. My plan was to remove a host from Cluster A, physically convert it to support 10 Gig, and add it to Cluster B. Then gradually shift desktops pools from Cluster A to Cluster B.

Here’s how I did it.

How to move non-persistent linked-cloned desktops to a different cluster

This step was easy. In vSphere I cloned my parent virtual machine from Cluster A to Cluster B. I then changed the vNetwork settings of the PVM to use a new 10 Gig port group. Used vSphere to then take a snapshot of my PVM on Cluster B with a 10 Gig port group on Cluster B.

Switching over to View Administrator, I edited the non-persistent desktop pool to Delete desktops on log off. On the vCenter Settings tab, I changed the default image (PVM) to the new one that resided on Cluster B and used all of the same datastores as before.

New non-persistent linked-cloned desktops were automatically be deleted from Cluster A and added to Cluster B as users logged off at the end of the day. A day or two later, and my non-persistent pools were now running on 10 Gig hosts.

How to move persistent linked-cloned desktops to a different cluster

This was more difficult. Like before, I used vSphere to clone my parent virtual machine on Cluster A to Cluster B and configured the vNetwork to use a new 10 Gig port group. Took a snapshot of the PVM.

In View Administrator, I edited the persistent desktop pool to use the new parent virtual machine that resided on Cluster B and again selected all of the same datastores as before.

To test, I deleted one if the Available spare desktops to confirm that it was rebuilt on Cluster B and had 10 Gig port group.

Next, I used View Composer > Recompose to recompose all persistent linked-clone desktops to the new PVM that resided on Cluster B. The strangest thing will happen…

All of your persistent linked-clone desktops will recompose using the PVM from Cluster B, but will remain on Cluster A and retain 1 Gig port group vNetwork configuration on Cluster A (not the 10 Gig port group vNetwork configuration on Cluster B or within the PVM settings).

I wished and hoped the desktops would have recomposed to Cluster B. At least they will still work on Cluster A as I sought for an alternative way to move them to Cluster B.

Used PowerCLI to manually move persistent linked-clone desktops to a different cluster

Breaking the rules, I decided that I had to manage and modify my linked-clone desktops via vSphere/vCenter instead of via VMware View. And PowerShell/PowerCLI was the tool I decided to use.

I wanted this to be as non-disruptive to the end users and gradual for me since I was manually converting one host at a time from Cluster A to Cluster B based on capacity.

My persistent desktop pools are configured to power off desktops when idle. I decided I would just run these three one-liner PowerCLI scripts on occasion to move and configure just the powered off desktops to Cluster B.

Move Powered Off VMs from Cluster-A to a host in Cluster-B

Get-Cluster -Name "Cluster-A" | Get-VM -Name "VDI-*" | Where{$_.PowerState -eq "PoweredOff"} | Move-VM -Destination "host-in-cluster-b.example.local"

Move Powered Off VMs in Cluster-B to a Resource Pool in Cluster-B

Get-Cluster -Name "Cluster-B" | Get-VM -Name "VDI-*" | Where{$_.PowerState -eq "PoweredOff"} | Move-VM -Destination "Resource-Pool-In-B"

Change PortGroup of Powered Off VMs to the 10 Gig Portgroup

Get-Cluster -Name "Cluster-B" | Get-VM -Name "VDI-*" | Where{$_.PowerState -eq "PoweredOff"} | Get-NetworkAdapter -Name "Network adapter 1" | Set-NetworkAdapter -Portgroup "dvPG-10G-VLAN-44" –Confirm:$false

View seems happy

VMware View seems to accommodate my manual changes. These desktops will remain powered off until a user attempts to log into VMware View. When they do, View correctly powers on the persistent linked-clone desktop in Cluster B and everything works as normal.

I also performed a new View Composer > Recompose task to a desktop pool after I had finished moving all desktops from Cluster A to Cluster B, which also worked as normal.

If you have a better/easier way to move persistent linked-clone desktops from Cluster A to Cluster B, please share in the comments.

Comments are closed.