master - tests: check pvchange changes uuid
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2a79971004d4fb...
Commit: 2a79971004d4fb14b4483d7a87eca6eae4b8dd72
Parent: 09b180cfc252f1446fecc7b09672191043a7feb0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 28 10:37:33 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 28 10:41:59 2014 +0100
tests: check pvchange changes uuid
---
test/shell/pvchange-usage.sh | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/test/shell/pvchange-usage.sh b/test/shell/pvchange-usage.sh
index e25230c..a6a03fa 100644
--- a/test/shell/pvchange-usage.sh
+++ b/test/shell/pvchange-usage.sh
@@ -46,12 +46,20 @@ pvcreate --metadatacopies 0 "$dev1"
pvcreate --metadatacopies 2 "$dev2"
vgcreate $vg1 "$dev1" "$dev2"
+# Checking for different UUID after pvchange
+UUID1=$(get pv_field "$dev1" uuid)
pvchange -u "$dev1"
+test "$UUID1" != "$(get pv_field "$dev1" uuid)" || die "UUID has not changed!"
+
+UUID2=$(get pv_field "$dev2" uuid)
pvchange -u "$dev2"
-UUID=$(get pv_field "$dev1" uuid)
+test "$UUID2" != "$(get pv_field "$dev2" uuid)" || die "UUID has not changed!"
+
+UUID1=$(get pv_field "$dev1" uuid)
+UUID2=$(get pv_field "$dev2" uuid)
pvchange -u --all
-# Checking for different UUID after pvchange
-test "$UUID" != "$(get pv_field "$dev1" uuid)" || die "UUID has not changed!"
+test "$UUID1" != "$(get pv_field "$dev1" uuid)" || die "UUID has not changed!"
+test "$UUID2" != "$(get pv_field "$dev2" uuid)" || die "UUID has not changed!"
check pvlv_counts $vg1 2 0 0
# '-a' needs more params
10 years
master - tests: expect failing pvs when missing PV
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=09b180cfc252f1...
Commit: 09b180cfc252f1446fecc7b09672191043a7feb0
Parent: 88a9705222d728d0989c1b4d9aac89ce22c0284b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 28 10:37:17 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 28 10:41:59 2014 +0100
tests: expect failing pvs when missing PV
---
test/shell/lvmcache-exercise.sh | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvmcache-exercise.sh b/test/shell/lvmcache-exercise.sh
index 682d582..1e4b86a 100644
--- a/test/shell/lvmcache-exercise.sh
+++ b/test/shell/lvmcache-exercise.sh
@@ -20,7 +20,8 @@ aux disable_dev "$dev1"
pvscan
vgcreate $vg1 "$dev2"
aux enable_dev "$dev1"
-pvs $(cat DEVICES)
+# dev1 is missing
+fail pvs $(cat DEVICES)
# reappearing device (rhbz 995440)
lvcreate -aey -m2 --type mirror -l4 --alloc anywhere --corelog -n $lv1 $vg2
@@ -30,7 +31,7 @@ lvconvert --yes --repair $vg2/$lv1
aux enable_dev "$dev3"
# here it should fix any reappeared devices
-lvs $vg1 $vg1
+lvs $vg1 $vg2
lvs -a $vg2 -o+devices 2>&1 | tee out
not grep reappeared out
10 years
master - pvchange: populate lvmcache for --all
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=88a9705222d728...
Commit: 88a9705222d728d0989c1b4d9aac89ce22c0284b
Parent: 3d0ba79f86a209335a3e391352aa7de685e4992b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 28 10:35:50 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 28 10:41:58 2014 +0100
pvchange: populate lvmcache for --all
When running pvchange --all learn about available VGs from lvmetad.
---
WHATS_NEW | 1 +
tools/pvchange.c | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8013f1e..626a5b8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Obtain list of known VGs for pvchange --all when using lvmetad.
Add man page for lvm dumpconfig.
Drop unused cmd pointer for internal function for_each_sub_lv().
Validate name for renamed sub LVs.
diff --git a/tools/pvchange.c b/tools/pvchange.c
index 5c05db6..f87cd8c 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -225,6 +225,10 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
+ /* populate lvmcache */
+ if (!lvmetad_vg_list_to_lvmcache(cmd))
+ stack;
+
if ((vgnames = get_vgnames(cmd, 1)) &&
!dm_list_empty(vgnames)) {
dm_list_iterate_items(sll, vgnames) {
10 years
master - lvconvert: fix help message cache_pool -> cache-pool
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3d0ba79f86a209...
Commit: 3d0ba79f86a209335a3e391352aa7de685e4992b
Parent: a512ea6a6a887e807736fe49fa14b1be791f0e38
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Fri Mar 28 09:10:30 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 28 09:10:30 2014 +0100
lvconvert: fix help message cache_pool -> cache-pool
---
tools/commands.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index c047cb9..b0bad9d 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -215,7 +215,7 @@ xx(lvconvert,
"\t[-d|--debug] [-h|-?|--help] [-v|--verbose]\n\n"
"lvconvert "
- "--type cache_pool\n"
+ "--type cache-pool\n"
"\t[--cachemode CacheMode]\n"
"\t[--chunksize size]\n"
"\t[--poolmetadata CacheMetadataLogicalVolume[Path] |\n"
10 years
master - tests: updates
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a512ea6a6a887e...
Commit: a512ea6a6a887e807736fe49fa14b1be791f0e38
Parent: bd805ff0482b96b21076f9507cedf82c142cdebc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 28 00:39:55 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 28 00:41:19 2014 +0100
tests: updates
---
test/shell/lvconvert-repair-thin.sh | 1 -
test/shell/lvconvert-repair.sh | 4 ++--
test/shell/lvcreate-raid.sh | 4 ++--
test/shell/lvmcache-exercise.sh | 4 ++--
test/shell/pvchange-usage.sh | 26 ++++++++++++--------------
5 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/test/shell/lvconvert-repair-thin.sh b/test/shell/lvconvert-repair-thin.sh
index 30cd76d..8b0f117 100644
--- a/test/shell/lvconvert-repair-thin.sh
+++ b/test/shell/lvconvert-repair-thin.sh
@@ -78,7 +78,6 @@ should "$LVM_TEST_THIN_CHECK_CMD" "$DM_DEV_DIR/$vg/fixed"
# Swap repaired metadata back
lvconvert -y -f --poolmetadata $vg/fixed --thinpool $vg/pool
-lvs -a $vg
# Activate pool - this should now work
should vgchange -ay $vg
diff --git a/test/shell/lvconvert-repair.sh b/test/shell/lvconvert-repair.sh
index a3c46b1..db24710 100644
--- a/test/shell/lvconvert-repair.sh
+++ b/test/shell/lvconvert-repair.sh
@@ -26,8 +26,8 @@ _check_mlog()
not grep mlog out
}
-aux lvmconf 'allocation/maximise_cling = 0'
-aux lvmconf 'allocation/mirror_logs_require_separate_pvs = 1'
+aux lvmconf "allocation/maximise_cling = 0" \
+ "allocation/mirror_logs_require_separate_pvs = 1"
# fail multiple devices
diff --git a/test/shell/lvcreate-raid.sh b/test/shell/lvcreate-raid.sh
index 77b2347..15cf09f 100644
--- a/test/shell/lvcreate-raid.sh
+++ b/test/shell/lvcreate-raid.sh
@@ -116,9 +116,9 @@ lvcreate -l 18 -n lv $vg "$dev1"
lvcreate --type raid1 -m 1 -l 100%FREE -n raid1 $vg "$dev1" "$dev2"
check lv_field $vg/raid1 size "9.00m"
# Ensure image size is the same as the RAID1 size
-check lv_field $vg/raid1 size `lvs --noheadings -o size $vg/raid1_rimage_0`
+check lv_field $vg/raid1 size $(get lv_field $vg/raid1_rimage_0 size -a)
# Amount remaining in dev2 should equal the amount taken by 'lv' in dev1
-check pv_field "$dev2" pv_free `lvs --noheadings -o size $vg/lv`
+check pv_field "$dev2" pv_free $(get lv_field $vg/lv size)
lvremove -ff $vg
# Eat 18 of 37 extents from dev1, leaving 19
diff --git a/test/shell/lvmcache-exercise.sh b/test/shell/lvmcache-exercise.sh
index 09522e3..682d582 100644
--- a/test/shell/lvmcache-exercise.sh
+++ b/test/shell/lvmcache-exercise.sh
@@ -20,7 +20,7 @@ aux disable_dev "$dev1"
pvscan
vgcreate $vg1 "$dev2"
aux enable_dev "$dev1"
-pvs
+pvs $(cat DEVICES)
# reappearing device (rhbz 995440)
lvcreate -aey -m2 --type mirror -l4 --alloc anywhere --corelog -n $lv1 $vg2
@@ -30,7 +30,7 @@ lvconvert --yes --repair $vg2/$lv1
aux enable_dev "$dev3"
# here it should fix any reappeared devices
-lvs
+lvs $vg1 $vg1
lvs -a $vg2 -o+devices 2>&1 | tee out
not grep reappeared out
diff --git a/test/shell/pvchange-usage.sh b/test/shell/pvchange-usage.sh
index 8506747..e25230c 100644
--- a/test/shell/pvchange-usage.sh
+++ b/test/shell/pvchange-usage.sh
@@ -45,29 +45,27 @@ done
pvcreate --metadatacopies 0 "$dev1"
pvcreate --metadatacopies 2 "$dev2"
vgcreate $vg1 "$dev1" "$dev2"
+
pvchange -u "$dev1"
pvchange -u "$dev2"
-check pvlv_counts $vg1 2 0 0
-
-# -a needs more params
-not pvchange -a
-# -a is searching for devs, so passing it some is error
-not pvchange -a "$dev1"
-not pvchange -u "$dev1-notfound"
-
+UUID=$(get pv_field "$dev1" uuid)
pvchange -u --all
+# Checking for different UUID after pvchange
+test "$UUID" != "$(get pv_field "$dev1" uuid)" || die "UUID has not changed!"
check pvlv_counts $vg1 2 0 0
-# "pvchange rejects uuid change under an active lv"
+# '-a' needs more params
+invalid pvchange -a
+# '-a' is searching for devs, so specifying device is invalid
+invalid pvchange -a "$dev1"
+fail pvchange -u "$dev1-notfound"
+
+# pvchange rejects uuid change under an active lv
lvcreate -l 16 -i 2 -n $lv --alloc anywhere $vg1
check pvlv_counts $vg1 2 1 0
not pvchange -u "$dev1"
-lvchange -an $vg1/$lv
-pvchange -u "$dev1"
-# "cleanup"
-lvremove -f $vg1/$lv
-vgremove $vg1
+vgremove -f $vg1
# "pvchange reject --addtag to lvm1 pv"
pvcreate -M1 "$dev1"
10 years
master - tests: move some tests to better places
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bd805ff0482b96...
Commit: bd805ff0482b96b21076f9507cedf82c142cdebc
Parent: 5b44a036b147f8661567fc165e4a7de734a539b9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 28 00:37:39 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 28 00:41:19 2014 +0100
tests: move some tests to better places
Some tests already have separate test scripts - so move
those tests to listing and vgcfgbackup files.
---
test/shell/covercmd.sh | 147 ++++++++++-----------------------------
test/shell/listings.sh | 80 +++++++++++++++++++++
test/shell/vgcfgbackup-usage.sh | 20 +++--
3 files changed, 128 insertions(+), 119 deletions(-)
diff --git a/test/shell/covercmd.sh b/test/shell/covercmd.sh
index e5773ad..d9a5382 100644
--- a/test/shell/covercmd.sh
+++ b/test/shell/covercmd.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2008-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008-2014 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -10,107 +10,53 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# tests basic functionality of read-ahead and ra regressions
+# tests functionality we don't have in other special test files yet
+# to improve code coverage
#
. lib/test
-aux prepare_devs 5
+aux prepare_pvs 5
-TEST_UUID="aaaaaa-aaaa-aaaa-aaaa-aaaa-aaaa-aaaaaa"
-
-pvcreate "$dev1"
pvcreate --metadatacopies 0 "$dev2"
pvcreate --metadatacopies 0 "$dev3"
-pvcreate "$dev4"
-pvcreate --norestorefile -u $TEST_UUID --metadatacopies 0 "$dev5"
+
+pvscan --uuid
+
+# FIXME takes very long time
+#pvck "$dev1"
+
+
vgcreate $vg $(cat DEVICES)
-lvcreate -l 5 -i5 -I256 -n $lv $vg
+not vgscan $vg
+vgscan --mknodes
+vgs -o all $vg
+lvcreate -l 5 -i5 -I256 -n $lv $vg
lvcreate -aey -l 5 -n $lv1 $vg
lvcreate -s -l 5 -n $lv2 $vg/$lv1
+pvck "$dev1"
-if aux have_readline; then
-# test *scan and *display tools
-cat <<EOF | lvm
-pvscan --uuid
-vgscan --mknodes
-lvscan
-lvmdiskscan
-vgdisplay --units k $vg
-lvdisplay --units g $vg
-pvdisplay -c "$dev1"
-pvdisplay -s "$dev1"
-vgdisplay -c $vg
-vgdisplay -C $vg
-vgdisplay -s $vg
-lvdisplay -c $vg
-lvdisplay -C $vg
-lvdisplay -m $vg
-EOF
-
-for i in h b s k m g t p e H B S K M G T P E; do
- echo pvdisplay --units $i "$dev1"
-done | lvm
-else
-pvscan --uuid
-vgscan --mknodes
+not lvscan $vg
lvscan
+
lvmdiskscan
-vgdisplay --units k $vg
-lvdisplay --units g $vg
-pvdisplay -c "$dev1"
-pvdisplay -s "$dev1"
-vgdisplay -c $vg
-vgdisplay -C $vg
-vgdisplay -s $vg
-lvdisplay -c $vg
-lvdisplay -C $vg
-lvdisplay -m $vg
-
-for i in h b s k m g t p e H B S K M G T P E; do
- pvdisplay --units $i "$dev1"
-done
-fi
-
-not lvdisplay -C -m $vg
-not lvdisplay -c -v $vg
-not lvdisplay --aligned $vg
-not lvdisplay --noheadings $vg
-not lvdisplay --options lv_name $vg
-not lvdisplay --separator : $vg
-not lvdisplay --sort size $vg
-not lvdisplay --unbuffered $vg
-
-not vgdisplay -C -A
-not vgdisplay -C -c
-not vgdisplay -C -s
-not vgdisplay -c -s
-not vgdisplay -A $vg1
# "-persistent y --major 254 --minor 20"
# "-persistent n"
-# test various lvm utils
-for i in dumpconfig devtypes formats segtypes tags; do
- lvm $i
-done
-
for i in pr "p rw" an ay "-monitor y" "-monitor n" \
-refresh "-addtag MYTAG" "-deltag MYETAG"; do
lvchange -$i $vg/$lv
done
-pvck "$dev1"
-vgs -o all $vg
lvrename $vg $lv $lv-rename
-vgcfgbackup -f backup.$$ $vg
-vgchange -an $vg
-vgcfgrestore -f backup.$$ $vg
-pvremove -y -ff "$dev5"
-not vgcfgrestore -f backup.$$ $vg
-pvcreate -u $TEST_UUID --restorefile backup.$$ "$dev5"
+not lvrename $vg
+not lvrename $vg-xxx
+not lvrename $vg $vg/$lv-rename $vg1/$lv
+
vgremove -f $vg
+
# test pvresize functionality
# missing params
not pvresize
@@ -121,38 +67,17 @@ not pvresize --setphysicalvolumesize 10M "$dev7"
pvresize --setphysicalvolumesize 10M "$dev1"
pvresize "$dev1"
-# test various errors and obsoleted tools
-not lvmchange
-not lvmsadc
-not lvmsar
-not pvdata
-
-not lvrename $vg
-not lvrename $vg-xxx
-not lvrename $vg $vg/$lv-rename $vg/$lv
-not lvscan $vg
-not vgscan $vg
-
-#test vgdisplay -A to select only active VGs
-# all LVs active - VG considered active
-pvcreate -f "$dev1" "$dev2" "$dev3"
-vgcreate $vg1 "$dev1"
-lvcreate -l1 $vg1
-lvcreate -l1 $vg1
-
-# at least one LV active - VG considered active
-vgcreate $vg2 "$dev2"
-lvcreate -l1 $vg2
-lvcreate -l1 -an -Zn $vg2
-
-# no LVs active - VG considered inactive
-vgcreate $vg3 "$dev3"
-lvcreate -l1 -an -Zn $vg3
-lvcreate -l1 -an -Zn $vg3
-
-vgdisplay -s -A | grep $vg1
-vgdisplay -s -A | grep $vg2
-vgdisplay -s -A | not grep $vg3
-
-vgremove -ff $vg1 $vg2 $vg3
+# test various lvm utils
+lvm dumpconfig
+lvm devtypes
+lvm formats
+lvm segtypes
+lvm tags
+
+
+# test obsoleted tools
+not lvm lvmchange
+not lvm lvmsadc
+not lvm lvmsar
+not lvm pvdata
diff --git a/test/shell/listings.sh b/test/shell/listings.sh
index 42c6ba5..0d69957 100644
--- a/test/shell/listings.sh
+++ b/test/shell/listings.sh
@@ -72,5 +72,85 @@ not diff out out2
aux disable_dev "$dev1"
pvs -o +pv_uuid | grep BADBEE-BAAD-BAAD-BAAD-BAAD-BAAD-BADBEE
+aux enable_dev "$dev1"
+
+if aux have_readline; then
+# test *scan and *display tools
+cat <<EOF | lvm
+vgdisplay --units k $vg
+lvdisplay --units g $vg
+pvdisplay -c "$dev1"
+pvdisplay -s "$dev1"
+vgdisplay -c $vg
+vgdisplay -C $vg
+vgdisplay -s $vg
+lvdisplay -c $vg
+lvdisplay -C $vg
+lvdisplay -m $vg
+EOF
+
+for i in h b s k m g t p e H B S K M G T P E; do
+ echo pvdisplay --units $i "$dev1"
+done | lvm
+else
+pvscan --uuid
+vgscan --mknodes
+lvscan
+lvmdiskscan
+vgdisplay --units k $vg
+lvdisplay --units g $vg
+pvdisplay -c "$dev1"
+pvdisplay -s "$dev1"
+vgdisplay -c $vg
+vgdisplay -C $vg
+vgdisplay -s $vg
+lvdisplay -c $vg
+lvdisplay -C $vg
+lvdisplay -m $vg
+
+for i in h b s k m g t p e H B S K M G T P E; do
+ pvdisplay --units $i "$dev1"
+done
+fi
+
+invalid lvdisplay -C -m $vg
+invalid lvdisplay -c -v $vg
+invalid lvdisplay --aligned $vg
+invalid lvdisplay --noheadings $vg
+invalid lvdisplay --options lv_name $vg
+invalid lvdisplay --separator : $vg
+invalid lvdisplay --sort size $vg
+invalid lvdisplay --unbuffered $vg
+
+
+invalid vgdisplay -C -A
+invalid vgdisplay -C -c
+invalid vgdisplay -C -s
+invalid vgdisplay -c -s
+invalid vgdisplay -A $vg1
vgremove -ff $vg
+
+#test vgdisplay -A to select only active VGs
+# all LVs active - VG considered active
+pvcreate "$dev1" "$dev2" "$dev3"
+
+vgcreate $vg1 "$dev1"
+lvcreate -l1 $vg1
+lvcreate -l1 $vg1
+
+# at least one LV active - VG considered active
+vgcreate $vg2 "$dev2"
+lvcreate -l1 $vg2
+lvcreate -l1 -an -Zn $vg2
+
+# no LVs active - VG considered inactive
+vgcreate $vg3 "$dev3"
+lvcreate -l1 -an -Zn $vg3
+lvcreate -l1 -an -Zn $vg3
+
+vgdisplay -s -A | grep $vg1
+vgdisplay -s -A | grep $vg2
+vgdisplay -s -A | not grep $vg3
+
+vgremove -f $vg1 $vg2 $vg3
diff --git a/test/shell/vgcfgbackup-usage.sh b/test/shell/vgcfgbackup-usage.sh
index 3d955b5..193bb9d 100644
--- a/test/shell/vgcfgbackup-usage.sh
+++ b/test/shell/vgcfgbackup-usage.sh
@@ -13,6 +13,8 @@
aux prepare_pvs 4
+pvcreate --metadatacopies 0 "$dev4"
+
# No automatic backup
aux lvmconf "backup/backup = 0"
@@ -29,12 +31,12 @@ vgcfgbackup
test -e etc/backup/$vg1
test -e etc/backup/$vg2
-vgcfgbackup -f bak-%s >out
+vgcfgbackup -f "bak-%s" >out
grep "Volume group \"$vg1\" successfully backed up." out
grep "Volume group \"$vg2\" successfully backed up." out
# increase seqno
lvcreate -an -Zn -l1 $vg1
-vgcfgrestore -f bak-$vg1 $vg1
+vgcfgrestore -f "bak-$vg1" $vg1
vgremove -ff $vg1 $vg2
# vgcfgbackup correctly stores metadata with missing PVs
@@ -48,15 +50,17 @@ lvcreate -l1 -n $lv3 $vg "$dev3"
vgchange -a n $vg
pvcreate -ff -y "$dev1"
pvcreate -ff -y "$dev2"
-vgcfgbackup -f "$(pwd)/backup.$$" $vg
-sed 's/flags = \[\"MISSING\"\]/flags = \[\]/' "$(pwd)/backup.$$" > "$(pwd)/backup.$$1"
+vgcfgbackup -f "backup.$$" $vg
+sed 's/flags = \[\"MISSING\"\]/flags = \[\]/' "backup.$$" > "backup.$$1"
pvcreate -ff -y --norestorefile -u $pv1_uuid "$dev1"
pvcreate -ff -y --norestorefile -u $pv2_uuid "$dev2"
# Try to recover nonexisting vgname
-not vgcfgrestore -f "$(pwd)/backup.$$1" ${vg}_nonexistent
-vgcfgrestore -f "$(pwd)/backup.$$1" $vg
-vgremove -ff $vg
+not vgcfgrestore -f "backup.$$1" ${vg}_nonexistent
+vgcfgrestore -f "backup.$$1" $vg
+vgchange -an $vg
+vgremove -f $vg
+
# vgcfgbackup correctly stores metadata LVM1 with missing PVs
# FIXME: clvmd seems to have problem with metadata format change here
@@ -67,4 +71,4 @@ vgcreate -M1 -c n $vg $(cat DEVICES)
lvcreate -l1 -n $lv1 $vg "$dev1"
pvremove -ff -y "$dev2"
not lvcreate -l1 -n $lv1 $vg "$dev3"
-vgcfgbackup -f "$(pwd)/backup.$$" $vg
+vgcfgbackup -f "backup.$$" $vg
10 years
master - tests: support invalid and fail results
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5b44a036b147f8...
Commit: 5b44a036b147f8661567fc165e4a7de734a539b9
Parent: 0e02551f041ee59baeed032cccea15330ee24669
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 28 00:34:04 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 28 00:41:19 2014 +0100
tests: support invalid and fail results
Allow more detailed check for failing exit code:
invalid - expects 3
fail - expects 5
---
test/Makefile.in | 9 ++++++++-
test/lib/not.c | 8 ++++++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 15cdf7e..fe33949 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -123,6 +123,13 @@ endif
lib/should: lib/not
ln -sf not lib/should
+lib/invalid: lib/not
+ ln -sf not lib/invalid
+
+lib/fail: lib/not
+ ln -sf not lib/fail
+
+
lib/%: lib/%.o .lib-dir-stamp
$(CC) $(LDFLAGS) -o $@ $<
@@ -144,7 +151,7 @@ lib/paths: $(srcdir)/Makefile.in .lib-dir-stamp
echo 'export CLVMD_PIDFILE="@CLVMD_PIDFILE@"' >> $@-t
mv $@-t $@
-LIB = lib/not lib/should lib/harness \
+LIB = lib/not lib/invalid lib/fail lib/should lib/harness \
lib/check lib/aux lib/test lib/utils lib/get lib/lvm-wrapper \
lib/paths
diff --git a/test/lib/not.c b/test/lib/not.c
index 9f6b988..1cb12f9 100644
--- a/test/lib/not.c
+++ b/test/lib/not.c
@@ -26,6 +26,14 @@ static int finished(const char *cmd, int status) {
if (status)
fprintf(stderr, "TEST WARNING: Ignoring command failure.\n");
return 0;
+ } else if (!strcmp(cmd, "invalid")) {
+ if (status == 3)
+ return 0;
+ fprintf(stderr, "Test expected exit code 3 (invalid), but got %d.\n", status);
+ } else if (!strcmp(cmd, "fail")) {
+ if (status == 5)
+ return 0;
+ fprintf(stderr, "Test expected exit code 5 (fail), but got %d.\n", status);
}
return 6;
}
10 years
master - spec: add dumpconfig man
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0e02551f041ee5...
Commit: 0e02551f041ee59baeed032cccea15330ee24669
Parent: 6d314466f338a365d00092edea8e62066ef87dc2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 28 00:32:12 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 28 00:41:19 2014 +0100
spec: add dumpconfig man
---
spec/packages.inc | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/spec/packages.inc b/spec/packages.inc
index d7502de..0e54bcb 100644
--- a/spec/packages.inc
+++ b/spec/packages.inc
@@ -131,6 +131,7 @@ fi
%{_mandir}/man8/vgscan.8.gz
%{_mandir}/man8/vgsplit.8.gz
%{_mandir}/man8/blkdeactivate.8.gz
+%{_mandir}/man8/lvm-dumpconfig.8.gz
%if %{enable_udev}
%{_udevdir}/11-dm-lvm.rules
%if %{have_service lvmetad}
10 years
master - man: better formatting for lvm dumpconfig man page
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d314466f338a3...
Commit: 6d314466f338a365d00092edea8e62066ef87dc2
Parent: 801d43445dee66a95f15f447a9384cd3f3037199
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 27 14:18:41 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 27 14:18:41 2014 +0100
man: better formatting for lvm dumpconfig man page
---
man/lvm-dumpconfig.8.in | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/man/lvm-dumpconfig.8.in b/man/lvm-dumpconfig.8.in
index 0240639..7448992 100644
--- a/man/lvm-dumpconfig.8.in
+++ b/man/lvm-dumpconfig.8.in
@@ -3,10 +3,10 @@
lvm-dumpconfig \- dump LVM configuration
.SH SYNOPSIS
.B lvm dumpconfig
-.RB [ \-f|\-\-file ]
+.RB [ \-f | \-\-file ]
.IR filename ]
.RB [ \-\-type
-.IR {current|default|diff|missing|new|profilable}
+.RI { current | default | diff | missing | new | profilable }
.RB [ \-\-atversion
.IR version ]
.RB [ \-\-ignoreadvanced ]
@@ -21,11 +21,12 @@ lvm-dumpconfig \- dump LVM configuration
lvm dumpconfig produces formatted output with LVM configuration tree.
.SH OPTIONS
-
-.IP "\fB\-f, \-\-file\fP \fI filename"
+.TP
+.BR \-f ", " \-\-file " \fIfilename"
Dump configuration to a file named 'filename'.
-.IP "\fB\-\-type\fP \fI {current|default|diff|missing|new|profilable}"
+.TP
+.IR \fB\-\-type " {" current | default | diff | missing | new | profilable }
Select the type of configuration to dump. The configuration settings dumped
have either default values or currently used values assigned based on the
type selected (if no type is selected, \fB\-\-type current\fP is used
@@ -56,7 +57,8 @@ Dump all profilable configuration settings with default values assigned.
See \fBlvm.conf\fP(5) for more info about \fBprofile config\fP method.
.RE
-.IP "\fB\-\-atversion\fP version"
+.TP
+.BI \-\-atversion " version"
Specify an LVM version in x.y.z format where x is the major version,
the y is the minor version and z is the patchlevel (e.g. 2.2.106).
When configuration is dumped, the configuration settings recognized
@@ -65,30 +67,36 @@ to dump a configuration that certain LVM version understands and
which does not contain any newer settings for which LVM would
issue a warning message when checking the configuration.
-.IP "\fB\-\-ignoreadvanced\fP"
+.TP
+.B \-\-ignoreadvanced
Ignore advanced configuration settings on dump.
-.IP "\fB\-\-ignoreunsupported\fP"
+.TP
+.B \-\-ignoreunsupported
Ignore unsupported configuration settings on dump. These settings are
either used for debugging purposes only or their support is not yet
complete and they are not meant to be used in production.
-.IP "\fB\-\-mergedconfig\fP"
+.TP
+.B \-\-mergedconfig
When the dumpconfig command is run with the \fB\-\-config\fP option
(a common option that is recognized by all LVM tools, see also
\fBlvm\fP(8)), merge this configuration with current configuration
used (see \fB\-\-type current\fP above). Otherwise, only the
configuration specified within \fB\-\-config\fP option is dumped.
-.IP "\fB\-\-validate\fP"
+.TP
+.B \-\-validate
Validate current configuration used and exit with appropriate
return code. The validation is done even if \fBconfig/checks\fP
\fBlvm.conf\fP(5) option is disabled.
-.IP "\fB\-\-withcomments\fP"
+.TP
+.B \-\-withcomments
Also dump comments for each configuration node.
-.IP "\fB\-\-withversions\fP"
+.TP
+.B \-\-withversions
Also dump a comment containing the version of introduction for
each configuration node.
10 years
master - man: add man page for lvm dumpconfig
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=801d43445dee66...
Commit: 801d43445dee66a95f15f447a9384cd3f3037199
Parent: c7a89323f53c791e907478a7338a1bdbbb151fe1
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 27 14:01:15 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 27 14:03:28 2014 +0100
man: add man page for lvm dumpconfig
---
WHATS_NEW | 1 +
man/Makefile.in | 3 +-
man/lvm-dumpconfig.8.in | 97 +++++++++++++++++++++++++++++++++++++++++++++++
man/lvm.8.in | 1 +
4 files changed, 101 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9cda1d5..8013f1e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Add man page for lvm dumpconfig.
Drop unused cmd pointer for internal function for_each_sub_lv().
Validate name for renamed sub LVs.
When lvrename fails on argument parsing return invalid cmd line error (5->3).
diff --git a/man/Makefile.in b/man/Makefile.in
index 40145f1..72098e6 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -41,7 +41,8 @@ LVMETAD =
endif
MAN5=lvm.conf.5
-MAN8=lvchange.8 lvconvert.8 lvcreate.8 lvdisplay.8 lvextend.8 lvm.8 \
+MAN8=lvm-dumpconfig.8 \
+ lvchange.8 lvconvert.8 lvcreate.8 lvdisplay.8 lvextend.8 lvm.8 \
lvmchange.8 lvmconf.8 lvmdiskscan.8 lvmdump.8 lvmsadc.8 lvmsar.8 \
lvreduce.8 lvremove.8 lvrename.8 lvresize.8 lvs.8 \
lvscan.8 pvchange.8 pvck.8 pvcreate.8 pvdisplay.8 pvmove.8 pvremove.8 \
diff --git a/man/lvm-dumpconfig.8.in b/man/lvm-dumpconfig.8.in
new file mode 100644
index 0000000..0240639
--- /dev/null
+++ b/man/lvm-dumpconfig.8.in
@@ -0,0 +1,97 @@
+.TH "LVM-DUMPCONFIG" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\""
+.SH "NAME"
+lvm-dumpconfig \- dump LVM configuration
+.SH SYNOPSIS
+.B lvm dumpconfig
+.RB [ \-f|\-\-file ]
+.IR filename ]
+.RB [ \-\-type
+.IR {current|default|diff|missing|new|profilable}
+.RB [ \-\-atversion
+.IR version ]
+.RB [ \-\-ignoreadvanced ]
+.RB [ \-\-ignoreunsupported ]
+.RB [ \-\-mergedconfig ]
+.RB [ \-\-validate ]
+.RB [ \-\-withcomments ]
+.RB [ \-\-withversions ]
+.RB [ ConfigurationNode... ]
+
+.SH DESCRIPTION
+lvm dumpconfig produces formatted output with LVM configuration tree.
+
+.SH OPTIONS
+
+.IP "\fB\-f, \-\-file\fP \fI filename"
+Dump configuration to a file named 'filename'.
+
+.IP "\fB\-\-type\fP \fI {current|default|diff|missing|new|profilable}"
+Select the type of configuration to dump. The configuration settings dumped
+have either default values or currently used values assigned based on the
+type selected (if no type is selected, \fB\-\-type current\fP is used
+by default). Whenever a configuration setting with a default value is
+commented out, it means the setting does not have any concrete default
+value defined. All output can be saved and reused as proper \fBlvm.conf\fP(5)
+file.
+.RS
+.IP current 3
+Dump current \fBlvm.conf\fP configuration merged with any \fBtag config\fP
+if used. See also \fBlvm.conf\fP(5) for more info about LVM configuration methods.
+.IP default 3
+Dump all possible configuration settings with default values assigned.
+.IP diff 3
+Dump all configuration settings for which the values used differ from defaults.
+The value assigned for each configuration setting is the value currently used.
+This is actually minimal LVM configuration which can be used without
+a change to current configured behaviour.
+.IP missing 3
+Dump all configuration settings with default values assigned which are
+missing in the configuration currently used and for which LVM automatically
+fallbacks to using these default values.
+.IP new 3
+Dump all new configuration settings introduced in current LVM version
+or specific version as defined by \fB\-\-atversion\fP option.
+.IP profilable 3
+Dump all profilable configuration settings with default values assigned.
+See \fBlvm.conf\fP(5) for more info about \fBprofile config\fP method.
+.RE
+
+.IP "\fB\-\-atversion\fP version"
+Specify an LVM version in x.y.z format where x is the major version,
+the y is the minor version and z is the patchlevel (e.g. 2.2.106).
+When configuration is dumped, the configuration settings recognized
+at this LVM version will be considered only. This can be used
+to dump a configuration that certain LVM version understands and
+which does not contain any newer settings for which LVM would
+issue a warning message when checking the configuration.
+
+.IP "\fB\-\-ignoreadvanced\fP"
+Ignore advanced configuration settings on dump.
+
+.IP "\fB\-\-ignoreunsupported\fP"
+Ignore unsupported configuration settings on dump. These settings are
+either used for debugging purposes only or their support is not yet
+complete and they are not meant to be used in production.
+
+.IP "\fB\-\-mergedconfig\fP"
+When the dumpconfig command is run with the \fB\-\-config\fP option
+(a common option that is recognized by all LVM tools, see also
+\fBlvm\fP(8)), merge this configuration with current configuration
+used (see \fB\-\-type current\fP above). Otherwise, only the
+configuration specified within \fB\-\-config\fP option is dumped.
+
+.IP "\fB\-\-validate\fP"
+Validate current configuration used and exit with appropriate
+return code. The validation is done even if \fBconfig/checks\fP
+\fBlvm.conf\fP(5) option is disabled.
+
+.IP "\fB\-\-withcomments\fP"
+Also dump comments for each configuration node.
+
+.IP "\fB\-\-withversions\fP"
+Also dump a comment containing the version of introduction for
+each configuration node.
+
+.SH SEE ALSO
+.BR lvm (8)
+.BR lvm.conf (5)
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 39e47d3..f6335ed 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -588,6 +588,7 @@ All tools return a status code of zero on success or non-zero on failure.
.I $HOME/.lvm_history
.SH SEE ALSO
.BR lvm.conf (5),
+.BR lvm\ dumpconfig (8),
.BR clvmd (8),
.BR lvchange (8),
.BR lvcreate (8),
10 years