You dont have javascript enabled! Please enable it!

Measure-VM Error when using Pass-Through Disks in Hyper-V

2 Min. Read

Hello Folks,

Today I came across a weird issue while Measuring a Virtual Machine hosted on Hyper-V.

Error @ Measure-VM: Object reference not set to an instance of an object…

Table of Contents

Introduction

As you probably know that Hyper-V in Windows Server 2012/R2 and later includes Resource Metering, a feature that you can use to monitor resource consumption over time, per virtual machine or resource pool. Resource pools are logical containers that collect the resources of the virtual machines.

When you use resource pools, you can enable Resource Metering and query on resource use in the same way as for a single virtual machine. Resource Metering works with all Hyper-V operations. The movement of virtual machines between Hyper-V hosts, for example by using live migration, does not affect the data collection process.

Scenario

Here is the scenario:

I enabled VMResourceMetering for all VMs on the host, then waited some time to collect some data, and here is the result to get the VM resource usage info:

Get-VM * | Enable-VMResourceMetering 

Get-VM * | Measure-VM

Measure-VM Error

We can only see one VM detail resource…

Let’s see if all VMs has Resource Metering Enabled by running the following command:

Get-VM * | Format-List Name, ResourceMeteringEnabled

Great, all VMs have ResourceMeteringEnabled… 

As you can see this box is still virgin with two VMs only :)

ResourceMeteringEnabled

Let’s dig deeper…

Get-VM -Name XXX | Disable-VMResourceMetering

Get-VM -Name XXX | Enable-VMResourceMetering

DisableVMResourceMetering

EnableVMResourceMetering

Get-VM * | Measure-VM
Still No hope... :(
Measure-VM Error

So what is the difference between those two VMs…???

Let’s look into the VM settings and compare…

As you can see one VM is Generation 2 and the second is Generation 1, then one VM is configured with additional SCSI hard Drive using a pass-through physical disk.

ITLDBVM

SSMSVM

Starting with Windows Server 2012 R2 and later we have new storage metrics added to Resource Metering:

  1. AggregatedAverageNormalizedIOPS     
  2. AggregatedAveragelatency
  3. AggregatedDiskDataRead
  4. AggregatedDiskDataWritten

Let’s Remove the Pass-through physical disk and try again, here you go:

MeasureVM

Make sure to check my recent Windows Server Hyper-V Cookbook for in-depth details about Hyper-V!

Conclusion

Hopefully, Hyper-V will support resource metering on Pass-through disks in future releases to measure the average IOPS.

Of course, when you choose to use Pass-through disks, you want to take into consideration the following limitations:

  • You cannot use Differencing virtual hard disks with pass-through disks.
  • Checkpoints are not available on pass-through disks.
  • The physical disk must be set to an offline state on the Hyper-V host before you can configure it as a pass-through disk for a virtual machine.
  • You cannot expand pass-through disks dynamically unless such functionality is provided in the SAN.
  • The Hyper-V Volume Shadow Copy Service (VSS) writer cannot back up pass-through disks, and you cannot use Windows Server Backup in the parent partition to back up such disks. In such a case, you should use the backup program that is installed on the virtual machine.
  • You cannot use “Shared Nothing Live Migration” for migrations outside of a cluster because the disk is directly attached and doesn’t have a way to move between hosts.

In conclusion, Pass-through disks are not flexible.

Enjoy the day!

__
Thank you for reading my blog.

If you have any questions or feedback, please leave a comment.

-Charbel Nemnom-

Photo of author
About the Author
Charbel Nemnom
Charbel Nemnom is a Senior Cloud Architect, Swiss Certified ICT Security Expert, Certified Cloud Security Professional (CCSP), Certified Information Security Manager (CISM), Microsoft Most Valuable Professional (MVP), and Microsoft Certified Trainer (MCT). He has over 20 years of broad IT experience serving on and guiding technical teams to optimize the performance of mission-critical enterprise systems with extensive practical knowledge of complex systems build, network design, business continuity, and cloud security.
Previous

Cannot copy files into VM with Allow Enhanced Session Mode in Hyper-V 2012 R2

Hot/Add additional CPU resources in Windows Server Hyper-V

Next

Let me know what you think, or ask a question...

error: Alert: The content of this website is copyrighted from being plagiarized! You can copy from the 'Code Blocks' in 'Black' by selecting the Code. Thank You!