Force Remove VMM Cloud

I had some problems today with a Cloud that I could’t delete.
If I clicked Right mouse > Delete in VMM, nothing happend.

*Please backup your database before any changes, I’m not responsible for the outcome.*

I successfully removed this cloud trough changing the “Physical Object’s” in the SQL database that were still connected somehow.
Open up SQL Management Studio and execute the following query to find out the CloudID or ID:

USE [VirtualManagerDB]
GO
EXEC    [dbo].[prc_Cloud_GetAllClouds]
GO

removecloud1

Now delete the Cloud with the buildin stored procedure where “ID” is the ID you got from the previous query.

USE [VirtualManagerDB]
GO
EXEC    dbo.prc_Cloud_RemoveCloud @ID = "1BDB3AFF-8AF7-440A-BD4B-9A5E9805CC36"
GO

You could recieve the following error (most likely)

Msg 547, Level 16, State 0, Procedure prc_Cloud_RemoveCloud, Line 21
The DELETE statement conflicted with the REFERENCE constraint “FK_tbl_WLC_PhysicalObject_tbl_Cloud_Cloud”. The conflict occurred in database “VirtualManagerDB”, table “dbo.tbl_WLC_PhysicalObject”, column ‘CloudId’.
The statement has been terminated.

(1 row(s) affected)

You will receive the error because there are still objects connected to the cloud, somehow.
To find out what objects are still connected, execute the following where “cloudid” is the ID you got from the previous query.

SELECT *  FROM [VirtualManagerDB].[dbo].[tbl_WLC_PhysicalObject] where cloudid like "1BDB3AFF-8AF7-440A-BD4B-9A5E9805CC36"

So now you know what objects are still connected.
Alter the table and change the “cloudid” value to “NULL”

All set! Delete the cloud in VMM, fixed.

Leave a Reply

Your email address will not be published. Required fields are marked *