From 87e062415f10bff90ee827f51d08c564bc7bbb82 Mon Sep 17 00:00:00 2001 From: Matt Coleman Date: Mon, 2 Nov 2020 19:22:05 -0500 Subject: [PATCH] hyperv: move hypervGetProcSDByVSSDInstanceId to hyperv_wmi.c This places it next to existing related functions. Signed-off-by: Matt Coleman Reviewed-by: Neal Gompa Reviewed-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 26 -------------------------- src/hyperv/hyperv_wmi.c | 26 ++++++++++++++++++++++++++ src/hyperv/hyperv_wmi.h | 4 ++++ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index de38dce9db..be87871085 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -182,32 +182,6 @@ hypervGetVirtualSystemByName(hypervPrivate *priv, const char *name, } - -static int -hypervGetProcSDByVSSDInstanceId(hypervPrivate *priv, const char *id, - Msvm_ProcessorSettingData **data) -{ - g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER; - virBufferEscapeSQL(&query, - "ASSOCIATORS OF {Msvm_VirtualSystemSettingData.InstanceID='%s'} " - "WHERE AssocClass = Msvm_VirtualSystemSettingDataComponent " - "ResultClass = Msvm_ProcessorSettingData", - id); - - if (hypervGetWmiClass(Msvm_ProcessorSettingData, data) < 0) - return -1; - - if (!*data) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not look up processor setting data with virtual system instance ID '%s'"), - id); - return -1; - } - - return 0; -} - - static int hypervRequestStateChange(virDomainPtr domain, int state) { diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 8e5d99ad70..ebdb4c79fc 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -1570,6 +1570,32 @@ hypervGetMsvmVirtualSystemSettingDataFromUUID(hypervPrivate *priv, } +int +hypervGetProcSDByVSSDInstanceId(hypervPrivate *priv, + const char *id, + Msvm_ProcessorSettingData **data) +{ + g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER; + virBufferEscapeSQL(&query, + "ASSOCIATORS OF {Msvm_VirtualSystemSettingData.InstanceID='%s'} " + "WHERE AssocClass = Msvm_VirtualSystemSettingDataComponent " + "ResultClass = Msvm_ProcessorSettingData", + id); + + if (hypervGetWmiClass(Msvm_ProcessorSettingData, data) < 0) + return -1; + + if (!*data) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not look up processor setting data with virtual system instance ID '%s'"), + id); + return -1; + } + + return 0; +} + + int hypervGetMsvmMemorySettingDataFromVSSD(hypervPrivate *priv, const char *vssd_instanceid, diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index 72c8e54678..c06453c1fd 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -250,6 +250,10 @@ int hypervGetMsvmVirtualSystemSettingDataFromUUID(hypervPrivate *priv, const char *uuid_string, Msvm_VirtualSystemSettingData **list); +int hypervGetProcSDByVSSDInstanceId(hypervPrivate *priv, + const char *id, + Msvm_ProcessorSettingData **data); + int hypervGetMsvmMemorySettingDataFromVSSD(hypervPrivate *priv, const char *vssd_instanceid, Msvm_MemorySettingData **list);