Pages

Monday, September 26, 2011

Does “orphaned” virtual machines show up when executing “vim-cmd vmsvc/getallvms”?

I was asked an interesting question a few weeks ago when I was a part of an vSphere infrastructure start up after a datacenter move.  What basically happened was that the virtual machines and hosts were not shutdown in proper order and we suspected that some virtual machines might have failed over to some hosts without us knowing.  Since we were tight on time with a small window, we proceeded to complete the physical move and then began bringing up the virtual machines.  There were quite a few challenges on the way and as we proceeded to start up the critical virtual machines via console commands, I was asked the following:

If I’m executing the command “vim-cmd vmsvc/getallvms”, does the list of virtual machines that the command return include any orphaned virtual machines?

I didn’t know the answer but being the person that I am, I was extremely curious about the answer so made a note in my book to test it out.  What I found out a week later during a test was that it actually doesn’t.  Here are the results of the test:

image

As shown in the screenshot above, I intentionally orphaned a virtual machine named: Win7EntSP1-32Bit

I proceeded to execute the command vim-cmd vmsvc/getallvms via an SSH session and can see that the orphaned virtual machine does not show up in the list:

~ # vim-cmd vmsvc/getallvms
Vmid          Name                                   File                                  Guest OS          Version   Annotation
112    Win7EntNSP1-64-Bit   [datastore1] Win7EntNSP1-64-Bit/Win7EntNSP1-64-Bit.vmx   windows7_64Guest        vmx-07
16     Contoso-vCenter          [datastore1] Contoso-vCenter/Contoso-vCenter.vmx                 windows7Server64Guest   vmx-07
32     Contoso-VCS              [datastore1] Contoso-VCS/Contoso-VCS.vmx                         windows7Server64Guest   vmx-07
48     Contoso-SQL              [datastore1] Contoso-SQL/Contoso-SQL.vmx                         windows7Server64Guest   vmx-07
64     Contoso-VTS              [datastore1] Contoso-VTS/Contoso-VTS.vmx                         windows7Server64Guest   vmx-07
96     Win7EntNSP1-32-Bit   [datastore1] Win7EntNSP1-32-Bit/Win7EntNSP1-32-Bit.vmx   windows7Guest           vmx-07
~ #

image

Now that I know orphaned virtual machines doesn’t show up via the vim-cmd vmsvc/getallvms command, I’m definitely going to look into seeing whether there’s a way to list it and will write another post when I figure it out.

No comments: