ia64/xen-unstable

changeset 3442:565871eff231

bitkeeper revision 1.1159.170.96 (41e8fbeayXDKhR25_xBQP3hTDrVJbQ)

Symptom:
When using a udev-based dom0, if you try to create a domU with a virtual
sda device and you do not have a local scsi device xm create fails.

Fix:
When using udev, only the device nodes needed are made. The follow
patch changes Xend to return a device number based on:

http://www.lanana.org/docs/device-list/devices.txt

For sd and hd devices if stat() fails. It was tested against both 2.0.2
and 2.0.3.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
author iap10@labyrinth.cl.cam.ac.uk
date Sat Jan 15 11:18:02 2005 +0000 (2005-01-15)
parents cfb5f80fb23e
children 6d86ef2aeb06
files tools/python/xen/xend/server/blkif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/blkif.py	Fri Jan 14 17:52:01 2005 +0000
     1.2 +++ b/tools/python/xen/xend/server/blkif.py	Sat Jan 15 11:18:02 2005 +0000
     1.3 @@ -63,6 +63,12 @@ def blkdev_name_to_number(name):
     1.4          log.debug("exception looking up device number for %s: %s", name, ex)
     1.5  	pass
     1.6  
     1.7 +    if re.match( '/dev/sd[a-p]([0-9]|1[0-5])', n):
     1.8 +        return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
     1.9 +
    1.10 +    if re.match( '/dev/hd[a-p]([0-9]|[1-5][0-9]|6[0-3])', n):
    1.11 +        return 3 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])        
    1.12 +
    1.13      # see if this is a hex device number
    1.14      if re.match( '^(0x)?[0-9a-fA-F]+$', name ):
    1.15  	return string.atoi(name,16)