[libvirt] [PATCH 03/11] hyperv: introduce hypervWmiClassInfo struct.

Dawid Zamirski dzamirski at datto.com
Thu Mar 30 16:47:20 UTC 2017


This struct is to be used to carry all the information necessary to
issue wsman requests for given WMI class. Those will be defined by the
generator code (as lists) so that they are handy for the driver code to
"extract" needed info depending on which hyper-v we're connected to.
For example:

hypervWmiClassInfoListPtr Msvm_ComputerSystem_WmiInfo = {
    .count = 2
    {
        {
            .name = "Msvm_ComputerSystem",
            .version = "v1",
            .rootUri = "http://asdf.com",
            ...
        },
        {
            .name = "Msvm_ComputerSystem",
            .version = "v2",
            .rootUri = "http://asdf.com/v2",
            ...
        },
    }
};

Then the driver code will grab either "v1" or "v2" to pass info wsman
API, depending on hypervPrivate->wmiVersion value.
---
 src/hyperv/hyperv_wmi.c         |  6 ++----
 src/hyperv/hyperv_wmi_classes.h | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 947101f..309edac 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -36,16 +36,14 @@
 
 #define WS_SERIALIZER_FREE_MEM_WORKS 0
 
-#define ROOT_CIMV2 \
+# define ROOT_CIMV2 \
     "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*"
 
-#define ROOT_VIRTUALIZATION \
+# define ROOT_VIRTUALIZATION \
     "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/*"
 
 #define VIR_FROM_THIS VIR_FROM_HYPERV
 
-
-
 int
 hypervVerifyResponse(WsManClient *client, WsXmlDocH response,
                      const char *detail)
diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classes.h
index ac7a3b8..b0f3e3c 100644
--- a/src/hyperv/hyperv_wmi_classes.h
+++ b/src/hyperv/hyperv_wmi_classes.h
@@ -87,6 +87,28 @@ enum _Msvm_ConcreteJob_JobState {
 };
 
 
+typedef struct _hypervWmiClassInfo hypervWmiClassInfo;
+typedef hypervWmiClassInfo *hypervWmiClassInfoPtr;
+struct _hypervWmiClassInfo {
+    /* The WMI class name */
+    const char *name;
+    /* The version of the WMI class as in "v1" or "v2" */
+    const char *version;
+    /* The URI for wsman enumerate request */
+    const char *rootUri;
+    /* The namespace URI for XML serialization */
+    const char *resourceUri;
+    /* The wsman serializer info - one of the *_TypeInfo structs */
+    XmlSerializerInfo *serializerInfo;
+};
+
+
+typedef struct _hypervWmiClassInfoList hypervWmiClassInfoList;
+typedef hypervWmiClassInfoList *hypervWmiClassInfoListPtr;
+struct _hypervWmiClassInfoList {
+    size_t count;
+    hypervWmiClassInfoPtr *objs;
+};
 
 # include "hyperv_wmi_classes.generated.h"
 
-- 
2.9.3




More information about the libvir-list mailing list