Bug#474556: partman-base: Please include XEN virtual device recognition
Ian Campbell <ijc@hellion.org.uk> writes:
> 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.
Exactly. The first device is "XEN virtual disk 1" for me. It would
be 0 for you.
> * You refer to "XEN" which I think should be "Xen" (no need to
> shout).
You are right, I thought it was an acronym. Of course it is not.
Updated patch attached.
> Otherwise the patch looks good and I can confirm that it works.
Thanks,
Feri.
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,'`
Reply to: