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

[Xen-changelog] [xen master] tools/libxl: Introduce LIBXL_CPUPOOL_POOLID_ANY



commit 7127d53fe891f9ea67357587a33a7aaba4b55f45
Author:     George Dunlap <george.dunlap@xxxxxxxxxx>
AuthorDate: Wed Feb 15 17:08:11 2017 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Thu Feb 16 12:47:12 2017 +0000

    tools/libxl: Introduce LIBXL_CPUPOOL_POOLID_ANY
    
    Callers to libxl_cpupool_create() can either request a specific pool
    id, or request that Xen do it for them.  But at the moment, the
    "automatic" selection is indicated by using a magic value, 0.  This is
    undesirable both because it doesn't obviously have meaning, but also
    because '0' is a valid cpupool (albeit one which at the moment can't
    be changed).
    
    Introduce a constant, LIBXL_CPUPOOL_POOLID_ANY, to indicate this
    instead.  Still accept '0' as meaning "ANY" for backwards
    compatibility.
    
    Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Reviewed-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    [ wei: removed two trailing spaces ]
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/libxl.h         | 6 ++++++
 tools/libxl/libxl_cpupool.c | 8 ++++++--
 tools/libxl/xl_cmdimpl.c    | 2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 3924464..92f1751 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -2086,6 +2086,12 @@ int libxl_tmem_shared_auth(libxl_ctx *ctx, uint32_t 
domid, char* uuid,
 int libxl_tmem_freeable(libxl_ctx *ctx);
 
 int libxl_get_freecpus(libxl_ctx *ctx, libxl_bitmap *cpumap);
+
+/*
+ * Set poolid to LIBXL_CPUOOL_POOLID_ANY to have Xen choose a
+ * free poolid for you.
+ */
+#define LIBXL_CPUPOOL_POOLID_ANY 0xFFFFFFFF
 int libxl_cpupool_create(libxl_ctx *ctx, const char *name,
                          libxl_scheduler sched,
                          libxl_bitmap cpumap, libxl_uuid *uuid,
diff --git a/tools/libxl/libxl_cpupool.c b/tools/libxl/libxl_cpupool.c
index 0ff8724..85b0688 100644
--- a/tools/libxl/libxl_cpupool.c
+++ b/tools/libxl/libxl_cpupool.c
@@ -139,8 +139,12 @@ int libxl_cpupool_create(libxl_ctx *ctx, const char *name,
     char *uuid_string;
     uint32_t xcpoolid;
 
-    /* Zero means "choose a poolid for me" */
-    xcpoolid = (*poolid) ? (*poolid) : XC_CPUPOOL_POOLID_ANY;
+    /* Accept '0' as 'any poolid' for backwards compatibility */
+    if ( *poolid == LIBXL_CPUPOOL_POOLID_ANY
+         || *poolid == 0 )
+        xcpoolid = XC_CPUPOOL_POOLID_ANY;
+    else
+        xcpoolid = *poolid;
 
     uuid_string = libxl__uuid2string(gc, *uuid);
     if (!uuid_string) {
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 37ebdce..0add5dc 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -8368,7 +8368,7 @@ int main_cpupoolcreate(int argc, char **argv)
     printf("number of cpus: %d\n", n_cpus);
 
     if (!dryrun_only) {
-        poolid = 0;
+        poolid = LIBXL_CPUPOOL_POOLID_ANY;
         if (libxl_cpupool_create(ctx, name, sched, cpumap, &uuid, &poolid)) {
             fprintf(stderr, "error on creating cpupool\n");
             goto out_cfg;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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