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

Re: preliminary patch towards XEN virtual disk naming



Ferenc Wagner <wferi@niif.hu> writes:

> So here's something to discuss.  This is how it used to look like:

OMG, something totally unrelated sneaked into the attached patch,
consider this instead:

Index: packages/partman/partman-base/debian/partman-base.templates
===================================================================
--- packages/partman/partman-base/debian/partman-base.templates	(revision 52428)
+++ packages/partman/partman-base/debian/partman-base.templates	(working copy)
@@ -336,6 +336,18 @@
 # :sl5:
 _Description: DASD %s (%s), partition #%s
 
+Template: partman/text/xen_virtual_disk
+Type: text
+# eg. XEN virtual disk 1 (xvda)
+# :sl4:
+_Description: XEN virtual disk %s (%s)
+
+Template: partman/text/xen_virtual_partition
+Type: text
+# eg. XEN virtual disk 1, partition #1 (xvda1)
+# :sl4:
+_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 52428)
+++ packages/partman/partman-base/lib/base.sh	(working copy)
@@ -806,6 +806,21 @@
 	    disk="${1#/dev/}"
 	    humandev_dasd_disk /sys/block/$disk/$(readlink /sys/block/$disk/device)
 	    ;;
+	/dev/xvd[a-z])
+	    drive=$(printf '%d' "'$(echo $1 | sed 's,^/dev/xvd\([a-z]\).*,\1,')")
+	    drive=$(($drive - 96))
+	    linux=${1#/dev/}
+	    db_metaget partman/text/xen_virtual_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 - 96))
+	    part=$(echo $1 | sed 's,^/dev/xvd[a-z]\([0-9][0-9]*\).*,\1,')
+	    linux=${1#/dev/}
+	    db_metaget partman/text/xen_virtual_partition description
+	    printf "$RET" "$drive" "$part" "$linux"
+	    ;;
 	*)
 	    # Check if it's an LVM1 device
 	    vg=`echo "$1" | sed -e 's,/dev/\([^/]\+\).*,\1,'`
>  * libparted should also recognize the device type, which isn't much
>    of a problem (based on a cursory look at the sources).  But that
>    would just duplicate the info on the line at best.  Probably
>    something else is needed...  But what?

Current git parted alread recognizes such devices as "Xen Virtual
Block Device".  Which is basically the content of the above template.
What's customary in this case?
-- 
Thanks,
Feri.

Reply to: