Those used to be auto-generated and are hand-written now intead. The reason being that those are not very useful and better replacements are in order once the driver itself implements more of the API and common patterns start to emerge. --- src/Makefile.am | 2 - src/hyperv/hyperv_wmi.c | 81 +++++++++++++++++++++++++++++++++++++---- src/hyperv/hyperv_wmi.h | 24 +++++++++++- src/hyperv/hyperv_wmi_classes.h | 8 ++++ 4 files changed, 104 insertions(+), 11 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 75e4344..99f5229 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -910,8 +910,6 @@ HYPERV_DRIVER_SOURCES = \ hyperv/openwsman.h HYPERV_DRIVER_GENERATED = \ - hyperv/hyperv_wmi.generated.c \ - hyperv/hyperv_wmi.generated.h \ hyperv/hyperv_wmi_classes.generated.c \ hyperv/hyperv_wmi_classes.generated.h \ hyperv/hyperv_wmi_classes.generated.typedef diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 40de8d6..9e62f57 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -36,12 +36,6 @@ #define WS_SERIALIZER_FREE_MEM_WORKS 0 -#define ROOT_CIMV2 \ - "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*" - -#define ROOT_VIRTUALIZATION \ - "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/*" - #define VIR_FROM_THIS VIR_FROM_HYPERV @@ -81,6 +75,18 @@ hypervGetWmiClassInfo(hypervPrivate *priv, hypervWmiClassInfoListPtr list, return -1; } +static int +hypervGetWmiClassList(hypervPrivate *priv, hypervWmiClassInfoListPtr wmiInfo, + virBufferPtr query, hypervObject **wmiClass) +{ + hypervWqlQuery wqlQuery = HYPERV_WQL_QUERY_INITIALIZER; + + wqlQuery.info = wmiInfo; + wqlQuery.query = virBufferContentAndReset(query); + + return hypervEnumAndPull(priv, &wqlQuery, wmiClass); +} + int hypervVerifyResponse(WsManClient *client, WsXmlDocH response, const char *detail) @@ -699,5 +705,66 @@ hypervMsvmComputerSystemFromDomain(virDomainPtr domain, } +int +hypervGetMsvmComputerSystemList(hypervPrivate *priv, virBufferPtr query, + Msvm_ComputerSystem **list) +{ + return hypervGetWmiClassList(priv, Msvm_ComputerSystem_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetMsvmConcreteJobList(hypervPrivate *priv, virBufferPtr query, + Msvm_ConcreteJob **list) +{ + return hypervGetWmiClassList(priv, Msvm_ConcreteJob_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetWin32ComputerSystemList(hypervPrivate *priv, virBufferPtr query, + Win32_ComputerSystem **list) +{ + return hypervGetWmiClassList(priv, Win32_ComputerSystem_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetWin32ProcessorList(hypervPrivate *priv, virBufferPtr query, + Win32_Processor **list) +{ + return hypervGetWmiClassList(priv, Win32_Processor_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetMsvmVirtualSystemSettingDataList(hypervPrivate *priv, + virBufferPtr query, + Msvm_VirtualSystemSettingData **list) +{ + return hypervGetWmiClassList(priv, Msvm_VirtualSystemSettingData_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetMsvmProcessorSettingDataList(hypervPrivate *priv, + virBufferPtr query, + Msvm_ProcessorSettingData **list) +{ + return hypervGetWmiClassList(priv, Msvm_ProcessorSettingData_WmiInfo, query, + (hypervObject **) list); +} + -#include "hyperv_wmi.generated.c" +int +hypervGetMsvmMemorySettingDataList(hypervPrivate *priv, virBufferPtr query, + Msvm_MemorySettingData **list) +{ + return hypervGetWmiClassList(priv, Msvm_MemorySettingData_WmiInfo, query, + (hypervObject **) list); +} diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index 8ce32a9..2d90a3b 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -109,7 +109,29 @@ enum _Msvm_ReturnCode { const char *hypervReturnCodeToString(int returnCode); +/* Generic "Get WMI class list" */ +int hypervGetMsvmComputerSystemList(hypervPrivate *priv, virBufferPtr query, + Msvm_ComputerSystem **list); +int hypervGetMsvmConcreteJobList(hypervPrivate *priv, virBufferPtr query, + Msvm_ConcreteJob **list); + +int hypervGetWin32ComputerSystemList(hypervPrivate *priv, virBufferPtr query, + Win32_ComputerSystem **list); + +int hypervGetWin32ProcessorList(hypervPrivate *priv, virBufferPtr query, + Win32_Processor **list); + +int hypervGetMsvmVirtualSystemSettingDataList(hypervPrivate *priv, + virBufferPtr query, + Msvm_VirtualSystemSettingData **list); + +int hypervGetMsvmProcessorSettingDataList(hypervPrivate *priv, + virBufferPtr query, + Msvm_ProcessorSettingData **list); + +int hypervGetMsvmMemorySettingDataList(hypervPrivate *priv, virBufferPtr query, + Msvm_MemorySettingData **list); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Msvm_ComputerSystem @@ -133,6 +155,4 @@ int hypervMsvmComputerSystemFromDomain(virDomainPtr domain, -# include "hyperv_wmi.generated.h" - #endif /* __HYPERV_WMI_H__ */ diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classes.h index b0f3e3c..0b8e29c 100644 --- a/src/hyperv/hyperv_wmi_classes.h +++ b/src/hyperv/hyperv_wmi_classes.h @@ -28,6 +28,14 @@ # include "hyperv_wmi_classes.generated.typedef" +# define ROOT_CIMV2 \ + "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*" + +# define ROOT_VIRTUALIZATION \ + "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/*" + +# define ROOT_VIRTUALIZATION_V2 \ + "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/*" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Msvm_ComputerSystem -- 2.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list