vCAC: Error Deleting Blueprint It Is Still Being Referenced By 1 Machines.

Whilst testing vCAC (6.0.1.1) we have recently run into a strange little issue when trying to tear down and evacuate everything from a test tenant.  In order to remove  a tenant you must strip back everything first by removing machines, blueprint, reservations, business and fabric groups.  We got as far as removing the blueprints before running in to the error below. “Error Deleting Blueprint <blueprint name>/ it is still being referenced by 1 machines.”

1

This should not be the case as we had destroyed all test machines assigned by this blueprint in the correct manor before.  Indeed, selecting the blueprint and choosing “view machines” yields the information shown below. i.e. there are no machines managed from this blueprint.

2

We also have another blueprint within this tenant and attempting to delete this gives the same result.  However, this time, clicking “view machines” shows that one VM is seemingly stuck in the “Disposing” state.  This is a permanent issue as no amount of refreshing, data collection or restarting clears this status.  Clearly, this is blocking this blueprint from being removed.

3

It is possible to try to force a destroy of this machine but, despite claiming success, and eventually removing the machhine from the “disposing” state nothing actually changes.  Deleting the blueprint still gives the error that is it still being ‘referenced by 1 machines’.

4

Solution

Please note: The following  solution involves hacking about in the vcac SQL database.  this is almost certainly not a supported action and could cause things to go badly wrong if you do something silly.  Only do the following at your own risk and after backing up the SQl and PSQL databased associated with your vCAC install.

This issue was traced down to an incorrct entry in the vcac SQL database.  within the vCAC database there is a table called ‘dbo.VirtualMachine’  Running the query below will return all VMs that the vcac databse considers being currently managed or assigned to a blueprint.

SELECT * FROM Virtualmachine WHERE IsManaged=1

This returns a list of VMs.  take a look through the VMs and see if any of them co relate to the name of the blueprint you are trying to remove.

<Insert Picture here>

For each of the VMs that relate tot he affected blueprint copy and paste out the ‘VirtualMachineID’ to a text file for later use.

<Insert Picture here>

Now, for each of the VirtualmachineIDs you have run the query below. Again, ensure you have a backup and the ID is correct and only referencing the blueprint you are wishing to delete.

UPDATE dbo.VirtualMachine SET IsManaged=0 WHERE VirtualMachineID=’<Insert VM ID Here>’

Now restart the IaaS Web services and log back on to the vCAC web interface and try to remove the  blueprints again.  In the case above the steps performed allowed the removal of the second Blueprint but NOT the first.  Further steps were required to enable this to be removed.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s