mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-26 15:14:42 +00:00
hyperv: add a macro for retrieving setting data
Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
836e0a960b
commit
0fec6ab9b5
@ -1490,20 +1490,23 @@ hypervGetMsvmVirtualSystemSettingDataFromUUID(hypervPrivate *priv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define hypervGetSettingData(type, id, out) \
|
||||||
|
g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER; \
|
||||||
|
virBufferEscapeSQL(&query, \
|
||||||
|
"ASSOCIATORS OF {Msvm_VirtualSystemSettingData.InstanceID='%s'} " \
|
||||||
|
"WHERE AssocClass = Msvm_VirtualSystemSettingDataComponent " \
|
||||||
|
"ResultClass = " #type, \
|
||||||
|
id); \
|
||||||
|
if (hypervGetWmiClass(type, out) < 0) \
|
||||||
|
return -1
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
hypervGetResourceAllocationSD(hypervPrivate *priv,
|
hypervGetResourceAllocationSD(hypervPrivate *priv,
|
||||||
const char *id,
|
const char *id,
|
||||||
Msvm_ResourceAllocationSettingData **data)
|
Msvm_ResourceAllocationSettingData **data)
|
||||||
{
|
{
|
||||||
g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER;
|
hypervGetSettingData(Msvm_ResourceAllocationSettingData, id, data);
|
||||||
virBufferEscapeSQL(&query,
|
|
||||||
"ASSOCIATORS OF {Msvm_VirtualSystemSettingData.InstanceID='%s'} "
|
|
||||||
"WHERE AssocClass = Msvm_VirtualSystemSettingDataComponent "
|
|
||||||
"ResultClass = Msvm_ResourceAllocationSettingData",
|
|
||||||
id);
|
|
||||||
|
|
||||||
if (hypervGetWmiClass(Msvm_ResourceAllocationSettingData, data) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!*data) {
|
if (!*data) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -1521,15 +1524,7 @@ hypervGetProcessorSD(hypervPrivate *priv,
|
|||||||
const char *id,
|
const char *id,
|
||||||
Msvm_ProcessorSettingData **data)
|
Msvm_ProcessorSettingData **data)
|
||||||
{
|
{
|
||||||
g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER;
|
hypervGetSettingData(Msvm_ProcessorSettingData, id, data);
|
||||||
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) {
|
if (!*data) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -1547,15 +1542,9 @@ hypervGetMemorySD(hypervPrivate *priv,
|
|||||||
const char *vssd_instanceid,
|
const char *vssd_instanceid,
|
||||||
Msvm_MemorySettingData **list)
|
Msvm_MemorySettingData **list)
|
||||||
{
|
{
|
||||||
g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER;
|
hypervGetSettingData(Msvm_MemorySettingData, vssd_instanceid, list);
|
||||||
|
|
||||||
virBufferAsprintf(&query,
|
if (!*list)
|
||||||
"ASSOCIATORS OF {Msvm_VirtualSystemSettingData.InstanceID='%s'} "
|
|
||||||
"WHERE AssocClass = Msvm_VirtualSystemSettingDataComponent "
|
|
||||||
"ResultClass = Msvm_MemorySettingData",
|
|
||||||
vssd_instanceid);
|
|
||||||
|
|
||||||
if (hypervGetWmiClass(Msvm_MemorySettingData, list) < 0 || !*list)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1567,16 +1556,7 @@ hypervGetStorageAllocationSD(hypervPrivate *priv,
|
|||||||
const char *id,
|
const char *id,
|
||||||
Msvm_StorageAllocationSettingData **data)
|
Msvm_StorageAllocationSettingData **data)
|
||||||
{
|
{
|
||||||
g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER;
|
hypervGetSettingData(Msvm_StorageAllocationSettingData, id, data);
|
||||||
virBufferEscapeSQL(&query,
|
|
||||||
"ASSOCIATORS OF {Msvm_VirtualSystemSettingData.InstanceID='%s'} "
|
|
||||||
"WHERE AssocClass = Msvm_VirtualSystemSettingDataComponent "
|
|
||||||
"ResultClass = Msvm_StorageAllocationSettingData",
|
|
||||||
id);
|
|
||||||
|
|
||||||
if (hypervGetWmiClass(Msvm_StorageAllocationSettingData, data) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user