Skip to contentSkip to conversation

Support for official xvd major (resend)

PATCH New Jeremy Katz 1 participant 1 message Aug 1, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support for official xvd major (resend)

The actual patch got lost in the discussion about whether or not it makes sense to pass the major/minor from dom0. Since we're still doing so, this patch is still needed to use the official LANANA major/minor for xvd devices.

It also fixes the regex for scsi disks.

Jeremy

# HG changeset patch
# User [email protected]
# Node ID 974ff5b2329a6e544202b1d6806455abbd8243b8 # Parent b5bf769f2c228a9a00b88b8e62719f58eb58726e
* support proper scsi disk name
* xvd now has an official lanana assigned major, use it

tools/python/xen/util/blkif.py +5 -2
diff -r b5bf769f2c22 -r 974ff5b2329a tools/python/xen/util/blkif.py
@@ -24,14 +24,17 @@
         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 ]
         major = ide_majors[(ord(n[7:8]) - ord('a')) / 2]
         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 ):

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel