Re: Automatic partition setup in partman-{lvm,md,crypto}

2009-07-30 Thread Max Vozeler
On Tue, Jul 28, 2009 at 07:47:14PM +0100, Colin Watson wrote:
 Otavio told me that you and he and Joey had agreed it would be a good
 idea to upload what we have in trunk now and refine from there. Your
 patches look basically along the right lines - I'll review them when I
 have a chance ...

I found some time to test the cleanups, and since they appeared
to work with no obvious problems, I went ahead and committed them 
to trunk. Review very much appreciated when you find the time.

Max


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: Automatic partition setup in partman-{lvm,md,crypto}

2009-07-28 Thread Colin Watson
On Sun, Jul 26, 2009 at 01:47:52PM +0200, Max Vozeler wrote:
 On Thu, Jul 23, 2009 at 02:58:12PM +0100, Colin Watson wrote:
  Talking through this with Max Vozeler identified several problems that
  I'd still like to fix:
  
   * There are several common chunks of code that should be moved into
 partman-base.
 
 I think I'll be working on some of that today. Expect RFC 
 patches after lunch. :-)

Thanks, much appreciated. :-)

Otavio told me that you and he and Joey had agreed it would be a good
idea to upload what we have in trunk now and refine from there. Your
patches look basically along the right lines - I'll review them when I
have a chance ...

-- 
Colin Watson   [cjwat...@debian.org]


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: Automatic partition setup in partman-{lvm,md,crypto}

2009-07-26 Thread Max Vozeler
On Thu, Jul 23, 2009 at 02:58:12PM +0100, Colin Watson wrote:
 Talking through this with Max Vozeler identified several problems that
 I'd still like to fix:
 
  * There are several common chunks of code that should be moved into
partman-base.

I think I'll be working on some of that today. Expect RFC 
patches after lunch. :-)

  * There's some weird bug in handling of locked devices; the LVM menu,
at least, offers the underlying devices of configured encrypted
volumes when it shouldn't.

That's fixed now in trunk.

 If you'd like to try this out, then I guess a reasonable way to do so
 would be to play with a current Ubuntu installation image:

For people wanting to try it out, there is also a i386 image
with the changes as they currently exist in trunk:

 http://people.debian.org/~xam/d-i/partman-newui_i386.iso

Max


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: Automatic partition setup in partman-{lvm,md,crypto}

2009-07-25 Thread Colin Watson
On Thu, Jul 23, 2009 at 02:58:12PM +0100, Colin Watson wrote:
 I was showing this to a few people at DebConf and people seemed
 generally in favour of the UI changes, so I thought I'd post it for
 wider comment here.

Max tested this and found a few bugs, which we fixed between us. He
suggested that we just go ahead and put this on trunk so that we can
continue working on it there (no need to upload it for alpha 1, though),
so I've done that.

-- 
Colin Watson   [cjwat...@ubuntu.com]


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Automatic partition setup in partman-{lvm,md,crypto}

2009-07-23 Thread Colin Watson
I was showing this to a few people at DebConf and people seemed
generally in favour of the UI changes, so I thought I'd post it for
wider comment here.

The process of setting up complex block devices (LVM, RAID, crypto) in
partman is currently rather tedious. You have to separately edit each
partition you want to use as a physical volume, change its Use as:
field, and then a Configure foo menu item appears that lets you
assemble the physical volumes. This is very cumbersome, and it also has
discoverability problems - if your goal is to set up LVM, you can't even
see the menu item that lets you do that until you're part-way through
the process.

I'd like to introduce an alternative way to do this that's more
goal-oriented: in other words, I'd like people to be able to select
Configure the Logical Volume Manager, select from a menu of all the
partitions that *could* be used as LVM PVs, and have partman-lvm
automatically set them up for them.

The attached set of three patches implements this for each of
partman-lvm, partman-md, and partman-crypto. In the case of
partman-crypto, I had to add a menu, which both brings it into line with
LVM and RAID and will allow adding a way to deconfigure encrypted
volumes in the future (#381892). The partman-md patch is rather
complicated because I had to cope with the way it trims partitions
already selected as active devices when prompting for spare devices; the
code in this patch is the result of several attempts, and most of my
previous attempts had much twistier uses of IFS that I eventually
rejected.

Talking through this with Max Vozeler identified several problems that
I'd still like to fix:

 * There are several common chunks of code that should be moved into
   partman-base.
 * It'd be nice to show more detail in the partition menus, especially
   including a status field and the mountpoint. We can't quite reuse the
   standard partition tree as this relies on a separate line to identify
   the disk device, which doesn't really work here, but we could do
   something similar.
 * There's some weird bug in handling of locked devices; the LVM menu,
   at least, offers the underlying devices of configured encrypted
   volumes when it shouldn't.
 * Max suggests that we might exclude partitions with mountpoints to
   reduce the probability of mistakes. This seems to make sense - d-i
   doesn't automatically set up mountpoints, so if a partition has a
   mountpoint then it's because the user deliberately gave it one.

If you'd like to try this out, then I guess a reasonable way to do so
would be to play with a current Ubuntu installation image:

  http://cdimage.ubuntu.com/releases/karmic/alpha-3/
(alpha release produced today, CD-sized; use the server option)
  http://cdimage.ubuntu.com/ubuntu-server/daily/current/
(server daily build, may be arbitrarily broken)
  http://cdimage.ubuntu.com/netboot/karmic/
(netboot images, may be arbitrarily broken though usually not too
bad)

Thanks,

-- 
Colin Watson   [cjwat...@ubuntu.com]
=== modified file 'choose_method/lvm/choices'
--- choose_method/lvm/choices	2007-12-05 20:18:24 +
+++ choose_method/lvm/choices	2009-07-13 21:40:14 +
@@ -1,45 +1,11 @@
 #!/bin/sh
 
-. /lib/partman/lib/base.sh
+. /lib/partman/lib/lvm-base.sh
 
 dev=$1
 id=$2
 
-cd $dev
-
-lvm=no
-if grep -q /dev/md $dev/device; then
-	# LVM on software RAID
-	lvm=yes
-elif grep -q /dev/mapper/ $dev/device; then
-	# LVM on device-mapper crypto
-	if type dmsetup /dev/null 21; then
-		device=$(cat $dev/device)
-		if [ $(dmsetup status $device | cut -d' ' -f3) = crypt ]; then
-			lvm=yes
-		fi
-	fi
-fi
-
-# sparc can not have LVM starting at 0 or it will destroy the partition table
-if [ $(udpkg --print-architecture) = sparc ]  \
-   [ ${id%%-*} = 0 ]  [ $lvm = no ]; then
-exit 0
-fi
-
-if [ $lvm = no ]; then
-	open_dialog VALID_FLAGS $id
-	while { read_line flag; [ $flag ]; }; do
-		if [ $flag = lvm ]; then
-			lvm=yes
-		fi
-	done
-	close_dialog
-fi
-
-if [ $lvm = no ]; then
-	exit 0
-fi
+pv_allowed $dev $id || exit 0
 
 db_metaget partman/method_long/lvm description
 

=== modified file 'choose_partition/lvm/choices'
--- choose_partition/lvm/choices	2007-12-05 20:18:57 +
+++ choose_partition/lvm/choices	2009-07-09 09:42:49 +
@@ -3,8 +3,9 @@
 . /usr/share/debconf/confmodule
 . /lib/partman/lib/lvm-base.sh
 
-# Only show menu option if there is at least one LVM PV
-[ $(pv_list | wc -l) -gt 0 ] || exit 0
+# Only show menu option if there is at least one partition that can be used
+# as an LVM PV
+[ $(pv_list_allowed | wc -l) -gt 0 ] || exit 0
 
 db_metaget partman-lvm/text/configure_lvm description
 

=== modified file 'choose_partition/lvm/do_option'
--- choose_partition/lvm/do_option	2008-07-31 11:29:20 +
+++ choose_partition/lvm/do_option	2009-07-22 13:12:33 +
@@ -43,15 +43,32 @@ do_display() {
 }
 
 do_vg_create() {
-	local pvs pv output vg
+	local pvs line pv output vg pathmap
 	pvs=
+