An article by Jack McMichael (@jackmc4)
Starting in View 4.6, a state was added to VMware View to deal with a nagging issue for some administrators who wanted to ensure that a desktop was always clean and never previously used – the introduction of the ‘Already Used’ state. The issue is simple, a user logs into a non-persistent desktop and something horrible goes wrong. Perhaps a Windows blue screen or an abnormal crash of the View Agent, but ultimately something that left the virtual machine in an unusable state until rebooted.
Until the ‘Already Used’ state was created, there were situations where a VM would crash, automatically reboot, and then be put back into circulation for use as if it has never been used despite the fact that it had. This posed a problem that was resolved with the creation of ‘Already Used’. The idea was simple enough, once a VM has been logged into, toggle a flag to mark it as used and when the Pool is being evaluated, don’t allow the use of VMs in this state.
Note: The View Desktop can also go into a Already Used state if a virtual machine is powered on in another ESX host in the cluster in response to a HA event or if it failed before a power on. VMware KB1000590
In some larger environments where ongoing VM issues sometimes can and do exist, this created an issue of pools being filled with ‘Already Used’ VMs that needed to be manually deleted or otherwise dealt with.
With the release of View 5.1.2, I created a new pool attribute called ‘pae-DirtyVmPolicy’ that deals with this very issue. It has 3 options:
0 – The default value that will mark VMs as already used when logged in.
1 – A new value that will tell the pool to ignore any dirty VMs and just recycle them. This is valuable if your ultimate goal is to just have available VMs.
2 – A new value that will immediately remove or refresh the VM depending on the pool policy. This is the most destructive value, but ensures that you always have fresh VMs available in the pool.
If the pae-DirtyVmPolicy value is not present in the pool, the default behavior is automatically chosen. This is the preferred value since we want to catch problem VMs and diagnose them before deleting or refreshing them. Sometimes administrators just need to ensure that pool levels remain available, and so this new option gives them that ability. The attribute must be manually added in existing installations, but should be present in new installations, and should be put in each pool where the policy must be defined in OU=Server Groups.
Also refer to “Automating Desktop in ‘Already Used’ State in VMware View” and “Automating Desktop in ‘Already Used’ State in VMware View –Part 2”. Another good article on the subject “Cleaning up “Already used” desktops in VMware View”.
This article was first published by Andre Leibovici (@andreleibovici) atmyvirtualcloud.net.