Monday, August 10, 2009

virtual machine with input specifications already exists

While in the progress of deploying new virtual machines the deployment of a virtual machine stopped in one particular pool. After doing some investigation the viewcomposer log gives me the following message:

Violation of UNIQUE KEY constraint 'IX_SVI_SIM_CLONE_GUEST_NAME'. Cannot insert duplicate key in object 'dbo.SVI_SIM_CLONE'

I created a support call with VMware, the responses I got where remove those particular record from the database. Removing those records didn’t solved the problem, cause those records were written in different tables, so we created a query which does the trick for us.

Doing a search first, so we know which records will be deleted:

# Finding VM from VM_NAME and BASE_DISK key

SELECT * FROM SVI_SC_BASE_DISK_KEYS

where PARENT_ID = (SELECT ID FROM SVI_SIM_CLONE

WHERE (VM_NAME = ''))

SELECT * FROM SVI_SIM_CLONE

WHERE (VM_NAME = '')


When I know which records will be removed I used the following query to actually remove the records:

# delete VM from VM_NAME and BASE_DISK key

delete from SVI_SC_BASE_DISK_KEYS

where PARENT_ID = (SELECT ID FROM SVI_SIM_CLONE

WHERE (VM_NAME = ''))

delete FROM SVI_SIM_CLONE

WHERE (VM_NAME = '')


After actually removing the faulty records i was able to deploy new virtual machines again.

No comments: