[linux-lvm] [PATCH 22/35] fsadm: Add LVOL_PREFIX configuration option

Lukas Czerner lczerner at redhat.com
Wed Sep 21 16:45:41 UTC 2011


This commit adds new configuration option LVOL_PREFIX which defines a
prefix for new logical volumes. The prefix will be concatenated with a
sequential number of the logical volume.

Signed-off-by: Lukas Czerner <lczerner at redhat.com>
---
 scripts/fsadm.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index a66abd1..63600eb 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -776,9 +776,9 @@ create() {
 		tmp=$(mktemp)
 		$LVM lvs $vgname --separator ' ' --noheadings > $tmp
 		for i in $(seq -w $MAX_VGS); do
-			$GREP -e " lvol${i} " $tmp &> /dev/null
+			$GREP -e " ${LVOL_PREFIX}${i} " $tmp &> /dev/null
 			if [ $? -ne 0 ]; then
-				name="lvol${i}"
+				name="${LVOL_PREFIX}${i}"
 				lvname="--name $name"
 				break;
 			fi
@@ -1285,12 +1285,14 @@ check() {
 
 set_default_config() {
 	[ -z "$DEFAULT_POOL" ] && DEFAULT_POOL="default_pool"
+	[ -z "$LVOL_PREFIX" ] && LVOL_PREFIX="lvol"
 }
 
 parse_config() {
 	for line in $(cat $1); do
 		case "$line" in
 		  "DEFAULT_POOL"*) DEFAULT_POOL=${line##*=} ;;
+		  "LVOL_PREFIX"*) LVOL_PREFIX=${line##*=} ;;
 		  "#"*) continue ;;
 		  *) error "Unknown value \"$line\" in configuration file"
 		esac
-- 
1.7.4.4




More information about the linux-lvm mailing list