]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
vz: implement connectGetMaxVcpus API calls
authorMaxim Nestratov <mnestratov@virtuozzo.com>
Mon, 19 Oct 2015 19:02:00 +0000 (22:02 +0300)
committerDmitry Guryanov <dguryanov@parallels.com>
Tue, 20 Oct 2015 06:58:17 +0000 (09:58 +0300)
Because we have no limitation for maximal number of vcpus in containers
we report as maximum 1028 just for the sake of common sence.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
src/vz/vz_driver.c

index 15dc70f2408708344f6be8534e8c85e47e8d1b25..987824f388bb8144788d56c287aff080c4c5b21b 100644 (file)
@@ -1337,12 +1337,26 @@ vzDomainMemoryStats(virDomainPtr domain,
     return ret;
 }
 
+static int vzConnectGetMaxVcpus(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                const char *type)
+{
+    /* As far as we have no limitation for containers
+     * we report maximum */
+    if (type == NULL || STRCASEEQ(type, "vz") || STRCASEEQ(type, "parallels"))
+        return 1028;
+
+    virReportError(VIR_ERR_INVALID_ARG,
+                   _("unknown type '%s'"), type);
+    return -1;
+}
+
 static virHypervisorDriver vzDriver = {
     .name = "vz",
     .connectOpen = vzConnectOpen,            /* 0.10.0 */
     .connectClose = vzConnectClose,          /* 0.10.0 */
     .connectGetVersion = vzConnectGetVersion,   /* 0.10.0 */
     .connectGetHostname = vzConnectGetHostname,      /* 0.10.0 */
+    .connectGetMaxVcpus = vzConnectGetMaxVcpus, /* 1.2.21 */
     .nodeGetInfo = vzNodeGetInfo,      /* 0.10.0 */
     .connectGetCapabilities = vzConnectGetCapabilities,      /* 0.10.0 */
     .connectBaselineCPU = vzConnectBaselineCPU, /* 1.2.6 */