Composer Fault: Virtual Machine with Input Specification already exists
Error During Provisioning: View Composer Fault: Virtual Machine with Input Specification already exists
If you've ever run into this error when composing linked clones with VMware Horizon View Composer, you are very much not alone. This is a common error that ultimately comes down to this: your Composer database already has an entry with that VM name in it. There are 3 ways to fix it depending on your View version and scenario. But first, let's understand the issue.
Why does this error happen? Usually due to a delete operation not fully completing. When you click Delete for a linked clone in Horizon View, it has to be removed from the View ADAM database, the vCenter Server database, and the Composer database. If the linked clone gets removed from ADAM and VC but fails to be removed from the Composer DB for some reason, when you go to recompose that VM with the same name, you'll see this error.
Let's say the VM is deleted from vCenter only, it's gone from the VCDB and won't show up in vCenter Inventory, but will likely show in View with an error until it's removed from the ADAM database. Once it's removed from ADAM all will appear to be well, until you re-create that linked clone - you'll see the title error.
If you're at the point where the VM is gone from View, meaning you don't see it in View Administrator or in any pool.. and you're at the point where the VM isn't anywhere to be found in vCenter, meaning you've done a search and verified the VM has been deleted from the vCenter Inventory, and you're seeing the title error, you should follow the sviconfig processes outlined in in http://kb.vmware.com/kb/2015112 (for View 5.2 and earlier)
If you're on View 5.3 or later, use the ViewDBchck tool from http://kb.vmware.com/kb/2118050
If you continue to have issues, try running the below scripts on your Composer's SQL database. There are two scripts below: a Query script and a Delete script. To see if the VM does indeed exist in the Composer DB, run the query script changing the blue fields to match your VM name and the Composer Database name. This does not modify anything in the DB, just does a search. If it returns data in any tables, then you know that's the issue and you can proceed to use the Delete script (editing the same vm-name and Composer DB name fields as the query script).
I cannot take credit for these scripts, but they have proven invaluable during my time in support! Let me know in the comments if these helped!
Composer SQL DB Scripts
Caution: The scripts are provided as-is. Do not use the scripts without first taking a backup of the composer database to restore in case of a problem. The scripts only work on MS SQL.
Query Script:
/*This SQL Query will allow FAST access to see if remnant vm's Exist inside the Composer DB*/
DECLARE @name nvarchar(255)
/*Enter Name Below for VM on line with set [@name='vm_name_here'] */
set @name='enter-VM-name-here'
/*Enter Name of VMware View Composer Database for line below [use database_name]*/
use Composer-database-name
SELECT *
FROM [dbo].SVI_TASK_STATE
WHERE SIM_CLONE_ID = (SELECT ID FROM [dbo].SVI_SIM_CLONE WHERE VM_NAME like @name)
SELECT *
FROM [dbo].SVI_VM_NAME
WHERE NAME = @name
SELECT *
FROM [dbo].SVI_SIM_CLONE
WHERE VM_NAME = @name
SELECT *
FROM [dbo].SVI_SC_PDISK_INFO
WHERE PARENT_ID = (SELECT ID FROM [dbo].SVI_SIM_CLONE WHERE VM_NAME like @name)
SELECT *
FROM [dbo].SVI_SC_BASE_DISK_KEYS
WHERE PARENT_ID = (SELECT ID FROM [dbo].SVI_SIM_CLONE WHERE VM_NAME like @name)
SELECT *
FROM [dbo].SVI_COMPUTER_NAME
WHERE NAME = @name
Delete Script:
/*!!!DELETES VM FROM SQL DB CAUTION!!!*/
/*Enter Name Below for VM on line with set [@name='vm_name_here'] */
DECLARE @name nvarchar(255)
set @name='enter-VM-name-here'
/*Enter Name of VMware View Composer Database for line below [use database_name]*/
use Composer-database-name
DELETE
FROM [dbo].SVI_TASK_STATE
WHERE SIM_CLONE_ID = (SELECT ID FROM [dbo].SVI_SIM_CLONE WHERE VM_NAME like @name)
DELETE
FROM [dbo].SVI_SC_PDISK_INFO
WHERE PARENT_ID = (SELECT ID FROM [dbo].SVI_SIM_CLONE WHERE VM_NAME like @name)
DELETE
FROM [dbo].SVI_SC_BASE_DISK_KEYS
WHERE PARENT_ID = (SELECT ID FROM [dbo].SVI_SIM_CLONE WHERE VM_NAME like @name)
DELETE
FROM [dbo].SVI_SIM_CLONE
WHERE VM_NAME = @name
DELETE
FROM [dbo].SVI_COMPUTER_NAME
WHERE NAME = @name
DELETE
FROM [dbo].SVI_VM_NAME
WHERE NAME = @name