VMware Cloud Community
m_a_treat
Contributor
Contributor

Prevent maintenance mode boot after power failure

I'm running ESXi 4.1 and having an issue with automatically starting my VMs when I bring the host up.  Under normal circumstances, it works fine.  My particular issue is when I kill the server by removing power.  I can restore power to the server and it comes back up, but always in maintenance mode.  This is a tiny implementation at home used mostly as a practice lab for myself, but I'm hosting my VPN server on here so I can access the environment when I'm travelling.  This being the case, if my power goes out at home, ESX will boot, and it will go through the auto startup but log a message that it can't power on the vm in the host's current state.  Long story short, I figure this is most likely expected behavior, but since I can shut down my VMs before performing any work and nobody else is using the host but me, maint mode is more of a hinderance than anything else.  Is there any way to prevent it from booting into maint mode after a power failure?  (The server will automatically power on when power is restored)

Tags (3)
Reply
0 Kudos
4 Replies
JCMorrissey
Expert
Expert

Hi,

Take a look at the scripts mentioned in

http://communities.vmware.com/thread/228171

They should put you right.

Many tx

Please consider marking as "helpful", if you find this post useful. Thanks!... http://johncmorrissey.wordpress.com/
Reply
0 Kudos
ThompsG
Virtuoso
Virtuoso

Hi,

This is not expected behaviour. It would be a real pain if after a host failed for any reason (NMI reset, power outage, etc) that it entered Maintenance Mode. I know this is not helpful for you in your situation but just confirming that you shouldn't be experiencing this unless the host was already in Maintenance Mode before the power outage.

Kind regards.

Reply
0 Kudos
ThompsG
Virtuoso
Virtuoso

I know it is probably not much comfort but I thought I would test and see what happens here. To that end I created a virtual ESXi server and configured the Virtual Machine Startup and Shutdown behaviour on this host with 1 (one) VM. To my surprise after "pulling the plug" on the host and then restarting the host, it too entered maintenance mode. This was consistently repeatable.

Further mucking around kept generating the same response even after patching host with the latest VMware patches. Somewhere along the way it stopped doing it - not sure what the fix was but will continue to test and see if I can locate what "fixed" it.

One thing that has changed is that when the host kept entering Maintenance Mode after a power loss the virtual machine would be listed as Orphaned. Now the VM stays in the inventory.

Kind regards.

Reply
0 Kudos
ThompsG
Virtuoso
Virtuoso

Okay after further testing I have come up with a theory - not a good theory but a theory anyway.

Something was rattling around in my head about how often ESXi saves (backs up) configuration data to disk. My memory said every 10 minutes but after a little research this link suggests it varies: http://blogs.vmware.com/vsphere/2011/09/how-often-does-esxi-write-to-the-boot-disk.html

From here you can see that unless something more serious is happening in the ESXi configuration it will be once an hour (assuming a change has taken place). So what does this potentially have to do with your problem?

Well entering and exiting Maintenance Mode (MM) is a configuration change. If I enter MM on my test ESXi host then reboot the server normally, i.e. via the vSphere client when the host comes back online it will still be in MM. No worries here. Now if I exit the host from MM and then pull the power, after returning power to the host it entered MM on starting. This cycle will continue until I exit the host from MM and then save the configuration to disk either by rebooting the host via vSphere client (ignoring the error about not being in MM) or waiting an hour or so. (Full disclosure: Have not actually waited an hour to confirm this. Maybe later for fun or if I'm bored)

Consequently this also happens in reverse, i.e. if you put a host into MM then pull the power when it restarts it will not be in MM.

Now for the side track or why my test VM kept getting orphaned after a reset of the host. It was for the same reason as the above. I registered the VM then within a short period reset the host. vCenter knew about the VM but the host did not. Allowing the ESXi configuration to write to disk solved stopped this VM from being orphaned after a reset of the host.

Thoughts?

Reply
0 Kudos