Saturday, 18 May 2013

Hyper-V WMI values incorrect for the ResourceType property of Msvm_ResourceAllocationSettingData

When enumerating Hyper-V resources using WMI with the Msvm_ResourceAllocationSettingData class I couldn't find any physical disks by using the appropriate resource type. I however find the physical and synthetic disks listed with a resource type of 17.

The documentation for both Msvm_ResourceAllocationSettingData and Msvm_ResourceAllocationSettingData  (v2) reports that ResourceType 17 is actually a serial port.

Running the same query against both the V1 and V2 namespaces on the same server reports differing results. This would suggest that either there is a bug in the code or the enum values have changes or the documentation is incorrect.

If anyone else has noticed this issue please let me know. I've commented on the MSDN page.






4 comments:

  1. Did you find a workaround for this issue? Also seeing the same problem.

    ReplyDelete
  2. No, I haven't seen any feedback from Microsoft on the MSDN pages either. I think we are going to just have to code around this depending on which namespace we are connected to. It's a bit nasty.

    Dave

    ReplyDelete
    Replies
    1. With Windows 2012 R2, the v2 virtualization is all we can use, so coding around it is even a bit harder. I'm opening a Microsoft support case against Windows 2012 R2 for my company.

      Delete
    2. Microsoft responded to use: the Msvm_StorageAllocationSettingData class documented at http://msdn.microsoft.com/en-us/library/hh859775(v=vs.85).aspx. This is associated to the Msvm_VirtualSystemSettingData object representing the VM’s configuration in the same way as other CIM_ResourceAllocationSettingData-derived classes are, i.e. through the Msvm_VirtualSystemSettingDataComponent association.

      They also noted that the documentation for this class is also lacking, "does not correctly list the ResourceType and ResourceSubType values for virtual hard disks. For VHDs, ResourceType is 31 (Logical Disk) and ResourceSubType is “Microsoft:Hyper-V:Virtual Hard Disk”."

      Microsoft said they would open a bug to update the MSDN documentation.

      Delete