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

[Xen-devel] [PATCH] xm: Fix string index out of range in 'vcpu-pin' command



Hi,

 This patch fix the following trivial bug.

# xm vcpu-pin 0 0 1,,2
Unexpected error: exceptions.IndexError

Please report to xen-devel@xxxxxxxxxxxxxxxxxxx
Traceback (most recent call last):
  File "/usr/sbin/xm", line 7, in ?
    main.main(sys.argv)
  File "usr/lib/python2.4/site-packages/xen/xm/main.py", line 3616, in main
  File "usr/lib/python2.4/site-packages/xen/xm/main.py", line 3640, in _run_cmd
  File "usr/lib/python2.4/site-packages/xen/xm/main.py", line 1479, in 
xm_vcpu_pin
  File "usr/lib/python2.4/site-packages/xen/xm/main.py", line 1467, in 
cpu_make_map
IndexError: string index out of range


------------------------------------------------

# HG changeset patch
# User Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
# Date 1270783370 -28800
# Node ID 3c5685e957d1dae49988e401d988e7400319773d
# Parent  3376c90960e83d9f1e34d51601a930290a128c09
xm: Fix string index out of range in 'vcpu-pin' command

if <PCPUs> contins '' (e.g. '1,,2'), error 'string index out of range'
occurs. Fix this trivial bug.

Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>

diff -r 3376c90960e8 -r 3c5685e957d1 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Apr 07 10:17:27 2010 +0100
+++ b/tools/python/xen/xm/main.py       Fri Apr 09 11:22:50 2010 +0800
@@ -1458,6 +1458,8 @@
     def cpu_make_map(cpulist):
         cpus = []
         for c in cpulist.split(','):
+            if c == '':
+                continue
             if c.find('-') != -1:
                 (x,y) = c.split('-')
                 for i in range(int(x),int(y)+1):



_______________________________________________
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®.