Remove locked Instant-Clone objects in VMware Horizon DaaS

Remove locked Instant-Clone objects in VMware Horizon DaaS

Introduction

In this article I will describe how to remove Instant Clone objects created in VMware Horizon DaaS from your vCenter Server.

I had to do this because I (on one of those famous rough Monday mornings 😉 ) deleted one of my demo tenants in VMware Horizon DaaS without properly clean the tenant first.

Note to self: kill the VDI’s first, than remove the images, etc. properly and THAN delete the tenant!

Unfortunately this wasn’t a very clever move because you can’t delete the remaining objects afterwards due to a lock in the database:

Deleting Instant Cloning cp-xxx objects is not possible due to a lock
Deleting Instant Cloning cp-xxx objects is not possible due to a lock

This can be avoided by changing the capacity of the desktop pools to 0 and convert/delete the images before you delete your tenant from the Horizon DaaS Service center.

Beware!
If these actions are outside your comfort zone, reach out to the VMware Support team to assist you with this. When you delete the wrong objects, there will be consequences.

Preparation

First, you need gather a list of cp-xxx objects you want to remove from the vCenter Server. I did this by listing all the VM objects sitting in the remaining desktop VLAN of my deleted tenant.

Now, export them to a Excel/CSV file.
In the second part of this article we will add a column to the file, so a clear overview is advised.

You can use the Data > “Text to columns” option in Excel to make the list more clear to read. My list looked like this:

Instant Clone - Overview
Instant Clone – Overview

Log on to the vCenter Server MOB.
To do this, type the following behind the FQDN of your vCenter Server: /mob/?vmodl=1.

Example: https://vcsa-fqdn/mob/?vmodl=1

After you logged on (use the administrator@vsphere.local account, or equal privileges) to the MOB, Browse to Content.

vCenter Managed Object Browser > Content” class=”wp-image-178″/><figcaption>vCenter Managed Object Browser > Content</figcaption></figure>



<p><strong>Navigate </strong>to the rootFolder > vim.folder > group-d1 (Datacenters)</p>



<figure class=vCenter Managed Object Browser > rootFolder > vim.Folder” class=”wp-image-179″/><figcaption>vCenter Managed Object Browser > rootFolder > vim.Folder</figcaption></figure>



<p>We need to navigate to the datacenter where your cp-xxx objects are located: <strong>Navigate </strong>to childEntity > vim.ManagedEntity[] > datacenter-21 (<em>Name of your DataCenter</em>)</p>



<figure class=vCenter Managed Object Browser > childEntity > vim.ManagedEntity” class=”wp-image-180″/><figcaption>vCenter Managed Object Browser > childEntity > vim.ManagedEntity</figcaption></figure>



<p>Next step is to <strong>find </strong>the <strong>datastore </strong>where the cp-xxx objects are stored.<br>In my situation it’s a NFS datastore: vim.Datastore[] > datastore-56</p>



<figure class=vCenter Managed Object Browser > datastore > vim.Datastore” class=”wp-image-181″/><figcaption>vCenter Managed Object Browser > datastore > vim.Datastore</figcaption></figure>



<p>Once there, browse to the vm – vim.VirtualMachine[] row and choose more..</p>



<figure class=vCenter Managed Object Browser > vm > vim.VirtualMachine” class=”wp-image-182″/><figcaption>vCenter Managed Object Browser > vm > vim.VirtualMachine</figcaption></figure>



<p>Now, get back to your Excel and <strong>copy </strong>the name of one of the cp-xxx objects. Use your browser’s search feature to <strong>find </strong>the objects.</p>



<p>You need to <strong>write down</strong> the vm-xxxx nr. of each object:</p>



<figure class=Instant Clone - Object correlation
Instant Clone – Object correlation

Remove the lock from the Instant Clone cp-xxx objects

In the following steps we will use MOB to remove the lock from Instant Clone cp-xxx objects.

Log on to the vCenter Server MOB.
To do this, type the following behind the FQDN of your vCenter Server: /mob/?vmodl=1.

Example: https://vcsa-fqdn/mob/?vmodl=1

After you logged on (use the administrator@vsphere.local account, or equal privileges) to the MOB, Browse to Content.

vCenter Managed Object Browser > Content > ServiceContent” class=”wp-image-187″/><figcaption>vCenter Managed Object Browser > Content > ServiceContent</figcaption></figure>



<p><strong>Browse</strong> to Content > AuthorizationManager</p>



<figure class=vCenter Managed Object Browser > authorizationManager > ManagedObjectReference:AuthorizationManager” class=”wp-image-188″/><figcaption>vCenter Managed Object Browser > authorizationManager > ManagedObjectReference:AuthorizationManager</figcaption></figure>



<p><strong><u>If one of these options is missing, close all your browser windows and retry OR open an incongnito window.</u></strong></p>



<p><strong>Navigate </strong>to vim.AuthorizationManager.EntityDisabledMethodInfo[] > enableMethods, A new browser tab will open with three fields: <strong>Entity</strong>, <strong>Method </strong>and <strong>SourceID</strong>.</p>



<figure class=vCenter Managed Object Browser > authorizationManager > ManagedObjectReference:AuthorizationManager” class=”wp-image-189″/><figcaption>vCenter Managed Object Browser > authorizationManager > ManagedObjectReference:AuthorizationManager</figcaption></figure>



<p>We go back to the <strong>Excel </strong>list with the locked cp-xxx objects and the vm-xxxx <strong>numbers correlated</strong> to the them. We need those vm-xxxx numbers in the steps below.</p>



<p><strong>Copy/Paste</strong> the XML content from the first code block below to the entity > vim.ManagedEntity[] value.</p>



<!-- Crayon Syntax Highlighter v_2.7.2_beta -->

		<div id=
PowerShell
1
2
3
4
5
6
7
<!--array start -->
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0001</entity>
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0002</entity>
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0003</entity>
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0004</entity>
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0005</entity>
<!--array end -->

Change the vm-xxx object names to the names you correlated during the preparations.

Copy/Paste the XML content from the second code block below to the method > vmodl.MethodName[] value.

vCenter Managed Object Browser > authorizationManager > ManagedObjectReference:AuthorizationManager > Invoke Command” class=”wp-image-192″/><figcaption>vCenter Managed Object Browser > authorizationManager > ManagedObjectReference:AuthorizationManager > Invoke Command</figcaption></figure>



<p>When done, choose <strong>Invoke Method</strong> in the right bottom.<br>The command will run for about 1 minute.</p>



<p>After running these commands, the <strong>lock </strong>on the cp-xxx objects have been <strong>removed</strong>. <br></p>



<p>You can now <strong>delete </strong>the cp-xxx objects using the <strong>GUI</strong>.</p>



<figure class=

If you’re new to VMware Horizon DaaS, check out our Horizon DaaS Explained series here!

358 total views, 5 views today