In my company, we have two virtual servers based on Microsoft Hyper-V & Free version of ESXi 4.0 running 10 guest OS. We did planned to convert all of our physical machine to virtual to get benefit from underutilized modern hardware. Last week I decided to move our Domain Controller & ADC to virtual (which were installed on IBM Xseries physical serve machines).
As a rule of thumb, always test any new / trial product in LAB before deploying it on production server, following this theory I installed Vmware ESXi 5.0 Update 1 on vmware workstation 7.x and found out a BUG that guest vm’s do not auto start anymore when the host ESXi starts (In previous versions i.e 4.x , they auto start normally if they are set to autostart). This is a bug for the FREE version of the hypervisor. (For example if you have installed the FREE License key provided by vmware)
After some googling, I found out that There were some changes made in the way the ESXi APIs are accessed in Update 1 that unfortunately breaks the Guest VM Auto Start feature.
Here is a quick workaround to give you the autostart functionality in traditional Linux style.
If you haven’t done so already, Do Enable SSH on the ESXi host server. This can be easily done using Sphere client.
- Connect to ESXI using Vsphere client.
- Goto Configuration Tab | Security Profile | in Services, click on Properties
- Highlight SSH | Select Options | Service Commands | Start
- Use any SSH client like PuTTY) to log into your host server. As showed in the image below
In my case, I only wanted to auto start only single guest vm (Which is my test DC) So first We need to get the VM ID’s for the virtual machines. Use the following command to do so. Make note of the ID numbers in the first column
Use the following command to get the VM ID of the machine you want to start.
You will get results something like below ( I only have one test machine, so only one entry is visible)
Vmid Name File Guest OS Version Annotation
1 TestPC-4-Autostart [store] TestPC-4-Autostart/TestPC-4-Autostart.vmx win2000AdvServGuest vmx-08
The VM ID for test pc guest OS is 1
Use vi to edit /etc/rc.local – & Insert the following startup lines above the IF statement and save.
vim-cmd vmsvc/power.on 1
[VI TIP: to enable editing, press i , now add your lines, to save, press ESC, now press shift+: & type wq and press enter]
As showed in the image below . . .
Now reboot the ESXi host server.
After reboot completes, you will see the target guest OS Auto starting this time.
Auto Start All VM’s guest OS
TIP: If you want to start all vm’s you need to add them as follow
vim-cmd vmsvc/power.on 1
vim-cmd vmsvc/power.on 2
vim-cmd vmsvc/power.on 3
Change the ID number as per your configuration. Now after starting 1st VM, ESXi HOST will wait 180 Seconds (3 minutes) to start second one and so on. You can change this number as per your hardware/software load.
I hope you will find it useful.