master - lvm: report error if options are set before command
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=56768ce36be4a63cda0...
Commit: 56768ce36be4a63cda0fec1d06ca061d39288135
Parent: 442d60842d2915f82bd19382b8e08d690243ddd0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 10 11:00:28 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 10 11:02:11 2017 -0500
lvm: report error if options are set before command
Previously, strange parsing errors were reported.
---
tools/lvmcmdline.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 3fa7de5..70371d0 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3438,6 +3438,11 @@ int lvm2_main(int argc, char **argv)
if (!alias && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
argv[1] = (char *)"help";
+ if (!alias && (*argv[1] == '-')) {
+ log_error("Specify options after a command: lvm [command] [options].");
+ return -1;
+ }
+
if (!(cmd = init_lvm(0, 0)))
return -1;
6 years, 10 months
master - lvm: run help from -h|--help
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=442d60842d2915f82bd...
Commit: 442d60842d2915f82bd19382b8e08d690243ddd0
Parent: e9a544b94281a500bf58930c63d15aedcde961ed
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 10 10:43:47 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 10 11:02:11 2017 -0500
lvm: run help from -h|--help
---
tools/lvmcmdline.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 1b7940f..3fa7de5 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3434,6 +3434,10 @@ int lvm2_main(int argc, char **argv)
if (!alias && argc > 1 && !strcmp(argv[1], "version"))
return lvm_return_code(version(NULL, argc, argv));
+ /* turn 'lvm -h' and 'lvm --help' into 'lvm help' */
+ if (!alias && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
+ argv[1] = (char *)"help";
+
if (!(cmd = init_lvm(0, 0)))
return -1;
@@ -3515,7 +3519,7 @@ int lvm2_main(int argc, char **argv)
ret = lvm_run_command(cmd, argc, argv);
if (ret == ENO_SUCH_CMD) {
- log_error("No such command. Try 'help'.");
+ log_error("No such command. Try 'lvm help'.");
goto out;
}
6 years, 10 months
master - tests: avoid using readarray
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e9a544b94281a500bf5...
Commit: e9a544b94281a500bf58930c63d15aedcde961ed
Parent: d71b738c171bfd93eabdca3c388a637a1aa55a6c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 10 17:40:31 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 17:40:31 2017 +0200
tests: avoid using readarray
Real bashman can live without readarray.
Support older tested machines with bash <4.0....
---
test/lib/check.sh | 6 ++-
test/shell/mirror-vgreduce-removemissing.sh | 63 +++++++++++++++++++++------
2 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 76015b8..a61eb81 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -98,7 +98,11 @@ mirror_images_on() {
local lv=$2
shift 2
local mimages=()
- readarray -t mimages <<< "$(get lv_field_lv_ "$vg" lv_name -a | grep "${lv}_mimage_" )"
+ local line
+
+ while IFS= read -r line ; do
+ mimages+=( "$line" )
+ done < <( get lv_field_lv_ "$vg" lv_name -a | grep "${lv}_mimage_" )
for i in "${mimages[@]}"; do
lv_on "$vg" "$i" "$1"
diff --git a/test/shell/mirror-vgreduce-removemissing.sh b/test/shell/mirror-vgreduce-removemissing.sh
index 2707059..4068f09 100644
--- a/test/shell/mirror-vgreduce-removemissing.sh
+++ b/test/shell/mirror-vgreduce-removemissing.sh
@@ -49,8 +49,10 @@ mimages_are_on_ ()
echo "Check if mirror images of $lv are on PVs" "${list_pvs[@]}"
printf "%s\n" "${list_pvs[@]}" | sort | uniq > out1
- get lv_field_lv_ "$vg" lv_name -a | grep "${lv}_mimage_" | tr -d [] | tee lvs_log
- readarray -t mimages < lvs_log
+ get lv_field_lv_ "$vg" lv_name -a | grep "${lv}_mimage_" | tee lvs_log
+ while IFS= read -r i ; do
+ mimages+=( "$i" )
+ done < lvs_log
for i in "${mimages[@]}"; do
echo "Checking $vg/$i"
@@ -161,7 +163,11 @@ test_3way_mirror_fail_1_()
mirrorlog_is_on_ $lv1 "$dev4"
eval aux disable_dev "\$dev$index"
vgreduce --removemissing --force $vg
- readarray -t list_pvs <<< "$(rest_pvs_ "$index" 3)"
+
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$index" 3 )
+
mimages_are_on_ "$lv1" "${list_pvs[@]}"
mirrorlog_is_on_ $lv1 "$dev4"
}
@@ -186,7 +192,10 @@ test_3way_mirror_fail_2_()
mimages_are_on_ $lv1 "$dev1" "$dev2" "$dev3"
mirrorlog_is_on_ $lv1 "$dev4"
- readarray -t list_pvs <<< "$(rest_pvs_ "$index" 3)"
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$index" 3 )
+
aux disable_dev "${list_pvs[@]}"
vgreduce --force --removemissing $vg
lv_is_linear_ $lv1
@@ -197,7 +206,11 @@ for n in $(seq 1 3); do
#COMM fail mirror images other than mirror image $(($n - 1)) of 3-way mirrored LV
prepare_lvs_
test_3way_mirror_fail_2_ $n
- readarray -t list_pvs <<< "$(rest_pvs_ "$n" 3)"
+
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$n" 3 )
+
recover_vg_ "${list_pvs[@]}"
done
@@ -215,10 +228,12 @@ test_3way_mirror_plus_1_fail_1_()
check mirror_images_on $vg $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
check mirror_log_on $vg $lv1 "$dev5"
eval aux disable_dev \$dev$index
- lvs -a -o +devices
vgreduce --removemissing --force $vg
- lvs -a -o+devices # $vg
- readarray -t list_pvs <<< "$(rest_pvs_ "$index" 4)"
+
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$index" 4 )
+
check mirror_images_on $vg $lv1 "${list_pvs[@]}"
check mirror_log_on $vg $lv1 "$dev5"
}
@@ -244,8 +259,11 @@ test_3way_mirror_plus_1_fail_3_()
lvconvert -m+1 $vg/$lv1 "$dev4"
check mirror_images_on $vg $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
check mirror_log_on $vg $lv1 "$dev5"
- lvs -a -o+devices $vg
- readarray -t list_pvs <<< "$(rest_pvs_ "$index" 4)"
+
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$index" 4 )
+
aux disable_dev "${list_pvs[@]}"
vgreduce --removemissing --force $vg
lvs -a -o+devices $vg
@@ -258,7 +276,11 @@ for n in $(seq 1 4); do
#COMM "fail mirror images other than mirror image $(($n - 1)) of 4-way (1 converting) mirrored LV"
prepare_lvs_
test_3way_mirror_plus_1_fail_3_ $n
- readarray -t list_pvs <<< "$(rest_pvs_ "$n" 4)"
+
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$n" 4 )
+
recover_vg_ "${list_pvs[@]}"
done
@@ -277,7 +299,11 @@ test_2way_mirror_plus_2_fail_1_()
mirrorlog_is_on_ $lv1 "$dev5"
eval aux disable_dev \$dev$n
vgreduce --removemissing --force $vg
- readarray -t list_pvs <<< "$(rest_pvs_ "$index" 4)"
+
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$index" 4 )
+
mimages_are_on_ "$lv1" "${list_pvs[@]}"
mirrorlog_is_on_ $lv1 "$dev5"
}
@@ -303,7 +329,12 @@ test_2way_mirror_plus_2_fail_3_()
lvconvert -m+2 $vg/$lv1 "$dev3" "$dev4"
mimages_are_on_ $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
mirrorlog_is_on_ $lv1 "$dev5"
- readarray -t list_pvs <<< "$(rest_pvs_ "$index" 4)"
+
+
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$index" 4 )
+
aux disable_dev "${list_pvs[@]}"
vgreduce --removemissing --force $vg
lvs -a -o+devices $vg
@@ -316,7 +347,11 @@ for n in $(seq 1 4); do
#COMM "fail mirror images other than mirror image $(($n - 1)) of 4-way (2 converting) mirrored LV"
prepare_lvs_
test_2way_mirror_plus_2_fail_3_ $n
- readarray -t list_pvs <<< "$(rest_pvs_ "$n" 4)"
+
+ list_pvs=(); while IFS= read -r line ; do
+ list_pvs+=( "$line" )
+ done < <( rest_pvs_ "$n" 4 )
+
recover_vg_ "${list_pvs[@]}"
done
6 years, 10 months
master - man: specify slow device when creating origin LV
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d71b738c171bfd93eab...
Commit: d71b738c171bfd93eabdca3c388a637a1aa55a6c
Parent: 7617e08c0398bbfef66a710e377884c0793afa56
Author: Eric Ren <zren(a)suse.com>
AuthorDate: Sun Jul 9 01:15:51 2017 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:58:33 2017 +0200
man: specify slow device when creating origin LV
Also make the slow device name consistent everywhere.
Signed-off-by: Eric Ren <zren(a)suse.com>
---
man/lvmcache.7_main | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/man/lvmcache.7_main b/man/lvmcache.7_main
index 1f29185..6672ad3 100644
--- a/man/lvmcache.7_main
+++ b/man/lvmcache.7_main
@@ -41,7 +41,7 @@ Create an LV or identify an existing LV to be the origin LV.
.I Example
.br
-# lvcreate -n lvol0 -L 100G vg
+# lvcreate -n lvol0 -L 100G vg /dev/slow
.SS 1. create CacheDataLV
@@ -199,7 +199,7 @@ pool sub-LVs redundant.
.I Example
.nf
0. Create an origin LV we wish to cache
-# lvcreate -L 10G -n lv1 vg /dev/slow_devs
+# lvcreate -L 10G -n lv1 vg /dev/slow
1. Create a 2-way RAID1 cache data LV
# lvcreate --type raid1 -m 1 -L 1G -n cache1 vg \\
6 years, 10 months
master - cleanup: fix some typos
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7617e08c0398bbfef66...
Commit: 7617e08c0398bbfef66a710e377884c0793afa56
Parent: 4c943710059e51b3730fea385b7bd8ef34beecb2
Author: Eric Ren <zren(a)suse.com>
AuthorDate: Sun Jul 9 01:21:38 2017 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:58:33 2017 +0200
cleanup: fix some typos
form -> from
accomodate -> accommodate
Signed-off-by: Eric Ren <zren(a)suse.com>
---
libdm/misc/dm-log-userspace.h | 2 +-
tools/command.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdm/misc/dm-log-userspace.h b/libdm/misc/dm-log-userspace.h
index 6418300..a770ae6 100644
--- a/libdm/misc/dm-log-userspace.h
+++ b/libdm/misc/dm-log-userspace.h
@@ -34,7 +34,7 @@
* opt = addr.nl_groups;
* setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt));
*
- * User-space will then wait to receive requests form the kernel, which it
+ * User-space will then wait to receive requests from the kernel, which it
* will process as described below. The requests are received in the form,
* ((struct dm_ulog_request) + (additional data)). Depending on the request
* type, there may or may not be 'additional data'. In the descriptions below,
diff --git a/tools/command.h b/tools/command.h
index a84e374..c2e3e6a 100644
--- a/tools/command.h
+++ b/tools/command.h
@@ -150,7 +150,7 @@ struct cmd_rule {
/*
* Array sizes
*
- * CMD_RO_ARGS needs to accomodate a list of options,
+ * CMD_RO_ARGS needs to accommodate a list of options,
* of which one is required after which the rest are
* optional.
*/
6 years, 10 months
master - comment: update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4c943710059e51b3730...
Commit: 4c943710059e51b3730fea385b7bd8ef34beecb2
Parent: d23a475c98fae1a24111a0b4667bdaf5166ccde2
Author: Eric Ren <zren(a)suse.com>
AuthorDate: Sun Jul 9 01:15:49 2017 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:58:01 2017 +0200
comment: update
Use 'is' for both forms.
---
lib/metadata/lv_manip.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index fbe0aed..0b90705 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7310,7 +7310,7 @@ static int _vg_check_features(struct volume_group *vg,
* If lp->thin OR lp->activate is AY*, activate the pool if not already active.
* If lp->thin, create thin LV within the pool - as a snapshot if lp->snapshot.
* If lp->activate is AY*, activate it.
- * If lp->activate was AN* and the pool was originally inactive, deactivate it.
+ * If lp->activate is AN* and the pool was originally not active, deactivate it.
*/
static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
struct lvcreate_params *lp,
6 years, 10 months
master - tests: using prepare_vg
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d23a475c98fae1a2411...
Commit: d23a475c98fae1a24111a0b4667bdaf5166ccde2
Parent: dafeb0274acae432054faf729510133780db9439
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jul 9 15:55:10 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: using prepare_vg
---
test/shell/lvmetad-dump.sh | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/test/shell/lvmetad-dump.sh b/test/shell/lvmetad-dump.sh
index 3260b73..8c9e74f 100644
--- a/test/shell/lvmetad-dump.sh
+++ b/test/shell/lvmetad-dump.sh
@@ -16,12 +16,11 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
-aux prepare_pvs 2
-vgcreate $vg1 "$dev1" "$dev2"
-lvcreate -n bar -l 1 $vg1
+aux prepare_vg 2
+lvcreate -n bar -l 1 $vg
aux lvmetad_dump | tee lvmetad.txt
-grep $vg1 lvmetad.txt
+grep $vg lvmetad.txt
-vgremove -ff $vg1
+vgremove -ff $vg
6 years, 10 months
master - tests: assign path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dafeb0274acae432054...
Commit: dafeb0274acae432054faf729510133780db9439
Parent: f818a83a1dea3d67ad4bc710ed0552a7175b38d7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jul 9 15:54:43 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: assign path
---
test/shell/lvconvert-repair-mirror.sh | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/test/shell/lvconvert-repair-mirror.sh b/test/shell/lvconvert-repair-mirror.sh
index dcd8d07..0277221 100644
--- a/test/shell/lvconvert-repair-mirror.sh
+++ b/test/shell/lvconvert-repair-mirror.sh
@@ -13,12 +13,10 @@
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
-MKFS=mkfs.ext3
-MOUNT_DIR=mnt
-
. lib/inittest
-which "$MKFS" || skp
+MOUNT_DIR=mnt
+MKFS=$(which mkfs.ext3) || skip
cleanup_mounted_and_teardown()
{
6 years, 10 months
master - tests: fix array usage
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f818a83a1dea3d67ad4...
Commit: f818a83a1dea3d67ad4bc710ed0552a7175b38d7
Parent: 85e5a8803cee25aa676d30b478e9a3bd02c7d9ca
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jul 8 22:29:50 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: fix array usage
Use bash arrays to pass devs.
---
test/shell/lvchange-raid-transient-failures.sh | 6 +++---
test/shell/lvconvert-raid.sh | 15 ++++++++-------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/test/shell/lvchange-raid-transient-failures.sh b/test/shell/lvchange-raid-transient-failures.sh
index a478204..2ac14b0 100644
--- a/test/shell/lvchange-raid-transient-failures.sh
+++ b/test/shell/lvchange-raid-transient-failures.sh
@@ -32,14 +32,14 @@ function _check_raid
shift
local good=$1
shift
- local devs=$*
+ local devs=( "$@" )
aux wait_for_sync $vg $lv
- aux disable_dev --error --silent "$devs"
+ aux disable_dev --error --silent "${devs[@]}"
mkfs.ext4 "$DM_DEV_DIR/$vg/$lv"
fsck.ext4 -fn "$DM_DEV_DIR/$vg/$lv"
check raid_leg_status $vg $lv "$fail"
- aux enable_dev --silent "$devs"
+ aux enable_dev --silent "${devs[@]}"
lvs -a -o +devices $vg | tee out
not grep unknown out
lvchange --refresh $vg/$lv
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index b4ba4c9..c5e6159 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -21,10 +21,10 @@ export LVM_TEST_LVMETAD_DEBUG_OPTS=${LVM_TEST_LVMETAD_DEBUG_OPTS-}
get_image_pvs() {
local d
- local images
+ local images=()
- images=$(dmsetup ls | grep "${1}-${2}_.image_.*" | cut -f1 | sed -e s:-:/:)
- lvs --noheadings -a -o devices "$images" | sed s/\(.\)//
+ images=( $(dmsetup ls | grep "${1}-${2}_.image_.*" | cut -f1 | sed -e s:-:/:) )
+ lvs --noheadings -a -o devices "${images[@]}" | sed s/\(.\)//
}
########################################################
@@ -296,21 +296,22 @@ for i in {1..3}; do
for j in $(seq $(( i + 1 ))); do # The number of devs to replace at once
for o in $(seq 0 $i); do # The offset into the device list
- replace=""
+ replace=()
devices=( $(get_image_pvs $vg $lv1) )
for k in $(seq "$j"); do
index=$(( ( k + o ) % ( i + 1 ) ))
- replace="$replace --replace ${devices[$index]}"
+ replace+=( "--replace" )
+ replace+=( "${devices[$index]}" )
done
aux wait_for_sync $vg $lv1
if [ "$j" -ge $(( i + 1 )) ]; then
# Can't replace all at once.
- not lvconvert "$replace" $vg/$lv1
+ not lvconvert "${replace[@]}" $vg/$lv1
else
- lvconvert "$replace" $vg/$lv1
+ lvconvert "${replace[@]}" $vg/$lv1
fi
done
done
6 years, 10 months
master - tests: simplify and doublequote
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=85e5a8803cee25aa676...
Commit: 85e5a8803cee25aa676d30b478e9a3bd02c7d9ca
Parent: 1c9789b0ccabf95aae84d48d41322d8609ad8d51
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jul 8 18:23:07 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: simplify and doublequote
---
test/shell/system_id.sh | 290 +++++++++++++++++------------------------------
1 files changed, 102 insertions(+), 188 deletions(-)
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
index 9e53a26..b7e61a9 100644
--- a/test/shell/system_id.sh
+++ b/test/shell/system_id.sh
@@ -14,27 +14,30 @@ test_description='Test system_id'
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
+print_lvmlocal() {
+ { echo "local {"; printf "%s\n" "$@"; echo "}"; } >"$LVMLOCAL"
+}
+
. lib/inittest
aux prepare_devs 1
+SIDFILE="etc/lvm_test.conf"
+LVMLOCAL="etc/lvmlocal.conf"
+
# with clvm enabled, vgcreate with no -c option creates a clustered vg,
# which should have no system id
if [ -e LOCAL_CLVMD ]; then
SID1=sidfoolocal
SID2=""
-LVMLOCAL=etc/lvmlocal.conf
-rm -f $LVMLOCAL
-echo "local {" > $LVMLOCAL
-echo " system_id = $SID1" >> $LVMLOCAL
-echo "}" >> $LVMLOCAL
+print_lvmlocal " system_id = $SID1"
aux lvmconf "global/system_id_source = lvmlocal"
vgcreate $vg1 "$dev1"
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID2
+check vg_field $vg1 systemid "$SID2"
vgremove $vg1
-rm -f $LVMLOCAL
+rm -f "$LVMLOCAL"
exit 0
fi
@@ -45,74 +48,65 @@ fi
SID=""
aux lvmconf "global/system_id_source = none"
vgcreate $vg1 "$dev1"
-check vg_field $vg1 systemid $SID
+check vg_field $vg1 systemid "$SID"
vgremove $vg1
# FIXME - print 'life' config data
-eval $(lvmconfig global/etc 2>/dev/null || lvmconfig --type default global/etc)
+eval "$(lvmconfig global/etc 2>/dev/null || lvmconfig --type default global/etc)"
## machineid
-if [ -e $etc/machine-id ]; then
-SID=$(cat $etc/machine-id)
+if [ -e "$etc/machine-id" ]; then
+SID=$(cat "$etc/machine-id")
aux lvmconf "global/system_id_source = machineid"
vgcreate $vg1 "$dev1"
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID
+check vg_field $vg1 systemid "$SID"
vgremove $vg1
fi
## uname
SID1=$(uname -n)
-if [ -n $SID1 ]; then
+if [ -n "$SID1" ]; then
aux lvmconf "global/system_id_source = uname"
SID2=$(lvm systemid | awk '{ print $3 }')
vgcreate $vg1 "$dev1"
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID2
+check vg_field $vg1 systemid "$SID2"
vgremove $vg1
fi
## lvmlocal
SID=sidfoolocal
-LVMLOCAL=etc/lvmlocal.conf
-rm -f $LVMLOCAL
-echo "local {" > $LVMLOCAL
-echo " system_id = $SID" >> $LVMLOCAL
-echo "}" >> $LVMLOCAL
+print_lvmlocal " system_id = $SID"
aux lvmconf "global/system_id_source = lvmlocal"
vgcreate $vg1 "$dev1"
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID
+check vg_field $vg1 systemid "$SID"
vgremove $vg1
-rm -f $LVMLOCAL
+rm -f "$LVMLOCAL"
## file
SID=sidfoofile
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID" > $SIDFILE
+echo "$SID" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
vgcreate $vg1 "$dev1"
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID
+check vg_field $vg1 systemid "$SID"
vgremove $vg1
-rm -f $SIDFILE
# override system_id to create a foreign vg, then fail to use the vg
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg, overriding the local system_id so the vg looks foreign
-vgcreate --systemid $SID2 $vg1 "$dev1"
+vgcreate --systemid "$SID2" "$vg1" "$dev1"
# normal vgs is not an error and does not see the vg
vgs >err
not grep $vg1 err
@@ -127,20 +121,17 @@ grep $vg1 err
vgs --foreign $vg1 >err
grep $vg1 err
# change the local system_id to the second value, making the vg not foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
# we can now see and remove the vg
vgs $vg1 >err
grep $vg1 err
vgremove $vg1
-rm -f $SIDFILE
# create a vg, then change the local system_id, making the vg foreign
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -149,7 +140,7 @@ vgcreate $vg1 "$dev1"
vgs >err
grep $vg1 err
# change the local system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
# normal vgs doesn't see the vg
vgs >err
not grep $vg1 err
@@ -157,19 +148,16 @@ not grep $vg1 err
vgs --foreign >err
grep $vg1 err
# change the local system_id back to the first value, making the vg not foreign
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
vgs >err
grep $vg1 err
vgremove $vg1
-rm -f $SIDFILE
# create a vg, then change the vg's system_id, making it foreign
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -178,7 +166,7 @@ vgcreate $vg1 "$dev1"
vgs >err
grep $vg1 err
# change the vg's system_id, making the vg foreign
-echo "y" | vgchange --systemid $SID2 $vg1
+vgchange --yes --systemid "$SID2" $vg1
# normal vgs doesn't see the vg
vgs >err
not grep $vg1 err
@@ -186,11 +174,10 @@ not grep $vg1 err
vgs --foreign >err
grep $vg1 err
# change the local system_id to the second system_id so we can remove the vg
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
vgs >err
grep $vg1 err
vgremove $vg1
-rm -f $SIDFILE
# create a vg, create active lvs in it, change our system_id, making
# the VG foreign, verify that we can still see the foreign VG,
@@ -198,9 +185,7 @@ rm -f $SIDFILE
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -211,7 +196,7 @@ vgs >err
grep $vg1 err
check lv_exists $vg1 $lv1
# change our system_id, making the vg foreign, but accessible
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
vgs >err
grep $vg1 err
check lv_exists $vg1 $lv1
@@ -221,19 +206,16 @@ lvchange -an $vg1/$lv1
not lvremove $vg1/$lv1
not vgremove $vg1
# change our system_id back to match the vg so it's not foreign
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
vgs >err
grep $vg1 err
lvremove $vg1/$lv1
vgremove $vg1
-rm -f $SIDFILE
# local system has no system_id, so it can't access a vg with a system_id
SID1=sidfoofile1
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -247,19 +229,17 @@ aux lvmconf "global/system_id_source = file"
vgs >err
grep $vg1 err
vgremove $vg1
-rm -f $SIDFILE
# local system has a system_id, and can use a vg without a system_id
SID1=sidfoofile1
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
+rm -f "$SIDFILE"
# create a vg with no system_id
aux lvmconf "global/system_id_source = none"
vgcreate $vg1 "$dev1"
check vg_field $vg1 systemid ""
# set a local system_id
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# check we can see and use the vg with no system_id
@@ -268,14 +248,11 @@ grep $vg1 err
vgs $vg1 >err
grep $vg1 err
vgremove $vg1
-rm -f $SIDFILE
# vgexport clears system_id, vgimport sets system_id
SID1=sidfoofile1
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -283,26 +260,23 @@ vgcreate $vg1 "$dev1"
# normal vgs sees the vg
vgs -o+systemid >err
grep $vg1 err
-grep $SID1 err
+grep "$SID1" err
# after vgexport there is no systemid
vgexport $vg1
vgs -o+systemid >err
grep $vg1 err
-not grep $SID1 err
+not grep "$SID1" err
# after vgimport there is a systemid
vgimport $vg1
vgs -o+systemid >err
grep $vg1 err
-grep $SID1 err
+grep "$SID1" err
vgremove $vg1
-rm -f $SIDFILE
# vgchange -cy clears system_id, vgchange -cn sets system_id
SID1=sidfoofile1
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -310,33 +284,29 @@ vgcreate $vg1 "$dev1"
# normal vgs sees the vg
vgs -o+systemid >err
grep $vg1 err
-grep $SID1 err
+grep "$SID1" err
# after vgchange -cy there is no systemid
-echo "y" | vgchange -cy $vg1
+vgchange --yes -cy $vg1
vgs --config 'global { locking_type=0 }' -o+systemid $vg1 >err
grep $vg1 err
-not grep $SID1 err
+not grep "$SID1" err
# after vgchange -cn there is a systemid
vgchange --config 'global { locking_type=0 }' -cn $vg1
vgs -o+systemid >err
grep $vg1 err
-grep $SID1 err
+grep "$SID1" err
vgremove $vg1
-rm -f $SIDFILE
# Test max system_id length (128) and invalid system_id characters.
# The 128 length limit is imposed before invalid characters are omitted.
-SIDFILE=etc/lvm_test.conf
-
# 120 numbers followed by 8 letters (max len)
SID1=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abcdefgh
# 120 numbers followed by 9 letters (too long by 1 character, the last is omitted)
SID2=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abcdefghi
# max len system_id should appear normally
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -344,13 +314,11 @@ vgcreate $vg1 "$dev1"
# normal vgs sees the vg
vgs -o+systemid $vg1 >err
grep $vg1 err
-grep $SID1 err
+grep "$SID1" err
vgremove $vg1
-rm -f $SIDFILE
# max+1 len system_id should be missing the last character
-rm -f $SIDFILE
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -358,10 +326,9 @@ vgcreate $vg1 "$dev1"
# normal vgs sees the vg
vgs -o+systemid $vg1 >err
grep $vg1 err
-grep $SID1 err
-not grep $SID2 err
+grep "$SID1" err
+not grep "$SID2" err
vgremove $vg1
-rm -f $SIDFILE
# max len system_id containing an invalid character should appear without
# the invalid character
@@ -370,8 +337,7 @@ SID1=012345678901234567890123456789012345678901234567890123456789012345678901234
# After the invalid character is omitted from SID1
# The string is truncated to max length (128) before the invalid character is omitted
SID2=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abcdefg
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -382,15 +348,12 @@ grep $vg1 err
not grep $SID1 err
grep $SID2 err
vgremove $vg1
-rm -f $SIDFILE
# contains a bunch of invalid characters
SID1="?%$&A.@1]"
# SID1 without the invalid characters
SID2=A.1
-
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -398,10 +361,9 @@ vgcreate $vg1 "$dev1"
# normal vgs sees the vg
vgs -o+systemid $vg1 >err
grep $vg1 err
-not grep $SID1 err
-grep $SID2 err
+not grep "$SID1" err
+grep "$SID2" err
vgremove $vg1
-rm -f $SIDFILE
# pvs: pv in a foreign vg not reported
@@ -409,9 +371,7 @@ rm -f $SIDFILE
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -421,7 +381,7 @@ pvs >err
grep $vg1 err
grep "$dev1" err
# change the local system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
# normal pvs does not see the vg or pv
pvs >err
not grep $vg1 err
@@ -431,18 +391,16 @@ pvs --foreign >err
grep $vg1 err
grep "$dev1" err
# change the local system_id back so the vg can be removed
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
vgremove $vg1
-rm -f $SIDFILE
+rm -f "$SIDFILE"
# lvs: lvs in a foreign vg not reported
# lvs --foreign: lvs in a foreign vg are reported
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -454,7 +412,7 @@ lvs >err
grep $vg1 err
grep $lv1 err
# change the local system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
# normal lvs does not see the vg or lv
lvs >err
not grep $vg1 err
@@ -464,20 +422,17 @@ lvs --foreign >err
grep $vg1 err
grep $lv1 err
# change the local system_id back so the vg can be removed
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
lvremove $vg1/$lv1
vgremove $vg1
-rm -f $SIDFILE
+rm -f "$SIDFILE"
# use extra_system_ids to read a foreign VG
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-LVMLOCAL=etc/lvmlocal.conf
-rm -f $LVMLOCAL
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+rm -f "$LVMLOCAL"
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -486,7 +441,7 @@ vgcreate $vg1 "$dev1"
vgs >err
grep $vg1 err
# change the local system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
# normal vgs doesn't see the vg
vgs >err
not grep $vg1 err
@@ -494,20 +449,15 @@ not grep $vg1 err
vgs --foreign >err
grep $vg1 err
# add the first system_id to extra_system_ids so we can see the vg
-echo "local {" > $LVMLOCAL
-echo " extra_system_ids = [ $SID1" ] >> $LVMLOCAL
-echo "}" >> $LVMLOCAL
+print_lvmlocal " extra_system_ids = [ $SID1 ] "
vgs >err
grep $vg1 err
vgremove $vg1
-rm -f $SIDFILE
-rm -f $LVMLOCAL
+rm -f "$LVMLOCAL"
# vgcreate --systemid "" creates a vg without a system_id even if source is set
SID1=sidfoofile1
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -517,15 +467,13 @@ vgs >err
grep $vg1 err
# our system_id is not displayed for the vg
vgs -o+systemid >err
-not grep $SID1 err
+not grep "$SID1" err
vgremove $vg1
-rm -f $SIDFILE
+rm -f "$SIDFILE"
# vgchange --systemid "" clears the system_id on owned vg
SID1=sidfoofile1
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -543,17 +491,14 @@ vgs >err
grep $vg1 err
# the vg does not have our system_id
vgs -o+systemid >err
-not grep $SID1 err
+not grep "$SID1" err
vgremove $vg1
-rm -f $SIDFILE
# vgchange --systemid does not set the system_id on foreign vg
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $LVMLOCAL
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+rm -f "$LVMLOCAL"
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -562,7 +507,7 @@ vgcreate $vg1 "$dev1"
vgs >err
grep $vg1 err
# change the local system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
# normal vgs doesn't see the vg
vgs >err
not grep $vg1 err
@@ -574,17 +519,14 @@ not vgchange --yes --systemid "" $vg1
# cannot set the system_id of the foreign vg
not vgchange --yes --systemid foo $vg1
# change our system_id back so we can remove the vg
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
vgremove $vg1
-rm -f $SIDFILE
# vgcfgbackup backs up foreign vg with --foreign
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $LVMLOCAL
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+rm -f "$LVMLOCAL"
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg
@@ -593,7 +535,7 @@ vgcreate $vg1 "$dev1"
vgs >err
grep $vg1 err
# change the local system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
# normal vgs doesn't see the vg
vgs >err
not grep $vg1 err
@@ -601,10 +543,9 @@ not grep $vg1 err
not vgcfgbackup $vg1
vgcfgbackup --foreign $vg1
# change our system_id back so we can remove the vg
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
vgremove $vg1
-rm -f $SIDFILE
-
+rm -f "$SIDFILE"
# Test handling of bad system_id source configurations
@@ -612,7 +553,7 @@ rm -f $SIDFILE
# Look at the warning/error messages.
# vgcreate with source machineid, where no $etc/machine-id file exists
-if [ ! -e $etc/machine-id ]; then
+if [ ! -e "$etc/machine-id" ]; then
SID=""
aux lvmconf "global/system_id_source = machineid"
vgcreate $vg1 "$dev1" 2>&1 | tee err
@@ -634,62 +575,48 @@ vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
grep "No system ID found from system_id_source" err
vgremove $vg1
-rm -f $LVMLOCAL
# vgcreate with source lvmlocal, but no system_id = "x" entry
SID=""
-LVMLOCAL=etc/lvmlocal.conf
-rm -f $LVMLOCAL
-echo "local {" > $LVMLOCAL
-# echo " system_id = $SID" >> $LVMLOCAL
-echo "}" >> $LVMLOCAL
+print_lvmlocal # " system_id = $SID"
aux lvmconf "global/system_id_source = lvmlocal"
vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
grep "No system ID found from system_id_source" err
vgremove $vg1
-rm -f $LVMLOCAL
# vgcreate with source lvmlocal, and empty string system_id = ""
SID=""
-LVMLOCAL=etc/lvmlocal.conf
-rm -f $LVMLOCAL
-echo "local {" > $LVMLOCAL
-echo " system_id = \"\"" >> $LVMLOCAL
-echo "}" >> $LVMLOCAL
+print_lvmlocal " system_id = \"\""
aux lvmconf "global/system_id_source = lvmlocal"
vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID
+check vg_field $vg1 systemid "$SID"
grep "No system ID found from system_id_source" err
vgremove $vg1
rm -f $LVMLOCAL
# vgcreate with source file, but no system_id_file config
SID=""
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
+rm -f "$SIDFILE"
aux lvmconf "global/system_id_source = file"
vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID
+check vg_field $vg1 systemid "$SID"
grep "No system ID found from system_id_source" err
vgremove $vg1
-rm -f $SIDFILE
# vgcreate with source file, but system_id_file does not exist
SID=""
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
+rm -f "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
vgcreate $vg1 "$dev1" 2>&1 | tee err
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID
+check vg_field $vg1 systemid "$SID"
grep "No system ID found from system_id_source" err
vgremove $vg1
-rm -f $SIDFILE
# Test cases where lvmetad cache of a foreign VG are out of date
@@ -702,9 +629,7 @@ test ! -e LOCAL_LVMETAD && exit 0
# foreign vg by turning off lvmetad when we create an lv in the vg.
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg with an lv
@@ -724,7 +649,7 @@ lvs $vg1 >err
grep $lv1 err
not grep $lv2 err
# change our system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
vgs >err
not grep $vg1 err
# using --foreign, we will get the latest vg from disk
@@ -733,19 +658,16 @@ grep $vg1 err
grep $lv1 err
grep $lv2 err
# change our system_id back to match the vg so it's not foreign
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
lvremove $vg1/$lv1
lvremove $vg1/$lv2
vgremove $vg1
-rm -f $SIDFILE
# vgimport should find the exported vg on disk even though
# lvmetad's copy of the vg shows it's foreign.
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg with an lv
@@ -761,7 +683,7 @@ aux lvmconf 'global/use_lvmetad = 0'
vgexport $vg1
aux lvmconf 'global/use_lvmetad = 1'
# change the local system_id so the lvmetad copy of the vg is foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
# verify that lvmetad thinks the vg is foreign
# (don't use --foreign to verify this because that will cause
# the lvmetad cache to be updated, which we don't want yet)
@@ -776,16 +698,14 @@ grep $SID2 err
check lv_exists $vg1 $lv1
lvremove $vg1/$lv1
vgremove $vg1
-rm -f $SIDFILE
+rm -f "$SIDFILE"
# pvscan --cache should cause the latest version of a foreign VG to be
# cached in lvmetad. Without the --cache option, pvscan will see the old
# version of the VG.
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg with an lv
@@ -811,7 +731,7 @@ lvs $vg1 >err
grep $lv1 err
not grep $lv2 err
# change our system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
not vgs $vg1 >err
not grep $vg1 err
# use pvscan --cache to update the foreign vg in lvmetad
@@ -821,7 +741,7 @@ not grep $vg1 err
# change our system_id back to SID1 so we can check that
# lvmetad has the latest copy of the vg (without having
# to use --foreign to check)
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
vgs $vg1 >err
grep $vg1 err
lvs $vg1 >err
@@ -830,14 +750,11 @@ grep $lv2 err
lvremove $vg1/$lv1
lvremove $vg1/$lv2
vgremove $vg1
-rm -f $SIDFILE
# repeat the same test for vgscan instead of pvscan
SID1=sidfoofile1
SID2=sidfoofile2
-SIDFILE=etc/lvm_test.conf
-rm -f $SIDFILE
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
aux lvmconf "global/system_id_source = file" \
"global/system_id_file = \"$SIDFILE\""
# create a vg with an lv
@@ -863,7 +780,7 @@ lvs $vg1 >err
grep $lv1 err
not grep $lv2 err
# change our system_id, making the vg foreign
-echo "$SID2" > $SIDFILE
+echo "$SID2" > "$SIDFILE"
not vgs $vg1 >err
not grep $vg1 err
# use vgscan --cache to update the foreign vg in lvmetad
@@ -873,7 +790,7 @@ not grep $vg1 err
# change our system_id back to SID1 so we can check that
# lvmetad has the latest copy of the vg (without having
# to use --foreign to check)
-echo "$SID1" > $SIDFILE
+echo "$SID1" > "$SIDFILE"
vgs $vg1 >err
grep $vg1 err
lvs $vg1 >err
@@ -882,6 +799,3 @@ grep $lv2 err
lvremove $vg1/$lv1
lvremove $vg1/$lv2
vgremove $vg1
-rm -f $SIDFILE
-
-
6 years, 10 months