My ramblings about all things technical

vCloud endpoint wont delete from vCAC 5.2

Leave a comment

I am currently working on a project that is using vCAC 5.2 ,vFabric Application Director 5.2 and vCloud 5.1 to provide automated self service provisioning of resources for customers (super learning experience).

Whilst going through the manual steps of removing a test customer from the solution before automating the steps through VCO, I hit a very strange problem where at the point of deleting the endpoint to the vCloud Organisation that was assigned for the test customer I got an error stating “ Error has been caught,see event logs located on the vCAC server for detail” and as shown below.


If I went to the the logs within vCAC there were two errors linked to the problem. the main one stating “….  Inner Exception: the DELETE statement conflicted with the REFERENCE constraint “HostNic….”


The error is showing that a computer resource is still attached to the endpoint even though I had removed the computer resource from the vCloud Enterprise Group computer resources selection, removed the Org VDC from vCloud and run a manual data collection. It seems that there is a bug at present that doesn’t allow the removal via the UI (bug report already opened before someone asks) so what you need to do is (I make no promises or guarantees around this script so use at own discretion and backup your DB before running this):

  1. Go to the SQL server that hosts the vCAC database.
  2. Open SQL Management Studio as a user with sufficient permissions.
  3. Select the vCAC database and click the New Query button at the top left.
  4. Ensure the vCAC database is selected.
  5. Paste the following SQL script in the query box and change the ‘ORG VDC NAME’ to the name of the Organisation VDC that the endpoint was connected to and execute the query.

DECLARE @HostId uniqueidentifier

SET @HostId= (SELECT HostId FROM Host WHERE HostName = ‘ORG VDC NAME’)

DELETE FROM VirtualMachine WHERE HostID = @HostId

DELETE FROM HostNicToReservation WHERE HostNicID IN (SELECT HostNicID FROM HostNic WHERE HostID = @HostId)

DELETE FROM HostReservation WHERE HostID = @HostId


DELETE FROM HostToStorage WHERE HostID = @HostId

DELETE FROM AdminGroupToHost WHERE HostID = @HostId

DELETE FROM ResourcePool WHERE HostID = @HostId

DELETE FROM Host WHERE HostUniqueID = (SELECT HostUniqueID FROM Host WHERE HostID = @HostId) AND ClusterHostID = @HostId


  1. The results should show that some values have been changed.
  2. Now you can remove the endpoint from vCAC and the computer resource won’t show up for selection under the vCloud Enterprise Group either.

I hope this saves someone the time I spent trying to fix the problem.


    Leave a Reply

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

    You are commenting using your 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 )

    Connecting to %s

    This site uses Akismet to reduce spam. Learn how your comment data is processed.