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

Bug#517935: Patches that should fix



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
	I have attached patches which I believe fix the problem; it requires the
min_size function to know which type of partitioning is being done (lvm or
default), which requires a few changes to other places than might be at first
obvious.

I have semi-tested this (playing with the shell scripts manually), but have
*not* tested this in an actual install setting (my netinst build skills are
limited and I'm still trying to figure that out).

This may not be the best way to solve it, and may not be complete, but it's
better than what's there now.

- --
Craig Miskell
Senior Systems Administrator
Opus International Consultants
Phone: +64 4 471 7209
That's it, I'm acting the way America acts best - Unilaterally.
    -Homer Simpson, on a roundabout in England

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkzkdM8ACgkQmDveRtxWqna74wCfffrFmoXsIe3mcBgpqpSZqYvp
j/8AnjGlUUbu4ySa4+U5gn94PLE1baAe
=51dK
-----END PGP SIGNATURE-----
diff -u3 -r partman-auto-93/lib/recipes.sh partman-auto-93.new/lib/recipes.sh
--- partman-auto-93/lib/recipes.sh	2010-05-28 16:00:23.000000000 +1200
+++ partman-auto-93.new/lib/recipes.sh	2010-11-18 12:27:42.000000000 +1300
@@ -159,10 +159,27 @@
 }
 
 min_size () {
-	local size
+	local size type
+	type=$1
+	ignore="${type:+${type}ignore}"
 	size=0
+	#When calculating the minimum required size, ignore partitions that
+	# we would otherwise be ignoring
+	#Also if we are doing LVM and this partition is supposed to be in
+	# a volume group, ignore it as we will have counted the min size of
+	# it's container already
+	# This means we could oversubscribe a container, but that's a separate issue
+	# that needs handling elsewhere
 	foreach_partition '
-		size=$(($size + $1))'
+		if [ "$ignore" ] && [ "$(echo $partition | grep "$ignore")" ]; then
+			:
+		else
+			if [ "$type" = "lvm" ] && [ "$(echo $partition | grep in_vg)" ]; then
+				:
+			else
+				size=$(($size + $1))
+			fi
+		fi'
 	echo $size
 }
 
@@ -316,11 +333,11 @@
 	if [ ! -z "$RET" ] && [ -e "$RET" ]; then
 		recipe="$RET"
 		decode_recipe $recipe $type
-		if [ $(min_size) -le $free_size ]; then
+		if [ $(min_size $type) -le $free_size ]; then
 			return 0
 		else
 			logger -t partman-auto \
-			"Available disk space ($free_size) too small for expert recipe ($(min_size)); skipping"
+			"Available disk space ($free_size) too small for expert recipe ($(min_size $type)); skipping"
 		fi
 	fi
 
@@ -333,7 +350,7 @@
 	for recipe in $recipedir/*; do
 		[ -f "$recipe" ] || continue
 		decode_recipe $recipe $type
-		if [ $(min_size) -le $free_size ]; then
+		if [ $(min_size $type) -le $free_size ]; then
 			choices="${choices}${recipe}${TAB}${name}${NL}"
 			if [ "$default_recipe" = no ]; then
 				default_recipe="$recipe"
@@ -366,10 +383,12 @@
 }
 
 expand_scheme() {
+	local type
+	$type=$1
 	# Make factors small numbers so we can multiply on them.
 	# Also ensure that fact, max and fs are valid
 	# (Ofcourse in valid recipes they must be valid.)
-	factsum=$(($(factor_sum) - $(min_size)))
+	factsum=$(($(factor_sum) - $(min_size $type)))
 	if [ $factsum -eq 0 ]; then
 		factsum=100
 	fi
@@ -396,7 +415,7 @@
 	while [ "$scheme" != "$oldscheme" ]; do
 		oldscheme="$scheme"
 		factsum=$(factor_sum)
-		unallocated=$(($free_size - $(min_size)))
+		unallocated=$(($free_size - $(min_size $type)))
 		if [ $unallocated -lt 0 ]; then
 			unallocated=0
 		fi
diff -u3 -r partman-auto-93/perform_recipe partman-auto-93.new/perform_recipe
--- partman-auto-93/perform_recipe	2010-04-22 16:00:38.000000000 +1200
+++ partman-auto-93.new/perform_recipe	2010-11-18 12:29:28.000000000 +1300
@@ -31,7 +31,7 @@
 
 db_progress STEP 1
 
-expand_scheme
+expand_scheme default
 
 ensure_primary
 
diff -U3 -r partman-auto-lvm-36/lib/auto-lvm.sh partman-auto-lvm-36.new/lib/auto-lvm.sh
--- partman-auto-lvm-36/lib/auto-lvm.sh	2010-01-23 01:05:22.000000000 +1300
+++ partman-auto-lvm-36.new/lib/auto-lvm.sh	2010-11-18 12:30:58.000000000 +1300
@@ -26,7 +26,7 @@
 	get_last_free_partition_infos $dev
 	free_size=$(convert_to_megabytes $free_size)
 
-	expand_scheme
+	expand_scheme lvm
 
 	ensure_primary
 
diff -U3 -r partman-auto-lvm-36/perform_recipe_by_lvm partman-auto-lvm-36.new/perform_recipe_by_lvm
--- partman-auto-lvm-36/perform_recipe_by_lvm	2010-11-18 12:31:38.000000000 +1300
+++ partman-auto-lvm-36.new/perform_recipe_by_lvm	2010-11-18 12:30:43.000000000 +1300
@@ -52,7 +52,7 @@
 
 db_progress STEP 1
 
-expand_scheme
+expand_scheme lvm
 
 db_progress STEP 1
 

Attachment: partman-auto.patch.sig
Description: Binary data

Attachment: partman-auto-lvm.patch.sig
Description: Binary data


Reply to: