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

Re: Status of LVM/RAID in d-i?tatus is. How well has the new code been tested?



On Wed, Jun 14, 2006 at 11:40:00AM +0200, Frans Pop wrote:
1. partman-auto-lvm no longer works
If I choose that option there is no error, but nothing actually happens. After some time the main partitioning screen is shown, but no new partitions have been created.

And here's the patch that should get it working again. It turns out that vg_get_info and pv_get_info did not return proper exit codes

Re,
David
Index: lvm_tools.sh
===================================================================
--- lvm_tools.sh	(revision 38092)
+++ lvm_tools.sh	(working copy)
@@ -22,16 +22,20 @@
 
 # Convenience wrapper for lvs/pvs/vgs
 lvm_get_info() {
-	local type info device
+	local type info device output
 	type=$1
 	info=$2
 	device=$3
 
-	$type --noheadings --nosuffix --separator ":" --units M \
-		-o "$info" $device 2> /dev/null | \
-		sed -e 's/^[:[:space:]]\+//g;s/[:[:space:]]\+$//g'
+	output=$($type --noheadings --nosuffix --separator ":" --units M \
+		-o "$info" $device 2> /dev/null)
+	if [ $? -ne 0 ]; then
+		return 1
+	fi
+	echo "$output" | sed -e 's/^[:[:space:]]\+//g;s/[:[:space:]]\+$//g'
 	# NOTE: The last sed, s/:$// is necessary due to a bug in lvs which adds a
 	#       trailing separator even if there is only one field
+	return 0
 }
 
 # Converts a list of space (or newline) separated values to comma separated values
@@ -133,10 +137,13 @@
 
 # Get info on a PV
 pv_get_info() {
-	local info=$(lvm_get_info pvs pv_size,pv_pe_count,pv_free,pv_pe_alloc_count,vg_name "$1")
+	local info
+
+	info=$(lvm_get_info pvs pv_size,pv_pe_count,pv_free,pv_pe_alloc_count,vg_name "$1")
 	if [ $? -ne 0 ]; then
 		return 1
 	fi
+
 	SIZE=$(echo "$info"   | cut -d':' -f1 | cut -d'.' -f1)
 	SIZEPE=$(echo "$info" | cut -d':' -f2)
 	FREE=$(echo "$info"   | cut -d':' -f3 | cut -d'.' -f1)
@@ -272,10 +279,13 @@
 
 # Get VG info
 vg_get_info() {
-	local info=$(lvm_get_info vgs vg_size,vg_extent_count,vg_free,vg_free_count,lv_count,pv_count "$1")
+	local info
+
+	info=$(lvm_get_info vgs vg_size,vg_extent_count,vg_free,vg_free_count,lv_count,pv_count "$1")
 	if [ $? -ne 0 ]; then
 		return 1
 	fi
+
 	SIZE=$(echo "$info"   | cut -d':' -f1 | cut -d'.' -f1)
 	SIZEPE=$(echo "$info" | cut -d':' -f2)
 	FREE=$(echo "$info"   | cut -d':' -f3 | cut -d'.' -f1)

Reply to: