[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH for-4.6 v2 2/3] xl: error out if vNUMA specifies more vcpus than pcpus



... but allow user to override that check by specifying maxvcpus= in xl
configuration file.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 078acd1..5fde8fa 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1202,11 +1202,27 @@ static void parse_vnuma_config(const XLU_Config *config,
     }
 
     /* User has specified maxvcpus= */
-    if (b_info->max_vcpus != 0 &&  b_info->max_vcpus != max_vcpus) {
-        fprintf(stderr, "xl: vnuma vcpus and maxvcpus= mismatch\n");
-        exit(1);
-    } else
+    if (b_info->max_vcpus != 0) {
+        if (b_info->max_vcpus != max_vcpus) {
+            fprintf(stderr, "xl: vnuma vcpus and maxvcpus= mismatch\n");
+            exit(1);
+        }
+    } else {
+        int host_cpus = libxl_get_online_cpus(ctx);
+
+        if (host_cpus < 0) {
+            fprintf(stderr, "Failed to get online cpus\n");
+            exit(1);
+        }
+
+        if (host_cpus < max_vcpus) {
+            fprintf(stderr, "xl: vnuma specifies more vcpus than pcpus, "\
+                    "use maxvcpus= to override this check.\n");
+            exit(1);
+        }
+
         b_info->max_vcpus = max_vcpus;
+    }
 
     /* User has specified maxmem= */
     if (b_info->max_memkb != LIBXL_MEMKB_DEFAULT &&
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.