Previous OS Ejected CDROM Will Not Disconnect

Mindwatering Incorporated

Author: Tripp W Black

Created: 04/23 at 12:04 PM

 

Category:
VMWare
VM Configuration, vCenter

Issue:
VM has old datastore ISO attached to the CDROM. The VM is not currently using the disk and doesn't have the disk mounted.
The swap to a different ISO failed the disconnect task, causing the subsequent ISO attach event to time out.

vMotion may also fail -- which is a good way to find out an ISO was left attached

The error messages vary.
"Connection control operation failed ..."
"Cannot be performed in present state ..."

Options:
1. If the VM can be restarted:
a. Shutdown the OS
b. Disconnect the CDROM


2. If the VM cannot be restarted or shutting down didn't work, we can try restarting the management agent on the ESXi hosts
a. SSH to ESX host
b. Start shell
c. Issue the following commands:
# /etc/init.d/mgmt-vmware restart

Wait a minute or so for the vCenter to reconnect to the ESXi host. Most of the time, it is done automatically.
Check if the ISO image can be disconnected, if not, you can restart the VPXA agent which will also log out out of the ESXi host:
# /etc/init.d/vmware-vpxa restart


3. If #1 didn't work and the old ISO is Local, instead of a datastore ISO:
a. Shutdown the OS again
b. Edit Settings --> Change the Device Mode to Passthrough CD-ROM. Click OK and try again.


4. If you realized this was somebody's fault because they didn't eject the disk (MS Windows) or unmount it (Linux), and you received the warning "The guest OS has locked..."
You can updated the VM's VMx file to allow auto prompted disconnects:
a. Manually eject the ISO in the OS
b. Shutdown the VM OS -- we don't typically want to edit the vmx with the VM running.
c. Make a back-up copy of the vmx file, and download from the datastore
d. Edit the VM vmx file, updating the following settings to force the disconnect:
cdrom.showIsoLockWarning = "FALSE"
msg.autoanswer = "TRUE"

To make vCenter learn about the updated vmx change, we have two options. Unregister and re-add/register the VM back to vCenter. This is easy, but with a new UUID, the VM will be a different VM even with the same name. This can cause backup software to see the new VM as a different VM, or cause other automation errors depending on what you have implemented in your environment.
alt e. VM --> Remove from Inventory
alt f. Cluster --> Add Virtual Machine --> Choose the existing datastore option

The other options is to run a command from the ESXi host:
alt e. SSH to ESXI host
alt f. Start shell
alt g. Run the following commands to view and then reload the configuration file for the VM:
# vim-cmd vmsvc/getallvms
< view output and get the vm id number, e.g. 9812. Use the number in the next command >
# vim-cmd vmsvc/reload 9812



previous page