SCVMM shows no available memory for a Hyper-V host

Background

System Center Virtual Machine Manager 2012 R2 shows no available memory for a Hyper-V host.  This can be observed as a “0 KB” Available Memory count in many areas in SCVMM.

  • Fabric > Servers > All Hosts > HostGroup > Server/Cluster > Fabric Resources screen.  Shows “0 KB” in the Available Memory column.
  • VMs and Services > All Hosts > HostGroup > Server/Cluster > Overview screen.  Hovering over the “Memory (GB)” section displays 0 for Available on Host.

Host Memory Status1

  • (Get-SCVMHost -Computername server01).AvailableMemory
    • Result is 0

Troubleshooting

My initial assumption was that there was most likely a WMI malfunction somewhere on the Hyper-V host.  Some brief research led me to this article.

On the afflicted host, I ran “C:\Windows\SysWOW64> lodctr /R; winmgmt /resyncperf” which should rebuild the performance counters and then register the counters with WMI, and then I restarted WMI.  This didn’t improve the situation, and in fact may have been an indirect impedance to solving this problem more quickly.

The next suggestion was to reinstall the SCVMM agent.  I have covered this sub-topic in this post.

After reinstalling the SCVMM agent did not resolve the issue, I started looking in PerfMon – specifically at \\computername – Memory – Avaliable MBytes.  I was able to confirm that performance counters were indeed tracking available memory in MBytes, so the breakage must be in the link from getting performance counters in to SCVMM.

Based on some recent (unrelated) experience where SQL Configuration Manager refused to work properly and would only generate a WMI error (covered here), I decided to check for any SCVMM-related MOFs that may need to be re-registered.  Hiding in “%systemdrive%\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\setup”, I was able to find five seperate .mof files.  These files are lanSanDeployment.mof, NPIV.mof, scvmmswitchportsettings.mof, VMMAgent.mof, and VMMVirtualization.mof.  I *believe* that the only .mof that we are interested in for this particular problem is VMMVirtualization.mof, but just for good measure, I recompiled all of the MOFs located in this same directory.

Note – Recompiling a few of these will produce an error like

WARNING: File C:\Program Files\Microsoft System Center 2012\Virtual Machine Manager\setup\NPIV.mof does not contain #PRAGMA AUTORECOVER.  If the WMI repository is rebuilt in the future, the contents of this MOF file will not be included in the new WMI repository.  To include this MOF file when the WMI Repository is automatically reconstructed, place the #PRAGMA AUTORECOVER statement on the first line of the MOF file.

Solution

Run Notepad as Administrator.  Open each .mof file under “%systemdrive%\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\setup” and add #PRAGMA AUTORECOVER as the first line after the comments section (designated as /*++ and –*/).  Save each modified file.  On the Hyper-V host, run command prompt as Administrator, change directory to “%systemdrive%\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\setup”, and execute

mofcomp (filename).mof

In my case, I did not have to do anything else.  The SCVMM console and related PoSH cmdlets immediately reflected correct Available Memory for the host.  If your SCVMM infrastructure does not immediately reflect correct information, I would suggest restarting WinRM on the Hyper-V host.

Solution Update

I had this issue occur again in a different environment.  This time I was able to narrow the fix down to recompiling VMMAgent.mof, and VMMVirtualization.mof and restarting Windows Management Instrumentation service (and dependent services) on the Hyper-V host.

References

http://www.miru.ch/unveiling-cluster-overcommit-in-scvmm-2012-hyper-v/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s