I was recently converting a template to a virtual machine for configuration when on performing the action to convert the template to a virtual machine using the vSphere Web Client I received the following error message:
A component of the virtual machine is not accessible on the host.
The cause of the above issue was due to due a component being attached to the virtual machine which was no longer available. in this case a virtual CD-ROM device connected to a Datastore ISO file. In order to resolve the issue I was required to modify the templates configuration file to remove the component that was no longer available. Firstly, from the vSphere Web Client I will remove the virtual machine template from the inventory and then connect to an ESXi host system which has access to the datastore to which the virtual machine is located using an SSH client.
Prior to modifying the configuration file, we will firstly create a backup of the configuration file in the existing folder in the event we need to roll back to the original configuration file.
cp /vmfs/volumes/54d9d092-5163b8c5-4ed9-5cf3fc946a28/deanvm1/deanvm1.vmtx /vmfs/volumes/54d9d092-5163b8c5-4ed9-5cf3fc946a28/deanvm1/deanvm1.vmtx.backup
Now we will be required to modify the configuration file using a text editor such, in this example ‘vi’.
vi /vmfs/volumes/54d9d092-5163b8c5-4ed9-5cf3fc946a28/deanvm1/deanvm1.vmtx
In this scenario we will need to modify the reference to the obsolete file being referenced and also modify the device type to the below and save the configuration file.
sata0:0.deviceType = "atapi-cdrom" sata0:0.fileName = "
From the ESXi host system we will now register the virtual machine template, once the virtual machine template has been registered you will need to convert this from a virtual machine to a template using the vSphere Web Client.
vim-cmd solo/registervm /vmfs/volumes/54d9d092-5163b8c5-4ed9-5cf3fc946a28/deanvm1/deanvm1.vmx