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

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



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
Affinity
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
ryanh@xxxxxxxxxx


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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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