ia64/xen-unstable

changeset 17559:84a066b9e57a

Accept decimal block device IDs

Solaris uses a simple indexing scheme for block devices. Parts of xend
translate them as hexadecimal (such as block-attach), and decimal, or
unconverted, elsewhere (such as block-detach). Harmonise these
interfaces by allowing decimal specifications.

Also allow Solaris-style block device names.

Signed-off-by: John Levon <john.levon@sun.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 01 16:35:28 2008 +0100 (2008-05-01)
parents eb3437db158b
children 706395167701
files tools/python/xen/util/blkif.py
line diff
     1.1 --- a/tools/python/xen/util/blkif.py	Thu May 01 16:08:36 2008 +0100
     1.2 +++ b/tools/python/xen/util/blkif.py	Thu May 01 16:35:28 2008 +0100
     1.3 @@ -42,10 +42,12 @@ def blkdev_name_to_number(name):
     1.4      if re.match( '/dev/xvd[a-p]([1-9]|1[0-5])?', n):
     1.5          return 202 * 256 + 16 * (ord(n[8:9]) - ord('a')) + int(n[9:] or 0)
     1.6  
     1.7 -    # see if this is a hex device number
     1.8 -    if re.match( '^(0x)?[0-9a-fA-F]+$', name ):
     1.9 +    if re.match( '^(0x)[0-9a-fA-F]+$', name ):
    1.10          return string.atoi(name,16)
    1.11 -        
    1.12 +
    1.13 +    if re.match('^[0-9]+$', name):
    1.14 +        return string.atoi(name, 10)
    1.15 +
    1.16      return None
    1.17  
    1.18  def blkdev_segment(name):