* support proper scsi disk name

* xvd now has an official lanana assigned major, use it

Signed-off-by: Jeremy Katz <katzj@redhat.com>
This commit is contained in:
smh22@firebug.cl.cam.ac.uk committed 2005-08-02 09:29:56 +00:00
1 parent 375d3c927f
commit 8dbafbfdcc
1 file changed
+5 -2
+5 -2
View File
@@ -24,8 +24,8 @@ def blkdev_name_to_number(name):
log.debug("exception looking up device number for %s: %s", name, ex)
pass
if re.match( '/dev/sd[a-p]([0-9]|1[0-5])', n):
return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
if re.match( '/dev/sd[a-p]([1-9]|1[0-5])?', n):
return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:] or 0)
if re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
ide_majors = [ 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 ]
@@ -33,6 +33,9 @@ def blkdev_name_to_number(name):
minor = ((ord(n[7:8]) - ord('a')) % 2) * 64 + int(n[8:] or 0)
return major * 256 + minor
if re.match( '/dev/xvd[a-p]([1-9]|1[0-5])?', n):
return 202 * 256 + 16 * (ord(n[8:9]) - ord('a')) + int(n[9:] or 0)
# see if this is a hex device number
if re.match( '^(0x)?[0-9a-fA-F]+$', name ):
return string.atoi(name,16)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.