ESXi 5.x – VM reset stuck at 95%

Few weeks ago we had an issue with freezing VM, and the only way of getting out of it was to perform hard reset to the VM. The procedure is well known – right click on the VM > Power > Reset.

tasks

The command took quite a while to actually initiate the reset. I really wondered what happened there, so I started investigating it.

vmkernel log didn’t show anything. The VM’s vmware.log log on the other hand, was quite interesting:


2014-09-25T03:44:35.209Z| vmx| VMMon_VSCSIStopVports: Invalid handle
2014-09-25T03:44:35.209Z| vmx| VMMon_VSCSIDestroyDev: Not found
2014-09-25T04:13:15.305Z| vmx| ide1:0: Command TEST UNIT READY took 2264.916 seconds (ok)
2014-09-25T04:13:15.305Z| vmx| SOCKET 9 (98) disconnecting VNC backend by request of remote manager
2014-09-25T04:13:15.307Z| vmx| MKS local poweroff

It looked like TEST UNIT READY took 37min to complete! Only after this command finished, the VM reset preparation continued. So what is this mysterious command, and what took it so long to complete?
TEST UNIT READY is a SCSI command sent to the target in order to get a response, and a status of the device. In the log file, ide1:0 is referred, but CD-ROM drive in this VM isn’t mounted according to vSphere client –

Edit-Settings

Just to make sure, I checked out the vmx file, which showed me something I didn’t see from the vSphere client side –

vmx-editor

vmx file indicates of an iso mounted to this VM. Not just an iso, but the VMware tools iso. Checking again from the guest OS side – and the disk isn’t mounted. So what just happened here?

A bug.

http://kb.vmware.com/kb/2076512

This KB has a low rating of 2 stars right now, probably since the solution didn’t include PowerCLI, right? Here it is.

Mapping of the VMs with ghosted CD-ROM:

Get-VM | Get-CDDrive | Where {$_.ExtensionData.Backing.DeviceName -like "*iso"} |  Select Parent,
@{N="DeviceName"; E={($_).ExtensionData.Backing.DeviceName}} | Export-Csv F:\Scripts\Temp\CD-Drive-mapping.csv

The actual removal of the CD-ROM from all VMs:

Get-VM | Get-CDDrive | Where {$_.ExtensionData.Backing.DeviceName -like "*iso"} | Set-CDDrive -NoMedia -Confirm:$false

Works best on 64Bit PowerShell console.

Enjoy.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.