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

Bug#245704: [PATCH] LVM on Software RAID



Here is a patch to pass on the code I've been working on for this problem.

Part is for lvmcfg and most for partman-lvm.

I have no local udeb repositary so I have not tested this by building the
udebs. I have however patched the ramdisk in memory then run partman from
the "expert" menu... this seems to work!

Anyway here is the diff... comments welcome!

NB: the snv patch was made from debian-installer/packages/

Alex Owen
Index: lvmcfg/lvmcfg.sh
===================================================================
--- lvmcfg/lvmcfg.sh	(revision 22848)
+++ lvmcfg/lvmcfg.sh	(working copy)
@@ -148,6 +148,25 @@
 #
 get_pvs() {
 	PARTITIONS=""
+	if [ -f /tmp/lvm-marks ] ; then
+	    for i in `cat /tmp/lvm-marks` ; do
+		# skip already assigned
+		found=no
+		for pv in $(vgdisplay -v | grep "[ ]*PV Name" | sed -e "s/ \+PV Name \+//"); do
+			[ "$(realpath "$pv")" = "$(realpath "$i")" ] && found=yes
+		done
+		[ "$found" = "yes" ] && continue
+
+		addinfos_pv "$i"
+		i=`printf "%-15s (%s)" "$i" "$RET"`
+		
+		if [ -z "$PARTITIONS" ]; then
+			PARTITIONS="$i"
+		else
+			PARTITIONS="${PARTITIONS},$i"
+		fi
+	    done
+	else
 	for i in `/usr/lib/partconf/find-partitions --ignore-fstype 2>/dev/null | grep "[[:space:]]LVM[[:space:]]" | cut -f1`; do
 		# skip already assigned
 		found=no
@@ -165,6 +184,7 @@
 			PARTITIONS="${PARTITIONS},$i"
 		fi
 	done
+	fi
 }
 
 #
Index: partman/partman-lvm/choose_method/lvm/choices
===================================================================
--- partman/partman-lvm/choose_method/lvm/choices	(revision 22848)
+++ partman/partman-lvm/choose_method/lvm/choices	(working copy)
@@ -8,6 +8,9 @@
 cd $dev
 
 lvm=no
+if cat $dev/model | grep "Software RAID device" >/dev/null  ; then
+    lvm=yes
+fi
 open_dialog VALID_FLAGS $id
 while { read_line flag; [ "$flag" ]; }; do
     if [ "$flag" = lvm ]; then
Index: partman/partman-lvm/debian/rules
===================================================================
--- partman/partman-lvm/debian/rules	(revision 22848)
+++ partman/partman-lvm/debian/rules	(working copy)
@@ -25,6 +25,7 @@
 	debian/install-rc init.d
 	debian/install-rc undo.d
 	debian/install-rc update.d
+	debian/install-rc commit.d
 	dh_install parted_names lib/partman
 	rm -rf `find debian/$(PACKAGE) -name CVS`
 	rm -rf `find debian/$(PACKAGE) -name .svn`
Index: partman/partman-lvm/init.d/lvm
===================================================================
--- partman/partman-lvm/init.d/lvm	(revision 22848)
+++ partman/partman-lvm/init.d/lvm	(working copy)
@@ -6,6 +6,8 @@
 
 . /lib/partman/definitions.sh
 
+[ -f /tmp/lvm-marks ] && rm -f /tmp/lvm-marks
+
 pvscan >>/var/log/messages 2>&1
 vgscan >>/var/log/messages 2>&1
 
@@ -32,6 +34,9 @@
 
     for id in $partitions; do
 	lvm=no
+	if pvdisplay $(cat $dev/device) >/dev/null 2>&1 ; then 
+	    lvm=yes
+	fi
 	open_dialog GET_FLAGS $id
 	while { read_line flag; [ "$flag" ]; }; do
 	    if [ "$flag" = lvm ]; then
Index: partman/partman-lvm/commit.d/store_lvm_markers
===================================================================
--- partman/partman-lvm/commit.d/store_lvm_markers	(revision 0)
+++ partman/partman-lvm/commit.d/store_lvm_markers	(revision 0)
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+. /lib/partman/definitions.sh
+
+#enable_swap
+[ -f /tmp/lvm-marks ] && rm -f /tmp/lvm-marks
+
+for dev in $DEVICES/*; do
+    [ -d "$dev" ] || continue
+    cd $dev
+    partitions=
+    open_dialog PARTITIONS
+    while { read_line num id size type fs path name; [ "$id" ]; }; do
+        partitions="$partitions $id,$num"
+    done
+    close_dialog
+    
+    for part in $partitions; do
+        id=${part%,*}
+        num=${part#*,}
+	[ -f $id/method ] || continue
+	method=$(cat $id/method)
+	case $method in
+	    lvm)
+		open_dialog PARTITION_INFO $id
+		read_line x1 x2 x3 x4 x5 device x6
+		close_dialog
+		echo $device >>/tmp/lvm-marks
+		;;
+	esac
+    done
+done
+
+#disable_swap

Property changes on: partman/partman-lvm/commit.d/store_lvm_markers
___________________________________________________________________
Name: svn:executable
   + *


Reply to: