[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#474556: partman-base: Please include XEN virtual device recognition



On Sun, 2008-04-06 at 16:06 +0200, Ferenc Wagner wrote:
> Here's a way to educate humandev about XEN virtual devices.
> It's kind of a substitute for parted support not yet present
> in libparted 1.7.1.

I've been using practically the same patch myself but hadn't got round
to submitting it yet. A couple of things I noticed: 
      * I subtract 97 from $drive and you subtract 96. It's too early in
        the morning for me to think about who is right. I guess it
        depends whether we normally count from 0 or 1. 
      * You refer to "XEN" which I think should be "Xen" (no need to
        shout).

Otherwise the patch looks good and I can confirm that it works.

Ian.
-- 
Ian Campbell

The bland leadeth the bland and they both shall fall into the kitsch.
Index: packages/partman/partman-base/debian/changelog
===================================================================
--- packages/partman/partman-base/debian/changelog	(revision 51905)
+++ packages/partman/partman-base/debian/changelog	(working copy)
@@ -19,8 +19,11 @@
     components have now been uploaded.
   * Change "initialise" to American English spelling (-ize).
 
- -- Frans Pop <fjp@debian.org>  Fri, 07 Mar 2008 21:13:18 +0100
+  [ Ian Campbell ]
+  * Support Xen Virtual Disk devices.
 
+-- Frans Pop <fjp@debian.org>  Fri, 07 Mar 2008 21:13:18 +0100
+
 partman-base (116) unstable; urgency=low
 
   [ Stephen R. Marenka ]
Index: packages/partman/partman-base/debian/partman-base.templates
===================================================================
--- packages/partman/partman-base/debian/partman-base.templates	(revision 51905)
+++ packages/partman/partman-base/debian/partman-base.templates	(working copy)
@@ -336,6 +336,16 @@
 # :sl5:
 _Description: DASD %s (%s), partition #%s
 
+Template: partman/test/xvd_disk
+Type: text
+# For example: Xen Virtual Disk 0 (xvda)
+_Description: Xen Virtual Disk %s (%s)
+
+Template: partman/test/xvd_partition
+Type: text
+# For example: Xen Virtual Disk 0, partition 1 (xvda)
+_Description: Xen Virtual Disk %s, partition %s (%s)
+
 Template: partman/text/cancel_menu
 Type: text
 # :sl1:
Index: packages/partman/partman-base/lib/base.sh
===================================================================
--- packages/partman/partman-base/lib/base.sh	(revision 51905)
+++ packages/partman/partman-base/lib/base.sh	(working copy)
@@ -605,6 +605,21 @@
 	    fi
 	    printf "$RET" "$(($drive / 2 + 1))" "$part" "$linux"
 	    ;;
+	/dev/xvd[a-z])
+	    drive=$(printf '%d' "'$(echo $1 | sed 's,^/dev/xvd\([a-z]\).*,\1,')")
+	    drive=$(($drive - 97))
+	    linux=${1#/dev/}
+	    db_metaget partman/test/xvd_disk description
+	    printf "$RET" "${drive}" "${linux}"
+	    ;;
+	/dev/xvd[a-z][0-9]*)
+	    drive=$(printf '%d' "'$(echo $1 | sed 's,^/dev/xvd\([a-z]\).*,\1,')")
+	    drive=$(($drive - 97))
+	    part=$(echo $1 | sed 's,^/dev/xvd[a-z]\([0-9][0-9]*\).*,\1,')
+	    linux=${1#/dev/}
+	    db_metaget partman/test/xvd_partition description
+	    printf "$RET" "${drive}" "${part}" "${linux}"
+	    ;;
 	/dev/scsi/host*/bus*/target*/lun*/disc)
 	    host=`echo $1 | sed 's,/dev/scsi/host\(.*\)/bus.*/target.*/lun.*/disc,\1,'`
 	    bus=`echo $1 | sed 's,/dev/scsi/host.*/bus\(.*\)/target.*/lun.*/disc,\1,'`

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: