This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] xm: allow xm create cpus parameter to accept range

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xm: allow xm create cpus parameter to accept range
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Fri, 14 Apr 2006 15:00:08 -0500
Delivery-date: Fri, 14 Apr 2006 13:00:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
The following patch removes the integer restriction on the cpu
parameter.  xm create already handles the cpus value being comprised of
a string representing a range of values ("0-3,^2,4-6" -> [0,1,3,4,5,6])
but currently rejects any value that cannot be converted to an integer:

[x460-3 ~]# xm create /etc/xen/ubuntu_hoary_amd64_dom1 cpus="16-31"
Error: Invalid value: 16-31
[x460-3 ~]# xm create /etc/xen/ubuntu_hoary_amd64_dom1 cpus="2-4"
Error: Invalid value: 2-4

With the attached patch, changing the getopt type to value removes the
restriction and works as expected.

[x460-3 ~] # xm create /etc/xen/ubuntu_hoary_amd64_dom1 cpus="16-31,^17"
Using config file "/etc/xen/ubuntu_hoary_amd64_dom1".
Started domain x460-3-guest

[root@x460-3 ~]# xm vcpu-list 3
Name                              ID  VCPU  CPU  State  Time(s)  CPU
x460-3-guest                       3     0   16   -b-       3.1  16
x460-3-guest                       3     1   18   -b-       0.8  18
x460-3-guest                       3     2   19   -b-       0.7  19
x460-3-guest                       3     3   20   -b-       0.4  20

Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253

diffstat output:
 create.py |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

# HG changeset patch
# User Ryan Harper <ryanh@xxxxxxxxxx>
# Node ID 6f0d6416fec5a1545249b4eba266c846afb05b22
# Parent  176302fe4dfb47bf5f4c74c26ea00e1a90726770
Allow cpus parameter to xm create to accept a range string by removing the
restriction of cpus accepting only integers.

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>

diff -r 176302fe4dfb -r 6f0d6416fec5 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Fri Apr 14 14:05:28 2006
+++ b/tools/python/xen/xm/create.py     Fri Apr 14 19:49:36 2006
@@ -158,7 +158,7 @@
           use="CPU to run the VCPU0 on.")
 gopts.var('cpus', val='CPUS',
-          fn=set_int, default=None,
+          fn=set_value, default=None,
           use="CPUS to run the domain on.")
 gopts.var('pae', val='PAE',

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>