mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 21:15:20 +00:00
hyperv: implement connectGetMaxVcpus
Co-authored-by: Sri Ramanujam <sramanujam@datto.com> Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
ab75d6b17c
commit
5aab9a2eac
@ -553,6 +553,39 @@ hypervConnectGetCapabilities(virConnectPtr conn)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
hypervConnectGetMaxVcpus(virConnectPtr conn, const char *type G_GNUC_UNUSED)
|
||||||
|
{
|
||||||
|
int result = -1;
|
||||||
|
hypervPrivate *priv = conn->privateData;
|
||||||
|
g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER;
|
||||||
|
Msvm_ProcessorSettingData *processorSettingData = NULL;
|
||||||
|
|
||||||
|
/* Get max processors definition */
|
||||||
|
virBufferAddLit(&query,
|
||||||
|
MSVM_PROCESSORSETTINGDATA_WQL_SELECT
|
||||||
|
"WHERE InstanceID LIKE 'Microsoft:Definition%Maximum'");
|
||||||
|
|
||||||
|
if (hypervGetWmiClass(Msvm_ProcessorSettingData, &processorSettingData) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!processorSettingData) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not get maximum definition of Msvm_ProcessorSettingData for host %s"),
|
||||||
|
conn->uri->server);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = processorSettingData->data.common->VirtualQuantity;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
hypervFreeObject(priv, (hypervObject *) processorSettingData);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
|
hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
|
||||||
{
|
{
|
||||||
@ -1689,6 +1722,7 @@ static virHypervisorDriver hypervHypervisorDriver = {
|
|||||||
.connectClose = hypervConnectClose, /* 0.9.5 */
|
.connectClose = hypervConnectClose, /* 0.9.5 */
|
||||||
.connectGetType = hypervConnectGetType, /* 0.9.5 */
|
.connectGetType = hypervConnectGetType, /* 0.9.5 */
|
||||||
.connectGetHostname = hypervConnectGetHostname, /* 0.9.5 */
|
.connectGetHostname = hypervConnectGetHostname, /* 0.9.5 */
|
||||||
|
.connectGetMaxVcpus = hypervConnectGetMaxVcpus, /* 6.9.0 */
|
||||||
.nodeGetInfo = hypervNodeGetInfo, /* 0.9.5 */
|
.nodeGetInfo = hypervNodeGetInfo, /* 0.9.5 */
|
||||||
.connectGetCapabilities = hypervConnectGetCapabilities, /* 6.9.0 */
|
.connectGetCapabilities = hypervConnectGetCapabilities, /* 6.9.0 */
|
||||||
.connectListDomains = hypervConnectListDomains, /* 0.9.5 */
|
.connectListDomains = hypervConnectListDomains, /* 0.9.5 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user