Backtrack:  
 
by lunarg on June 7th 2023, at 11:06

In VMware Horizon View VDI, when using floating pools with instant clones, you may run across a problem where VMs get the "Already Used" status after users log off. The VM remains unavailable for further use and does not get deleted or refreshed.

The reason for this usually is that some process is blocking the refresh/delete operation, causing the VM to remain unusable and powered on to allow a system administrator to investigate the issue. If this is not desired (e.g., the reason for the blockage is known but cannot be resolved immediately), there is a policy which can be set to allow for automatic clean up of these "dirty" VMs.

The attribute is called pae-DirtyVmPolicy and can be configured separately for each desktop pool:

  • pae-DirtyVmPolicy = 0: marks VMs that where not cleanly logged off as "Already Used" and blocks further access for regular users. This is the default since Horizon View 4.6 and later.
  • pae-DirtyVmPolicy = 1: allows the VMs to be used again, without a refresh or delete. Any changes made to the VM and any user files will remain intact and can be accessed by another user. Use with caution.
  • pae-DirtyVmPolicy = 2: automatically refreshes the VM that were not cleanly logged off. After the refresh operation, the VM is available for use again. Since the VM is refreshed, no changes and/or user files of previous sessions will be present.

The policy can be configured directly in LDAP through ADSI Edit.

  1. Start up ADSI Edit on the View Connection Server and connect to the Connection Server LDAP instance. Connect to DN DC=vdi,DC=vmware,DC=int and server to localhost:389.
  2. In the navigation tree, locate OU=Server Groups. In that OU, double-click the CN=pool_name, which represents the pool you which to edit. A dialog with all attributes of the CN appears.
  3. Find the pae-DirtyVmPolicy attribute. By default, the value is unset (meaning the default of 0). Click the Edit button to change it. Type either 0, 1 or 2 to set the policy.
  4. After changing the attribute, the new policy is active immediately (i.e., no restart is necessary). If set to 2, all VMs in the "Already Used" state will be refreshed automatically after a minute or so.

    More information and the original KB from VMware: https://kb.vmware.com/s/article/1000590