From 30525b759b7b3b223c03617814cb4b40cd089c8a Mon Sep 17 00:00:00 2001 From: Matt Coleman Date: Thu, 12 Nov 2020 12:10:32 -0500 Subject: [PATCH] hyperv: implement domainGetMaxVcpus Co-authored-by: Sri Ramanujam Signed-off-by: Matt Coleman Reviewed-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 3c436d9465..44ef4c53e0 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1627,6 +1627,16 @@ hypervDomainIsActive(virDomainPtr domain) } +static int +hypervDomainGetMaxVcpus(virDomainPtr dom) +{ + if (hypervDomainIsActive(dom)) + return hypervDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)); + else + return hypervConnectGetMaxVcpus(dom->conn, NULL); +} + + static int hypervDomainIsPersistent(virDomainPtr domain G_GNUC_UNUSED) { @@ -1983,6 +1993,7 @@ static virHypervisorDriver hypervHypervisorDriver = { .domainGetState = hypervDomainGetState, /* 0.9.5 */ .domainGetVcpusFlags = hypervDomainGetVcpusFlags, /* 6.10.0 */ .domainGetVcpus = hypervDomainGetVcpus, /* 6.10.0 */ + .domainGetMaxVcpus = hypervDomainGetMaxVcpus, /* 6.10.0 */ .domainGetXMLDesc = hypervDomainGetXMLDesc, /* 0.9.5 */ .connectListDefinedDomains = hypervConnectListDefinedDomains, /* 0.9.5 */ .connectNumOfDefinedDomains = hypervConnectNumOfDefinedDomains, /* 0.9.5 */ -- 2.47.3