xend: fix empty 'cpus' parsing
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 14 Dec 2009 07:59:12 +0000 (07:59 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 14 Dec 2009 07:59:12 +0000 (07:59 +0000)
/etc/xen/xmexample.hvm says "" means "leave to Xen to pick", but we
get a "Error: string index out of range" currently.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
tools/python/xen/xend/XendConfig.py

index a79dfe586416250fdf1034b6ae6c15441a903f0b..7869611e87e5814952e06e24206e3ee8f2712548 100644 (file)
@@ -577,6 +577,8 @@ class XendConfig(dict):
         #    "0-3,^1"   -> [0,2,3]
         #    "0-3,^1,1" -> [0,1,2,3]
         l = []
+        if s == "":
+            return l
         for c in s.split(','):
             if c.find('-') != -1:
                 (x, y) = c.split('-')