[PATCH] Hyper-V 2012 R2 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This patch adds support to libvirt to work with Hyper-V 2012 R2. This
will however mean
that Hyper-V 2008 will no longer be supported. Microsoft supports
hyperv 2008 management
via windows 7 and hyperv 2012 via windows 8.1 (note that the reverse
is not true, that is,
 win 7 cannot manage hyperv 2012 and win 8.1 cannot manage hyperv
2008). I think they wanted
 to keep the application code separate, in the sense that one manages
the old namespace and
the new one manages the new v2 namespace. The difference between the
two namespaces is not great
either, sadly, both of them have same class names but with different
field types (int, string etc.)
which have been separated by the namespace root/virtualization vs
root/virtualization/v2

For users who wish to use libvirt to manage Hyper-V 2008, using an
older version of libvirt <= 1.4.2 should work.
 Since new Hyper-V 2008 drivers wont be contributed to libvirt anyway,
so it is not like the users will be missing on features.
And it is more likely that all future contributions to libvirt will be
on Hyper-V 2012 R2 and beyond.



diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index aed9307..0253496 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -893,8 +893,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain,
unsigned int flags)
     if (VIR_STRDUP(def->name, computerSystem->data->ElementName) < 0)
         goto cleanup;

-    if (VIR_STRDUP(def->description,
virtualSystemSettingData->data->Notes) < 0)
-        goto cleanup;
+    // No need to check length of Notes, it is now a dynamic array

     def->mem.max_balloon = memorySettingData->data->Limit * 1024; /*
megabyte to kilobyte */
     def->mem.cur_balloon = memorySettingData->data->VirtualQuantity *
1024; /* megabyte to kilobyte */
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 6e6f629..4c9ad34 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -39,7 +39,7 @@
     "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*";

 #define ROOT_VIRTUALIZATION \
-    "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/*";
+    "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/*";

 #define VIR_FROM_THIS VIR_FROM_HYPERV

diff --git a/src/hyperv/hyperv_wmi_generator.input
b/src/hyperv/hyperv_wmi_generator.input
index 97f9dff..bb0e8c1 100644
--- a/src/hyperv/hyperv_wmi_generator.input
+++ b/src/hyperv/hyperv_wmi_generator.input
@@ -20,6 +20,9 @@
 #
 # Based on MSDN Hyper-V WMI Classes:
 # http://msdn.microsoft.com/en-us/library/cc136986%28v=vs.85%29.aspx
+# Hyper-V 2012 version (root/virtualization/v2 namespace):
http://msdn.microsoft.com/en-us/library/hh850257(v=vs.85).aspx
+#         + Currently, Classes {Msvm_MemorySettingData,
Msvm_ProcessorSettingData, Msvm_VirtualSystemSettingData} are in v2
namespace
+#         + Will eventually need to upgrade the remainder of the
classes as well.
 #


@@ -97,80 +100,90 @@ end


 class Msvm_MemorySettingData
-    string   Caption
-    string   Description
-    string   InstanceID
-    string   ElementName
-    uint16   ResourceType
-    string   OtherResourceType
-    string   ResourceSubType
-    string   PoolID
-    uint16   ConsumerVisibility
-    string   HostResource[]
-    string   AllocationUnits
-    uint64   VirtualQuantity
-    uint64   Reservation
-    uint64   Limit
-    uint32   Weight
-    boolean  AutomaticAllocation
-    boolean  AutomaticDeallocation
-    string   Parent
-    string   Connection[]
-    string   Address
-    uint16   MappingBehavior
-    boolean  IsVirtualized
-    string   DeviceID
-    string   DeviceIDFormat
-    boolean  DynamicMemoryEnabled
-#    uint32   TargetMemoryBuffer # Available only on Windows Server 2008 R2 SP1
+    string  InstanceID
+    string  Caption
+    string  Description
+    string  ElementName
+    uint16  ResourceType
+    string  OtherResourceType
+    string  ResourceSubType
+    string  PoolID
+    uint16  ConsumerVisibility
+    string  HostResource[]
+    string  AllocationUnits
+    uint64  VirtualQuantity
+    uint64  Reservation
+    uint64  Limit
+    uint32  Weight
+    boolean AutomaticAllocation
+    boolean AutomaticDeallocation
+    string  Parent
+    string  Connection[]
+    string  Address
+    uint16  MappingBehavior
+    string  AddressOnParent
+    string  VirtualQuantityUnits
+    boolean DynamicMemoryEnabled
+    uint32  TargetMemoryBuffer
+    boolean IsVirtualized
+    boolean SwapFilesInUse
+    uint64  MaxMemoryBlocksPerNumaNode
 end


 class Msvm_ProcessorSettingData
-    string   Caption
-    string   Description
-    string   InstanceID
-    string   ElementName
-    uint16   ResourceType
-    string   OtherResourceType
-    string   ResourceSubType
-    string   PoolID
-    uint16   ConsumerVisibility
-    string   HostResource[]
-    string   AllocationUnits
-    uint64   VirtualQuantity
-    uint64   Reservation
-    uint64   Limit
-    uint32   Weight
-    boolean  AutomaticAllocation
-    boolean  AutomaticDeallocation
-    string   Parent
-    string   Connection[]
-    string   Address
-    uint16   MappingBehavior
-    boolean  IsVirtualized
-    string   DeviceID
-    string   DeviceIDFormat
-    uint16   ProcessorsPerSocket
-    uint16   SocketCount
-    boolean  ThreadsEnabled
-    boolean  LimitCPUID
-    boolean  LimitProcessorFeatures
+    string  InstanceID
+    string  Caption
+    string  Description
+    string  ElementName
+    uint16  ResourceType
+    string  OtherResourceType
+    string  ResourceSubType
+    string  PoolID
+    uint16  ConsumerVisibility
+    string  HostResource[]
+    string  AllocationUnits
+    uint64  VirtualQuantity
+    uint64  Reservation
+    uint64  Limit
+    uint32  Weight
+    boolean AutomaticAllocation
+    boolean AutomaticDeallocation
+    string  Parent
+    string  Connection[]
+    string  Address
+    uint16  MappingBehavior
+    string  AddressOnParent
+    string  VirtualQuantityUnits
+    boolean LimitCPUID
+    boolean LimitProcessorFeatures
+    uint64  MaxProcessorsPerNumaNode
+    uint64  MaxNumaNodesPerSocket
 end


 class Msvm_VirtualSystemSettingData
+    string   InstanceID
     string   Caption
     string   Description
     string   ElementName
-    string   InstanceID
-    string   SystemName
-    uint16   SettingType
-    uint16   VirtualSystemType
-    string   OtherVirtualSystemType
-    boolean  AutoActivate
+    string   VirtualSystemIdentifier
+    string   VirtualSystemType
+    string   Notes[]
     datetime CreationTime
-    string   Notes
+    string   ConfigurationID
+    string   ConfigurationDataRoot
+    string   ConfigurationFile
+    string   SnapshotDataRoot
+    string   SuspendDataRoot
+    string   SwapFileDataRoot
+    string   LogDataRoot
+    uint16   AutomaticStartupAction
+    datetime AutomaticStartupActionDelay
+    uint16   AutomaticStartupActionSequenceNumber
+    uint16   AutomaticShutdownAction
+    uint16   AutomaticRecoveryAction
+    string   RecoveryFile
     string   BIOSGUID
     string   BIOSSerialNumber
     string   BaseBoardSerialNumber
@@ -179,8 +192,22 @@ class Msvm_VirtualSystemSettingData
     boolean  BIOSNumLock
     uint16   BootOrder[]
     string   Parent
-    uint16   NumaNodeList[]
-    boolean  NumaNodesAreRequired
+    boolean  IsSaved
+    string   AdditionalRecoveryInformation
+    boolean  AllowFullSCSICommandSet
+    uint32   DebugChannelId
+    uint16   DebugPortEnabled
+    uint32   DebugPort
+    string   Version
+    boolean  IncrementalBackupEnabled
+    boolean  VirtualNumaEnabled
+    boolean  AllowReducedFcRedundancy
+    string   VirtualSystemSubType
+    string   BootSourceOrder[]
+    boolean  PauseAfterBootFailure
+    uint16   NetworkBootPreferredProtocol
+    boolean  SecureBootEnabled
+    uint64   LowMmioGapSize
 end


diff --git a/src/hyperv/hyperv_wmi_generator.py
b/src/hyperv/hyperv_wmi_generator.py
index f767d54..af3ce7e 100755
--- a/src/hyperv/hyperv_wmi_generator.py
+++ b/src/hyperv/hyperv_wmi_generator.py
@@ -71,7 +71,7 @@ class Class:
         if self.name.startswith("Win32_"):
             header += "
\"http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/%s\"\n"; %
self.name
         else:
-            header += "
\"http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/%s\"\n";
% self.name
+            header += "
\"http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/%s\"\n";
% self.name

         header += "\n"
         header += "#define %s_CLASSNAME \\\n" % name_upper

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]