Autostart VM’s on VMware vSphere Hypervisor free

I am running VMware vSphere Hypervisor 6.5.0a (free) and I found out that my Virtual Machines would not autostart after I reboot the host system, which is annoying.

Here are the instructions to make the Virtual Machines startup after a powerup of the host system.

1: Edit Settings in the ESXi web-interface:
Host → Manage → System → Autostart → Edit settings:
  Enabled: Yes
  Start delay: 5 seconds
  Stop delay: 5 seconds
  Stop action: Power off
  Wait for heartbeat: No
Virtual Machines → <your VM> → Actions → Autostart → Enable
Virtual Machines → <your VM> → Actions → Autostart → Configure:
  Start delay: 5 seconds
  Stop delay: 5 seconds
  Stop action: System default
  Wait for heartbeat: System default

2: Reboot the host system:
In the the ESXi web-interface:
Host → Reboot

Continue below if all that did not work.

3: Allow SSH-access to the host system:
Login to the ESXi web-interface.
Host → Actions → Services → Enable Secure Shell (SSH)
After a reboot SSH will automatically be disabled again.

4: Find the moid-numbers:
Use WinSCP to login to the system.
Navigate to: /etc/vmware/hostd
Open vmInventory.xml as textfile.
The number between <objID></objID> is the moid-number.

5: Edit the autostart-file:
Still logged in with WinSCP in the mentioned folder.
Open vmAutoStart.xml as texfile (for editing).

Original contents:

<ConfigRoot>
  <AutoStartOrder>
    <_length>0</_length>
    <_type>vim.host.AutoStartManager.AutoPowerInfo[]</_type>
  </AutoStartOrder>
  <SystemDefaults>
   <_type>vim.host.AutoStartManager.SystemDefaults</_type>
   <enabled>true</enabled>
   <startDelay>5</startDelay>
   <stopAction>guestShutdown</stopAction>
   <stopDelay>5</stopDelay>
   <waitForHeartbeat>false</waitForHeartbeat>
  </SystemDefaults>
</ConfigRoot>

For each Virtual Machine you have to ad a virtual machine between <AutoStartOrder></AutoStartOrder>
Example whereby moid is 2 :

<e id=”0″>
  <_type>vim.host.AutoStartManager.AutoPowerInfo</_type>
  <key>
    <_type>vim.VirtualMachine</_type>
    <moid>2</moid>
  </key>
  <startAction>powerOn</startAction>
  <startDelay>-1</startDelay>
  <startOrder>1</startOrder>
  <stopAction>systemDefault</stopAction>
  <stopDelay>-1</stopDelay>
  <waitForHeartbeat>systemDefault</waitForHeartbeat>
</e>

And you have the mention the total number of Virtual Machines between <_length></_length>

Here are the full contents of vmAutoStart.xml in which two Virtual Machines are mentioned:

<ConfigRoot>
  <AutoStartOrder>
    <_length>2</_length>
    <_type>vim.host.AutoStartManager.AutoPowerInfo[]</_type>
    <e id=”0″>
      <_type>vim.host.AutoStartManager.AutoPowerInfo</_type>
      <key>
        <_type>vim.VirtualMachine</_type>
        <moid>2</moid>
      </key>
      <startAction>powerOn</startAction>
      <startDelay>-1</startDelay>
      <startOrder>1</startOrder>
      <stopAction>systemDefault</stopAction>
      <stopDelay>-1</stopDelay>
      <waitForHeartbeat>systemDefault</waitForHeartbeat>
    </e>
    <e id=”1″>
      <_type>vim.host.AutoStartManager.AutoPowerInfo</_type>
      <key>
        <_type>vim.VirtualMachine</_type>
        <moid>3</moid>
      </key>
      <startAction>powerOn</startAction>
      <startDelay>-1</startDelay>
      <startOrder>1</startOrder>
      <stopAction>systemDefault</stopAction>
      <stopDelay>-1</stopDelay>
      <waitForHeartbeat>systemDefault</waitForHeartbeat>
    </e>
  </AutoStartOrder>
  <SystemDefaults>
    <_type>vim.host.AutoStartManager.SystemDefaults</_type>
    <enabled>true</enabled>
    <startDelay>5</startDelay>
    <stopAction>guestShutdown</stopAction>
    <stopDelay>5</stopDelay>
    <waitForHeartbeat>false</waitForHeartbeat>
  </SystemDefaults>
</ConfigRoot>

Save the file.

6: Reboot the host system:
In the the ESXi web-interface:
Host → Reboot

Result: Your Virtual Machines will startup automatically.

sources used:
https://virtualtassie.com/2017/quick-tip-vm-autostart-issue-in-esxi-6-5-host-client/
https://communities-gbot.vmware.com/thread/439488

 

Geef een reactie

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.

%d bloggers liken dit: