The libxl driver already supports getting maximum vcpu count via
libxlDomainGetVcpusFlags, allowing to trivially implement
virDomainGetMaxVcpus.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
docs/news.html.in | 2 ++
src/libxl/libxl_driver.c | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/docs/news.html.in b/docs/news.html.in
index c222075..2365c39 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -39,6 +39,8 @@
_virStorageVolInfo structure. The --physical flag has been
added to the virsh vol-info command to access the data
</li>
+ <li>libxl: Implement virDomainGetMaxVcpus API
+ </li>
</ul>
</li>
<li><strong>Improvements</strong>
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 7e5d9b6..51fe3d8 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2363,6 +2363,13 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
}
static int
+libxlDomainGetMaxVcpus(virDomainPtr dom)
+{
+ return libxlDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_VCPU_MAXIMUM));
+}
+
+static int
libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
unsigned char *cpumap, int maplen,
unsigned int flags)
@@ -6446,6 +6453,7 @@ static virHypervisorDriver libxlHypervisorDriver = {
.domainSetVcpus = libxlDomainSetVcpus, /* 0.9.0 */
.domainSetVcpusFlags = libxlDomainSetVcpusFlags, /* 0.9.0 */
.domainGetVcpusFlags = libxlDomainGetVcpusFlags, /* 0.9.0 */
+ .domainGetMaxVcpus = libxlDomainGetMaxVcpus, /* 3.0.0 */
.domainPinVcpu = libxlDomainPinVcpu, /* 0.9.0 */
.domainPinVcpuFlags = libxlDomainPinVcpuFlags, /* 1.2.1 */
.domainGetVcpus = libxlDomainGetVcpus, /* 0.9.0 */
--
2.9.2