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

Re: preliminary patch towards XEN virtual disk naming



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).

Disk selection dialog now looks like:
  ┌────────────────────────┤ [!!] Partition disks ├─────────────────────────┐
  │                                                                         │ 
  │ Note that all data on the disk you select will be erased, but not       │ 
  │ before you have confirmed that you really want to make the changes.     │ 
  │                                                                         │ 
  │ Select disk to partition:                                               │ 
  │                                                                         │ 
  │                Virtual Disk 1 (xvda) - 8.6 GB Unknown                   │ 
  │                                                                         │ 
  │     <Go Back>                                                           │ 
  │                                                                         │ 
  └─────────────────────────────────────────────────────────────────────────┘ 
                                                                              


I've left any parted enhancements out for now, as you say they would be
a useful further specification in the future.

Perhaps it would be useful to name the templates
partman/text/virtual_disk_{,partition} or similar to enable sharing
under other virtualisation platforms?

Cheers,
Ian.

-- 
Ian Campbell

Over the shoulder supervision is more a need of the manager than the
programming task.
Index: debian/partman-base.templates
===================================================================
--- debian/partman-base.templates	(revision 52792)
+++ 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: Virtual Disk 1 (xvda)
+_Description: Virtual Disk %s (%s)
+
+Template: partman/test/xvd_partition
+Type: text
+# For example: Virtual Disk 1, partition 1 (xvda)
+_Description: Virtual Disk %s, partition %s (%s)
+
 Template: partman/text/cancel_menu
 Type: text
 # :sl1:
Index: lib/base.sh
===================================================================
--- lib/base.sh	(revision 52792)
+++ 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 - 96))
+	    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 - 96))
+	    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: