xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: george.dunlap@eu.citrix.com
Subject: [PATCH] xl, cpupools: Create empty pool if no cpus are specified
Date: Thu, 5 Apr 2012 14:14:43 +0100	[thread overview]
Message-ID: <c53f124c8c448ea43d75.1333631683@kodo2> (raw)

Currently, if "xl cpupool-create" is called with no cpus configured,
xl will choose a cpu at random from the list of unassigned cpus, and
if no unassigned cpus are available, it will fail.

This seems to me to be a poor interface.  For one, it makes it impossible
to create an empty cpupool using the xl command-line, except by creating
a pool and then removing the cpus from it.  For two, I don't think assigning
a random cpu is a feature; it's not unreasonable for the user to specify
which cpus to add to which pools.

This patch changes the behavior of "xl cpupool-create" to create an empty
pool if no cpus are specified.  I believe this interface to be more expected
and more script-friendly.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r 7530af17cfcf -r c53f124c8c44 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Apr 05 14:04:53 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Thu Apr 05 14:14:32 2012 +0100
@@ -5734,20 +5734,8 @@ int main_cpupoolcreate(int argc, char **
             libxl_cpumap_set(&cpumap, i);
             n_cpus++;
         }
-    } else {
-        n_cpus = 1;
-        n = 0;
-        libxl_for_each_cpu(i, freemap)
-            if (libxl_cpumap_test(&freemap, i)) {
-                n++;
-                libxl_cpumap_set(&cpumap, i);
-                break;
-            }
-        if (n < n_cpus) {
-            fprintf(stderr, "no free cpu found\n");
-            return -ERROR_FAIL;
-        }
-    }
+    } else
+        n_cpus = 0;
 
     libxl_uuid_generate(&uuid);

             reply	other threads:[~2012-04-05 13:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 13:14 George Dunlap [this message]
2012-04-24 17:52 ` [PATCH] xl, cpupools: Create empty pool if no cpus are specified Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c53f124c8c448ea43d75.1333631683@kodo2 \
    --to=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).