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):
- Go to the SQL server that hosts the vCAC database.
- Open SQL Management Studio as a user with sufficient permissions.
- Select the vCAC database and click the New Query button at the top left.
- Ensure the vCAC database is selected.
- 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 HostNic 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
DELETE FROM Host WHERE HostID = @HostId
- The results should show that some values have been changed.
- 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.