Re: preliminary patch towards XEN virtual disk naming
Ian Campbell <ijc@hellion.org.uk> writes:
> On Sun, 2008-04-20 at 18:56 +0200, Frans Pop wrote:
>> On Tuesday 08 April 2008, Ian Campbell wrote:
>> > On Tue, 2008-04-08 at 20:35 +0200, Frans Pop wrote:
>> > > I would vote for starting the numbering at 1, not 0, as linking 1 to
>> > > xvda is most natural.
>> > >
>> > > One option would be to just
>> > > use "Virtual disk" in partman (without "Xen" before it). Then parted's
>> > > description would be a useful further specification of the type of
>> > > virtual disk.
>> >
>> > Both of those sound like reasonable ideas to me.
>>
>> Ian or Ferenc: could either of you please submit a final patch based on the
>> discussions so far (or point me to the one that should be used)?
>
> Lets go with this one. It counts the disks from 1 (==xvda) and simply
> calls it a "Virtual Disk" as suggested this has the advantage of not
> wrapping in various dialogs too (like the formatting partition one if I
> remember correctly).
I agree. However, you left out the translation sublevels from the
templates. And should we really capitalize Disk?
> I've left any parted enhancements out for now, as you say they would be
> a useful further specification in the future.
What do you mean here?
> Perhaps it would be useful to name the templates
> partman/text/virtual_disk_{,partition} or similar to enable sharing
> under other virtualisation platforms?
That would indeed make sense. What about this patch?
Index: packages/partman/partman-base/debian/partman-base.templates
===================================================================
--- packages/partman/partman-base/debian/partman-base.templates (revision 52539)
+++ packages/partman/partman-base/debian/partman-base.templates (working copy)
@@ -336,6 +336,18 @@
# :sl5:
_Description: DASD %s (%s), partition #%s
+Template: partman/text/virtual_disk
+Type: text
+# eg. Virtual disk 1 (xvda)
+# :sl4:
+_Description: Virtual disk %s (%s)
+
+Template: partman/text/virtual_partition
+Type: text
+# eg. Virtual disk 1, partition #1 (xvda1)
+# :sl4:
+_Description: 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 52539)
+++ 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/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/virtual_partition description
+ printf "$RET" "$drive" "$part" "$linux"
+ ;;
*)
# Check if it's an LVM1 device
vg=`echo "$1" | sed -e 's,/dev/\([^/]\+\).*,\1,'`
--
Feri.
Reply to: