HyperV children get dirty shutdown when UPS shuts down server but not during manual shutdown--why?

We are having an issue with several Windows 2012 R2 boxes running the HyperV role.  The servers are all connected to their own APC SMART-UPS 1500 battery backups and have the USB data cables connected.  Power management is being done via Windows power management.  

The problem we're running into is that if the power goes out and Windows power management shuts down the server, the HyperV parent shuts down cleanly but the children all report dirty shutdowns.  The "Windows was shut down unexpectedly" prompt comes up on all of the HyperV children when the parent is powered back up.

Interestingly, if the HyperV parents are rebooted or shut down manually from the console, the children have no negative effects--when the HyperV parent finishes booting, the children are all up and running normally where they left off when the parent was restarted or shut down.  

I originally had the HyperV parent servers set to shut down when their UPSes got down to 60%.  I figured maybe the estimated battery percentage was inaccurate, so today I set one of the servers (which doesn't have anything important on it) to shut down at 85%.  After about 5 minutes, the server shut down.  The UPS battery level indicated four out of five lights, so presumably at least 4/5ths of its power remained.  However, after booting up the HyperV parent, the children all indicated that they had been subjected to a dirty shutdown.

Clearly the HyperV parent is smart enough to gracefully shut down the children under most circumstances, so why does it fail to do so when power management shuts down the parent?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cliff GaliherCommented:
APC has server UPSes and they have workstation UPSes.  Unfortunately APC also made the decision that their workstation UPSes only come with workstation-caliber software which only expects a single user logged in and no long-running applications.  When you manually shut down a Hyper-V server, the shutdown command issued is hyper-v aware (as well as other applications that use proper windows server APIs) and ensures they get shut down gracefully.  Many 3rd-party applications, particularly those that don't specifically list Windows Server support, do not.  The workstation edition of APCs software is one of these.  It won't make the necessary calls, and things go badly.  Since APC doesn't certify their software for Windows Server, there isn't much you can usually do.  Neither Microsoft nor APC will support the situation, and APC has an active incentive to encourage you to purchase their more expensive server-class UPSes.
SINC_dmackAuthor Commented:
HI Cliff, we are using APC SmartUPS 1500VA units.  These are server-class $500+ UPSes.  The APC-provided software is APC Powerchute Business Edition (not the Personal Edition as provided with the BackUPS RS devices we've got on a few other servers).  However, we are using Windows power management, not APC's software.  Windows recognizes the UPS and loads its own driver for it--HID UPS Battery.  So it doesn't seem like the grade of UPS or the UPS management software are possible causes for this issue.
SINC_dmackAuthor Commented:
A bit more information--the HyperV children are varying OSes.  Several are Server '03, several are '08 R2, and several are '12 R2.  All have integration services installed from the parent (via the "insert integration services CD" option in HyperV).
5 Ways Acronis Skyrockets Your Data Protection

Risks to data security are risks to business continuity. Businesses need to know what these risks look like – and where they can turn for help.
Check our newest E-Book and learn how you can differentiate your data protection business with advanced cloud solutions Acronis delivers

Cliff GaliherCommented:
You'll want to use Powerchute.  The windows power management is bare bones and, last I checked, had not been properly updated with all of the VSS APIs.
Cliff GaliherCommented:
The integration services shouldn't really matter in this instance. They help with things like live migration, and ensuring the VM clock is accurate after a state change. But Hyper-V will shutdown the VM by sending the VM the equivalent interrupts (like hitting a power button on a physical machine would) if IC isn't installed. So even Linux machines would shut down.  If you have the default action set to saved state, it'll obviously attempt that first as long as guest supports it. But that also would not normally report a dirty shutdown, as the machine was technically never shut down. It just resumes from its saved state when the host comes back.
SINC_dmackAuthor Commented:
Hi Cliff.  Yes, the Windows power management is pretty rudimentary and that's why I chose to use it.  The Powerchute Business Edition is overly complex for a situation where I just need Windows to shut down gracefully when the battery capacity drops to a certain level.

I just ran another test.  I reconfigured the children to shut down when the parent turns off.  Child Properties -> Automatic Stop Action -> Shut down the guest operating system.  This time, the child operating systems shut down gracefully.  Additionally, their event logs in the child OSes indicated that they knew that they were being shut down because of a power-outage related issue.  Event 109 - "The kernel power manager has initiated a shutdown transition."  

So to clarify the issue, it appears that the HyperV children won't save their states successfully when the HyperV parent is shut down for a power management issue, but they will shut down gracefully during a power outage.  

I'd like to get to the bottom of why the saved states aren't working properly, but in the meantime, I'm going to reconfigure all of the HyperV children to shut down in case of a power outage instead of attempting to save their states.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SINC_dmackAuthor Commented:
Setting the children to shut down (instead of saving their states) when the parent shuts down appears to have resolved the problem.  It's not exactly the solution I was looking for (getting the children to save their states instead of getting a dirty shutdown) but it's good-enough of a workaround that I'm going to leave it implemented on the affected servers and call it done.  I would awarded an A for a solution that allowed saving the states, but I'll give myself a B since this is a workaround, not a true fix.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.