Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=666738d57a6e6b40…
Commit: 666738d57a6e6b4005030995a9641933c1a54e9d
Parent: 139df7c4a310486d49fdd95039891b91f793ff44
Author: Michael Lass <bevan(a)bi-co.net>
AuthorDate: Tue Mar 31 15:47:01 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 31 15:47:01 2015 +0200
systemd: stop lvm2-pvscan@.service before lvm2-lvmetad.service
When lvm2-pvscan@.service and lvm2-lvmetad.service are scheduled to be
stopped lvm2-pvscan@.service should be stopped first since pvscan uses
lvmetad.
This is especially important if lvm2-lvmetad.socket is also scheduled to
be stopped as in this case connection requests are suppressed causing
pvscan to fail.
---
scripts/lvm2_pvscan_systemd_red_hat@.service.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/lvm2_pvscan_systemd_red_hat@.service.in b/scripts/lvm2_pvscan_systemd_red_hat@.service.in
index 7d3b291..03651d5 100644
--- a/scripts/lvm2_pvscan_systemd_red_hat@.service.in
+++ b/scripts/lvm2_pvscan_systemd_red_hat@.service.in
@@ -4,7 +4,7 @@ Documentation=man:pvscan(8)
DefaultDependencies=no
BindsTo=dev-block-%i.device
Requires=lvm2-lvmetad.socket
-After=lvm2-lvmetad.socket
+After=lvm2-lvmetad.socket lvm2-lvmetad.service
Before=shutdown.target
Conflicts=shutdown.target
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=139df7c4a310486d…
Commit: 139df7c4a310486d49fdd95039891b91f793ff44
Parent: 974a029a8a181b3bc8ee5f10b202408b175d1b4b
Author: Michael Lass <bevan(a)bi-co.net>
AuthorDate: Tue Mar 31 15:44:00 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 31 15:44:00 2015 +0200
README: fix link to lvm-devel mailing list
---
README | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/README b/README
index 6a7e11c..a0e3c9e 100644
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ Mailing list for general discussion related to LVM2:
Mailing lists for LVM2 development, patches and commits:
lvm-devel(a)redhat.com
- Subscribe from https://www.redhat.com/mailman/listinfo/linux-lvm
+ Subscribe from https://www.redhat.com/mailman/listinfo/lvm-devel
lvm2-commits(a)lists.fedorahosted.org (Read-only archive of commits)
Subscribe from https://fedorahosted.org/mailman/listinfo/lvm2-commits
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=974a029a8a181b3b…
Commit: 974a029a8a181b3bc8ee5f10b202408b175d1b4b
Parent: 04826db7c415028cb4a16bdde5553859779380ac
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 31 15:38:29 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 31 15:38:29 2015 +0200
lvm.conf: fix typo as -> is in read_only_volume_list comments
---
conf/example.conf.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 51e8e85..1863a89 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -997,7 +997,7 @@ activation {
# auto_activation_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
# If read_only_volume_list is defined, each LV that is to be activated
- # is checked against the list, and if it matches, it as activated
+ # is checked against the list, and if it matches, it is activated
# in read-only mode. (This overrides '--permission rw' stored in the
# metadata.)
#
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b9e6e66de15ca638…
Commit: b9e6e66de15ca638ca504a07d6476e571a6197d3
Parent: 5f7428e4d54254943da721f7ce11ae90aaa3f5a4
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon Mar 30 16:59:51 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon Mar 30 18:39:30 2015 +0200
tests: add pvmove --abort for all moves in progress
test for bug described in c282a66132063d702d1df1e342961f75a5ffcdd2
---
test/shell/pvmove-abort-all.sh | 68 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/test/shell/pvmove-abort-all.sh b/test/shell/pvmove-abort-all.sh
new file mode 100644
index 0000000..85ee457
--- /dev/null
+++ b/test/shell/pvmove-abort-all.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Copyright (C) 2015 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
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Check pvmove --abort behaviour for all VGs and PVs
+
+. lib/inittest
+
+aux prepare_pvs 6 60
+
+vgcreate -s 128k $vg "$dev1" "$dev2"
+pvcreate --metadatacopies 0 "$dev3"
+vgextend $vg "$dev3"
+vgcreate -s 128k $vg1 "$dev4" "$dev5"
+pvcreate --metadatacopies 0 "$dev6"
+vgextend $vg1 "$dev6"
+
+for mode in "--atomic" "" ;
+do
+for backgroundarg in "-b" "" ;
+do
+
+# Create multisegment LV
+lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
+lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
+lvcreate -an -Zn -l30 -n $lv1 $vg1 "$dev4"
+lvextend -l+30 -n $vg1/$lv1 "$dev5"
+
+# Slowdown writes
+aux delay_dev "$dev3" 0 300
+aux delay_dev "$dev6" 0 300
+
+pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode &
+aux wait_pvmove_lv_ready "$vg-pvmove0" 300
+pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode &
+aux wait_pvmove_lv_ready "$vg-pvmove1" 300
+pvmove -i1 $backgroundarg -n $vg1/$lv1 "$dev4" "$dev6" $mode &
+aux wait_pvmove_lv_ready "$vg1-pvmove0" 300
+
+# test removal of all pvmove LVs
+pvmove --abort
+
+# check if proper pvmove was canceled
+get lv_field $vg name -a | tee out
+not grep "^\[pvmove" out
+get lv_field $vg1 name -a | tee out
+not grep "^\[pvmove" out
+
+# Restore delayed device back
+aux enable_dev "$dev3"
+aux enable_dev "$dev6"
+
+lvremove -ff $vg
+lvremove -ff $vg1
+
+wait
+done
+done
+
+vgremove -ff $vg
+vgremove -ff $vg1
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5f7428e4d5425494…
Commit: 5f7428e4d54254943da721f7ce11ae90aaa3f5a4
Parent: c282a66132063d702d1df1e342961f75a5ffcdd2
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon Mar 30 16:59:06 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon Mar 30 18:39:24 2015 +0200
tests: add pvmove --abort test
test for bug described in c282a66132063d702d1df1e342961f75a5ffcdd2
---
test/shell/pvmove-abort.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/test/shell/pvmove-abort.sh b/test/shell/pvmove-abort.sh
new file mode 100644
index 0000000..6798b59
--- /dev/null
+++ b/test/shell/pvmove-abort.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Copyright (C) 2015 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
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Check pvmove --abort behaviour when specific device is requested
+
+. lib/inittest
+
+aux prepare_pvs 3 60
+
+vgcreate -s 128k $vg "$dev1" "$dev2"
+pvcreate --metadatacopies 0 "$dev3"
+vgextend $vg "$dev3"
+
+for mode in "--atomic" "" ;
+do
+for backgroundarg in "-b" "" ;
+do
+
+# Create multisegment LV
+lvcreate -an -Zn -l30 -n $lv1 $vg "$dev1"
+lvcreate -an -Zn -l30 -n $lv2 $vg "$dev2"
+
+# Slowdown writes
+aux delay_dev "$dev3" 0 200
+
+pvmove -i1 $backgroundarg "$dev1" "$dev3" $mode &
+aux wait_pvmove_lv_ready "$vg-pvmove0" 300
+pvmove -i1 $backgroundarg "$dev2" "$dev3" $mode &
+aux wait_pvmove_lv_ready "$vg-pvmove1" 300
+
+# remove specific device
+pvmove --abort "$dev1"
+
+# check if proper pvmove was canceled
+get lv_field $vg name -a | tee out
+not grep "^\[pvmove0\]" out
+grep "^\[pvmove1\]" out
+
+# Restore delayed device back
+aux enable_dev "$dev3"
+
+# remove any remaining pvmoves in progress
+pvmove --abort
+
+lvremove -ff $vg
+
+wait
+done
+done
+
+vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c282a66132063d70…
Commit: c282a66132063d702d1df1e342961f75a5ffcdd2
Parent: 7c66850ce506d9a8bdae74f999a658507943d57c
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon Mar 30 16:25:04 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon Mar 30 18:38:50 2015 +0200
pvmove: fix pvmove --abort or pvmove w/o parameters
_check_lv_status was called from within dm_list_iterate_items cycle.
This was utterly wrong! _check_lv_status may remove more than one LV from
vg->lvs list we iterated in the same time.
In some scenarios this could lead to deadlock iterationg over same LV
indefinitely or segfault depending on the circumstances.
Fixed by moving the _check_lv_status outside iterating the vg->lvs
list.
Note that commit 6e7b24d34ff3da1c56718bb7def8a8ecd4258c43 was not enough
as _check_lv_status may result in removal of more than one LV from the list.
---
tools/polldaemon.c | 42 ++++++++++++++++++++++++++++++++++++------
1 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 53dab96..5383812 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -192,7 +192,9 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
struct volume_group *vg, struct processing_handle *handle)
{
struct daemon_parms *parms = (struct daemon_parms *) handle->custom_handle;
- struct lv_list *lvl, *tmp_lvl;
+ struct lv_list *lvl;
+ struct dm_list *sls;
+ struct dm_str_list *sl;
struct logical_volume *lv;
const char *name;
int finished;
@@ -202,7 +204,18 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
return ECMD_FAILED;
}
- dm_list_iterate_items_safe(lvl, tmp_lvl, &vg->lvs) {
+ if (!(sls = str_list_create(cmd->mem)))
+ return ECMD_FAILED;
+
+ log_verbose("Looking for pvmove LVs in VG: %s.", vg->name);
+
+ /*
+ * _check_lv_status must not be called from within any
+ * dm_list_iterate_ routine with vg->lvs as list head.
+ * It may remove more than one LV in the process thus
+ * even "*_safe" variant won't help.
+ */
+ dm_list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
if (!(lv->status & parms->lv_type))
continue;
@@ -217,13 +230,30 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
continue;
}
- if (_check_lv_status(cmd, vg, lv, name, parms, &finished) &&
- !finished)
- parms->outstanding_count++;
+ if (!str_list_add(cmd->mem, sls, dm_pool_strdup(cmd->mem, name)))
+ {
+ log_error("Failed to clone pvname");
+ goto err;
+ }
+
+ log_verbose("Found LV: %s/%s. It belongs to pvmove task on PV %s.", lv->vg->name, lv->name, name);
}
- return ECMD_PROCESSED;
+ dm_list_iterate_items(sl, sls) {
+ lv = parms->poll_fns->get_copy_lv(cmd, vg, sl->str, NULL, parms->lv_type);
+ if (lv) {
+ log_verbose("About to call _check_lv_status on LV: %s/%s, name: %s",
+ lv->vg->name, lv->name, sl->str);
+ if (_check_lv_status(cmd, vg, lv, sl->str, parms, &finished) &&
+ !finished)
+ parms->outstanding_count++;
+ }
+ }
+
+err:
+ dm_pool_free(cmd->mem, sls);
+ return ECMD_PROCESSED;
}
static void _poll_for_all_vgs(struct cmd_context *cmd,
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8a87fadbb026ca12…
Commit: 8a87fadbb026ca121c8af8669e68673aece46eb2
Parent: 22d43ee14a1a9700b76960da2c983ff55cc3630c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 26 16:11:29 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 26 16:11:29 2015 +0100
tests: drop vg2 at end of test
---
test/shell/select-tools.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/test/shell/select-tools.sh b/test/shell/select-tools.sh
index d04ed0a..b9e4b2f 100644
--- a/test/shell/select-tools.sh
+++ b/test/shell/select-tools.sh
@@ -273,3 +273,4 @@ pvchange -a --deltag 309 --deltag tag
# iterates over LVs with process_each_lv_in_vg - so internally it actually
# operates per-LV, but we still need the selection to be done per-VG)
vgremove --yes -S 'lv_name=lv2' # should remove whole vg1, not just the lv2
+vgremove --yes $vg2
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=22d43ee14a1a9700…
Commit: 22d43ee14a1a9700b76960da2c983ff55cc3630c
Parent: 147b0a17005f632647b31394dda402483322ccad
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 26 16:10:48 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 26 16:10:48 2015 +0100
tests: skip system_id test in cluster
Let's see what we can do in cluster for system_id,
until resolved skip test for check_cluster.
---
test/shell/system_id.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
index d866675..ad8871a 100644
--- a/test/shell/system_id.sh
+++ b/test/shell/system_id.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2008-2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2015 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
@@ -13,6 +13,9 @@ test_description='Test system_id'
. lib/inittest
+# Should 'system_id' be usable in cluster ??
+test -e LOCAL_CLVMD && skip
+
aux prepare_devs 1
# create vg with system_id using each source
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=147b0a17005f6326…
Commit: 147b0a17005f632647b31394dda402483322ccad
Parent: d24b6cfb1ff1f29eec49c3113f8cef9904cf4a8b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 26 16:03:24 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 26 16:03:24 2015 +0100
tests: pvmove better delay check
Improve testing for condition that pvmove0 is already running in the
table (so we do not kill pvmove while it has loaded target, but
it's not yet Live).
Also delay_dev for 200ms.
---
test/shell/lvresize-rounding.sh | 1 -
test/shell/pvmove-restart.sh | 10 +++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/test/shell/lvresize-rounding.sh b/test/shell/lvresize-rounding.sh
index 24ca00b..5c30539 100644
--- a/test/shell/lvresize-rounding.sh
+++ b/test/shell/lvresize-rounding.sh
@@ -11,7 +11,6 @@
. lib/inittest
-# 15 extents
aux prepare_pvs 3 22
vgcreate -s 32K $vg $(cat DEVICES)
diff --git a/test/shell/pvmove-restart.sh b/test/shell/pvmove-restart.sh
index 022e7c8..06455f5 100644
--- a/test/shell/pvmove-restart.sh
+++ b/test/shell/pvmove-restart.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2013-2015 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
@@ -29,12 +29,16 @@ lvextend -l+5 $vg/$lv1 "$dev1"
lvextend -l+10 $vg/$lv1 "$dev2"
# Slowdown writes
-aux delay_dev "$dev3" 0 100
+aux delay_dev "$dev3" 0 200
pvmove -i0 -n $vg/$lv1 "$dev1" "$dev3" $mode &
PVMOVE=$!
# Let's wait a bit till pvmove starts and kill it
-while not dmsetup status "$vg-pvmove0"; do sleep .1; done
+while : ; do
+ dmsetup info -c -o tables_loaded "$vg-pvmove0" > out || true;
+ not grep Live out || break
+ sleep .1
+done
kill -9 $PVMOVE
wait
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f08154cc7b2051b6…
Commit: f08154cc7b2051b68b4eda1a6be0de61fc77d637
Parent: b7ebab765761098058c436a3543ecbff00ad171a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 26 15:01:54 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 26 15:10:31 2015 +0100
tests: update aux
When we use /dev/loopX device - shift first PV1 sector by 1M
so /dev/loop0 and dm device do not appear as same device.
Also notify lvmetad once 'devs' are created - so in case this
command is called in the middle of test - lvmetad properly
drops its metadata for these devices.
Drop used test.img file between reuse so the 'prepare_vg'
always starts with zeroed disks.
When LVM_TEST_AUX_TRACE is set, allow shell tracing of aux commands.
---
test/lib/aux.sh | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 69c1473..cdd9a2d 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -284,7 +284,8 @@ prepare_loop() {
echo -n .
local LOOPFILE="$PWD/test.img"
- dd if=/dev/zero of="$LOOPFILE" bs=$((1024*1024)) count=0 seek=$(($size)) 2> /dev/null
+ rm -f "$LOOPFILE"
+ dd if=/dev/zero of="$LOOPFILE" bs=$((1024*1024)) count=0 seek=$(($size + 1)) 2> /dev/null
if LOOP=$(losetup -s -f "$LOOPFILE" 2>/dev/null); then
:
elif LOOP=$(losetup -f) && losetup "$LOOP" "$LOOPFILE"; then
@@ -367,8 +368,11 @@ prepare_devs() {
local n=${1:-3}
local devsize=${2:-34}
local pvname=${3:-pv}
+ local shift=0
prepare_backing_dev $(($n*$devsize))
+ # shift start of PV devices on /dev/loopXX by 1M
+ not diff LOOP BACKING_DEV >/dev/null 2>&1 || shift=2048
echo -n "## preparing $n devices..."
local size=$(($devsize*2048)) # sectors
@@ -379,7 +383,7 @@ prepare_devs() {
local dev="$DM_DEV_DIR/mapper/$name"
DEVICES[$count]=$dev
count=$(( $count + 1 ))
- echo 0 $size linear "$BACKING_DEV" $((($i-1)*$size)) > "$name.table"
+ echo 0 $size linear "$BACKING_DEV" $((($i-1)*$size + $shift)) > "$name.table"
if not dmsetup create -u "TEST-$name" "$name" "$name.table" &&
test -n "$LVM_TEST_BACKING_DEVICE";
then # maybe the backing device is too small for this test
@@ -408,6 +412,10 @@ prepare_devs() {
printf "%s\n" "${DEVICES[@]}" > DEVICES
# ( IFS=$'\n'; echo "${DEVICES[*]}" ) >DEVICES
echo "ok"
+
+ for dev in "${DEVICES[@]}"; do
+ notify_lvmetad "$dev"
+ done
}
# Replace linear PV device with its 'delayed' version
@@ -894,6 +902,8 @@ dmsetup_wrapped() {
dmsetup "$@"
}
+test -z "$LVM_TEST_AUX_TRACE" || set -x
+
test -f DEVICES && devs=$(< DEVICES)
if test "$1" = dmsetup; then
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0bffd99daa6510f8…
Commit: 0bffd99daa6510f80c918a23187b638260e9e634
Parent: 9dbe2d760f3810463ffa416e82f89766b12b0071
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 24 10:12:04 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 24 10:12:27 2015 +0100
tests: move thin-related test from select-tools.sh to select-tools-thin.sh
And skip this test if thin target is not available.
---
test/shell/select-tools-thin.sh | 35 +++++++++++++++++++++++++++++++++++
test/shell/select-tools.sh | 15 ---------------
2 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/test/shell/select-tools-thin.sh b/test/shell/select-tools-thin.sh
new file mode 100644
index 0000000..d70289f
--- /dev/null
+++ b/test/shell/select-tools-thin.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (C) 2015 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
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/inittest
+
+aux have_thin 1 0 0 || skip
+
+aux prepare_pvs 1 16
+
+#########################
+# special cases to test #
+#########################
+
+# if calling lvremove and an LV is removed that is related to other LV
+# and we're doing selection based on this relation, check if we're
+# selecting on initial state (here, thin origin LV thin_orig is removed
+# first, but thin snap should be still selectable based on origin=thin_orig
+# condition even though thin_orig has just been removed)
+vgcreate -s 4m $vg1 $dev1
+lvcreate -l100%FREE -T $vg1/pool
+lvcreate -V4m -T $vg1/pool -n thin_orig
+lvcreate -s $vg1/thin_orig -n thin_snap
+lvremove -ff -S 'lv_name=thin_orig || origin=thin_orig' > out
+grep "Logical volume \"thin_orig\" successfully removed" out
+grep "Logical volume \"thin_snap\" successfully removed" out
+not lvs $vg1/thin_orig
+not lvs $vg1/thin_snap
diff --git a/test/shell/select-tools.sh b/test/shell/select-tools.sh
index 975ebdb..d04ed0a 100644
--- a/test/shell/select-tools.sh
+++ b/test/shell/select-tools.sh
@@ -273,18 +273,3 @@ pvchange -a --deltag 309 --deltag tag
# iterates over LVs with process_each_lv_in_vg - so internally it actually
# operates per-LV, but we still need the selection to be done per-VG)
vgremove --yes -S 'lv_name=lv2' # should remove whole vg1, not just the lv2
-
-# if calling lvremove and an LV is removed that is related to other LV
-# and we're doing selection based on this relation, check if we're
-# selecting on initial state (here, thin origin LV thin_orig is removed
-# first, but thin snap should be still selectable based on origin=thin_orig
-# condition even though thin_orig has just been removed)
-vgcreate -s 4m $vg1 $dev1 $dev2
-lvcreate -l100%FREE -T $vg1/pool
-lvcreate -V4m -T $vg1/pool -n thin_orig
-lvcreate -s $vg1/thin_orig -n thin_snap
-lvremove -ff -S 'lv_name=thin_orig || origin=thin_orig' > out
-grep "Logical volume \"thin_orig\" successfully removed" out
-grep "Logical volume \"thin_snap\" successfully removed" out
-not lvs $vg1/thin_orig
-not lvs $vg1/thin_snap
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9dbe2d760f381046…
Commit: 9dbe2d760f3810463ffa416e82f89766b12b0071
Parent: 8759f7d755cec7286d1bccda3a323b12481d5738
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 24 09:50:35 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 24 09:50:35 2015 +0100
tests: select-tools.sh: add test for fix in commit c9f021de0b4d2c873ef5b97d17c602d0380359fd
---
test/shell/select-tools.sh | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/test/shell/select-tools.sh b/test/shell/select-tools.sh
index d04ed0a..975ebdb 100644
--- a/test/shell/select-tools.sh
+++ b/test/shell/select-tools.sh
@@ -273,3 +273,18 @@ pvchange -a --deltag 309 --deltag tag
# iterates over LVs with process_each_lv_in_vg - so internally it actually
# operates per-LV, but we still need the selection to be done per-VG)
vgremove --yes -S 'lv_name=lv2' # should remove whole vg1, not just the lv2
+
+# if calling lvremove and an LV is removed that is related to other LV
+# and we're doing selection based on this relation, check if we're
+# selecting on initial state (here, thin origin LV thin_orig is removed
+# first, but thin snap should be still selectable based on origin=thin_orig
+# condition even though thin_orig has just been removed)
+vgcreate -s 4m $vg1 $dev1 $dev2
+lvcreate -l100%FREE -T $vg1/pool
+lvcreate -V4m -T $vg1/pool -n thin_orig
+lvcreate -s $vg1/thin_orig -n thin_snap
+lvremove -ff -S 'lv_name=thin_orig || origin=thin_orig' > out
+grep "Logical volume \"thin_orig\" successfully removed" out
+grep "Logical volume \"thin_snap\" successfully removed" out
+not lvs $vg1/thin_orig
+not lvs $vg1/thin_snap
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8759f7d755cec728…
Commit: 8759f7d755cec7286d1bccda3a323b12481d5738
Parent: c9f021de0b4d2c873ef5b97d17c602d0380359fd
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 23 13:32:00 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 24 08:43:08 2015 +0100
metadata: vg: add removed_lvs field to collect LVs which have been removed
Do not keep dangling LVs if they're removed from the vg->lvs list and
move them to vg->removed_lvs instead (this is actually similar to already
existing vg->removed_pvs list, just it's for LVs now).
Once we have this vg->removed_lvs list indexed so it's possible to
do lookups for LVs quickly, we can remove the LV_REMOVED flag as
that one won't be needed anymore - instead of checking the flag,
we can directly check the vg->removed_lvs list if the LV is present
there or not and to say if the LV is removed or not then. For now,
we don't have this index, but it may be implemented in the future.
---
lib/metadata/lv_manip.c | 2 +-
lib/metadata/metadata-exported.h | 2 ++
lib/metadata/metadata.c | 14 ++++++++++++++
lib/metadata/vg.c | 1 +
lib/metadata/vg.h | 5 +++++
tools/toollib.c | 5 +++++
6 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index b9cd056..99fb91f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5350,7 +5350,7 @@ int unlink_lv_from_vg(struct logical_volume *lv)
if (!(lvl = find_lv_in_vg(lv->vg, lv->name)))
return_0;
- dm_list_del(&lvl->list);
+ dm_list_move(&lv->vg->removed_lvs, &lvl->list);
lv->status |= LV_REMOVED;
return 1;
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 75cd94f..47fb9ae 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -125,6 +125,8 @@
be referenced on internal lists of LVs.
Any remaining references should check for
this flag and ignore the LV is set.
+ FIXME: Remove this flag once we have indexed
+ vg->removed_lvs for quick lookup.
*/
#define LV_ERROR_WHEN_FULL UINT64_C(0x0008000000000000) /* LV - error when full */
#define PV_ALLOCATION_PROHIBITED UINT64_C(0x0010000000000000) /* PV - internal use only - allocation prohibited
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 33ce370..a1a31eb 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2568,12 +2568,26 @@ int vg_validate(struct volume_group *vg)
r = 0;
}
+ dm_list_iterate_items(lvl, &vg->removed_lvs) {
+ if (!(lvl->lv->status & LV_REMOVED)) {
+ log_error(INTERNAL_ERROR "LV %s is not marked as removed while it's part "
+ "of removed LV list for VG %s", lvl->lv->name, vg->name);
+ r = 0;
+ }
+ }
+
/*
* Count all non-snapshot invisible LVs
*/
dm_list_iterate_items(lvl, &vg->lvs) {
lv_count++;
+ if (lvl->lv->status & LV_REMOVED) {
+ log_error(INTERNAL_ERROR "LV %s is marked as removed while it's "
+ "still part of the VG %s", lvl->lv->name, vg->name);
+ r = 0;
+ }
+
if (lvl->lv->status & LVM_WRITE_LOCKED) {
log_error(INTERNAL_ERROR "LV %s has external flag LVM_WRITE_LOCKED set internally.",
lvl->lv->name);
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 404cc6f..c9a7e9e 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -63,6 +63,7 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
dm_list_init(&vg->pvs_to_create);
dm_list_init(&vg->lvs);
dm_list_init(&vg->tags);
+ dm_list_init(&vg->removed_lvs);
dm_list_init(&vg->removed_pvs);
log_debug_mem("Allocated VG %s at %p.", vg->name, vg);
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index 67a04a0..b0ab122 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -113,6 +113,11 @@ struct volume_group {
*/
/*
+ * List of removed logical volumes by _lv_reduce.
+ */
+ struct dm_list removed_lvs;
+
+ /*
* List of removed physical volumes by pvreduce.
* They have to get cleared on vg_commit.
*/
diff --git a/tools/toollib.c b/tools/toollib.c
index be89450..142ff33 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -2061,6 +2061,11 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
}
dm_list_iterate_items(lvl, &final_lvs) {
+ /*
+ * FIXME: Once we have index over vg->removed_lvs, check directly
+ * LV presence there and remove LV_REMOVE flag/lv_is_removed fn
+ * as they won't be needed anymore.
+ */
if (lv_is_removed(lvl->lv))
continue;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c9f021de0b4d2c87…
Commit: c9f021de0b4d2c873ef5b97d17c602d0380359fd
Parent: 83587f0555d753bf0754d17bb6d4630111968e12
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 16 17:10:21 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Mar 24 08:43:07 2015 +0100
metadata: process_each_lv_in_vg: get the list of LVs to process first, then do the processing
This avoids a problem in which we're using selection on LV list - we
need to do the selection on initial state and not on any intermediary
state as we process LVs one by one - some of the relations among LVs
can be gone during this processing.
For example, processing one LV can cause the other LVs to lose the
relation to this LV and hence they're not selectable anymore with
the original selection criteria as it would be if we did selection
on inital state. A perfect example is with thin snapshots:
$ lvs -o lv_name,origin,layout,role vg
LV Origin Layout Role
lvol1 thin,sparse public,origin,thinorigin,multithinorigin
lvol2 lvol1 thin,sparse public,snapshot,thinsnapshot
lvol3 lvol1 thin,sparse public,snapshot,thinsnapshot
pool thin,pool private
$ lvremove -ff -S 'lv_name=lvol1 || origin=lvol1'
Logical volume "lvol1" successfully removed
The lvremove command above was supposed to remove lvol1 as well as
all its snapshots which have origin=lvol1. It failed to do so, because
once we removed the origin lvol1, the lvol2 and lvol3 which were
snapshots before are not snapshots anymore - the relations change
as we're processing these LVs one by one.
If we do the selection first and then execute any concrete actions on
these LVs (which is what this patch does), the behaviour is correct
then - the selection is done on the *initial state*:
$ lvremove -ff -S 'lv_name=lvol1 || origin=lvol1'
Logical volume "lvol1" successfully removed
Logical volume "lvol2" successfully removed
Logical volume "lvol3" successfully removed
Similarly for all the other situations in which relations among
LVs are being changed by processing the LVs one by one.
This patch also introduces LV_REMOVED internal LV status flag
to mark removed LVs so they're not processed further when we
iterate over collected list of LVs to be processed.
Previously, when we iterated directly over vg->lvs list to
process the LVs, we relied on the fact that once the LV is removed,
it is also removed from the vg->lvs list we're iterating over.
But that was incorrect as we shouldn't remove LVs from the list
during one iteration while we're iterating over that exact list
(dm_list_iterate_items safe can handle only one removal at
one iteration anyway, so it can't be used here).
---
WHATS_NEW | 1 +
lib/format_text/flags.c | 1 +
lib/metadata/lv_manip.c | 2 ++
lib/metadata/metadata-exported.h | 11 ++++++++++-
tools/toollib.c | 23 +++++++++++++++++++----
5 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 91c324e..4010e67 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.119 -
==================================
+ Fix LV processing with selection to always do the selection on initial state.
Version 2.02.118 - 23rd March 2015
==================================
diff --git a/lib/format_text/flags.c b/lib/format_text/flags.c
index a975606..bbd47c3 100644
--- a/lib/format_text/flags.c
+++ b/lib/format_text/flags.c
@@ -92,6 +92,7 @@ static const struct flag _lv_flags[] = {
{CACHE_POOL_DATA, NULL, 0},
{CACHE_POOL_METADATA, NULL, 0},
{LV_PENDING_DELETE, NULL, 0}, /* FIXME Display like COMPATIBLE_FLAG */
+ {LV_REMOVED, NULL, 0},
{0, NULL, 0}
};
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c9c1145..b9cd056 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5338,6 +5338,7 @@ int link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv)
lvl->lv = lv;
lv->vg = vg;
dm_list_add(&vg->lvs, &lvl->list);
+ lv->status &= ~LV_REMOVED;
return 1;
}
@@ -5350,6 +5351,7 @@ int unlink_lv_from_vg(struct logical_volume *lv)
return_0;
dm_list_del(&lvl->list);
+ lv->status |= LV_REMOVED;
return 1;
}
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 1555c87..75cd94f 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -119,11 +119,18 @@
#define CACHE UINT64_C(0x0001000000000000) /* LV - Internal use only */
#define LV_PENDING_DELETE UINT64_C(0x0004000000000000) /* LV - Internal use only */
+#define LV_REMOVED UINT64_C(0x0040000000000000) /* LV - Internal use only
+ This flag is used to mark an LV once it has
+ been removed from the VG. It might still
+ be referenced on internal lists of LVs.
+ Any remaining references should check for
+ this flag and ignore the LV is set.
+ */
#define LV_ERROR_WHEN_FULL UINT64_C(0x0008000000000000) /* LV - error when full */
#define PV_ALLOCATION_PROHIBITED UINT64_C(0x0010000000000000) /* PV - internal use only - allocation prohibited
e.g. to prohibit allocation of a RAID image
on a PV already holing an image of the RAID set */
-/* Next unused flag: UINT64_C(0x0040000000000000) */
+/* Next unused flag: UINT64_C(0x0080000000000000) */
/* Format features flags */
#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */
@@ -222,6 +229,8 @@
#define lv_is_rlog(lv) (((lv)->status & REPLICATOR_LOG) ? 1 : 0)
+#define lv_is_removed(lv) (((lv)->status & LV_REMOVED) ? 1 : 0)
+
int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
struct dm_list **layout, struct dm_list **role);
diff --git a/tools/toollib.c b/tools/toollib.c
index 4bd2339..be89450 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1957,6 +1957,10 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
unsigned lvargs_supplied = 0;
struct lv_list *lvl;
struct dm_str_list *sl;
+ struct dm_list final_lvs;
+ struct lv_list *final_lvl;
+
+ dm_list_init(&final_lvs);
if (!vg_check_status(vg, EXPORTED_VG)) {
ret_max = ECMD_FAILED;
@@ -1986,10 +1990,6 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
(tags_supplied && str_list_match_list(tags_in, &vg->tags, NULL)))
process_all = 1;
- /*
- * FIXME: In case of remove it goes through deleted entries,
- * but it works since entries are allocated from vg mem pool.
- */
dm_list_iterate_items(lvl, &vg->lvs) {
if (sigint_caught()) {
ret_max = ECMD_FAILED;
@@ -2049,6 +2049,21 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if (!process_lv)
continue;
+ log_very_verbose("Adding %s/%s to the list of LVs to be processed.", vg->name, lvl->lv->name);
+
+ if (!(final_lvl = dm_pool_zalloc(vg->vgmem, sizeof(struct lv_list)))) {
+ log_error("Failed to allocate final LV list item.");
+ ret_max = ECMD_FAILED;
+ goto_out;
+ }
+ final_lvl->lv = lvl->lv;
+ dm_list_add(&final_lvs, &final_lvl->list);
+ }
+
+ dm_list_iterate_items(lvl, &final_lvs) {
+ if (lv_is_removed(lvl->lv))
+ continue;
+
log_very_verbose("Processing LV %s in VG %s.", lvl->lv->name, vg->name);
ret = process_single_lv(cmd, lvl->lv, handle);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=efa5f89e80379982…
Commit: efa5f89e8037998219144c1ae9f7781e37afdc43
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2015-03-24 02:00 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2015-03-24 02:00 +0000
annotated tag: v2_02_118 has been created
at efa5f89e8037998219144c1ae9f7781e37afdc43 (tag)
tagging 8bb1dfdd323cb70160f37a2d3a4cba48d5243be7 (commit)
replaces v2_02_117
Release 2.02.118
83 files changed, 1153 insertions(+), 512 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlUQxTgACgkQIoGRwVZ+LBdgnACfTyP9aPeKczujHV6eDtFoh0zW
mGwAoKDbV78P5G6HfKhKqjFUVvk3yCTr
=LYtr
-----END PGP SIGNATURE-----
Alasdair G Kergon (15):
post-release
comments: Use full flag names.
metadata: Detect internal use of LVM_WRITE_LOCKED.
vgconvert: Check system ID compatibility.
vgchange: Additional system ID warnings.
systemid: Use temp status var for LVM_WRITE_LOCKED
format_text: Set system id directly.
metadata: Fix recent vg_validate message text.
cache: Retain orphans while global lock held.
systemid: Use correct mempool.
pvs: Hide inaccessible clustered PVs.
toollib: Reorder process_each_pv initialisation.
cache: Store metadata size and checksum.
format_text: Fix precommitted segfault.
pre-release
David Teigland (12):
system_id: enable the options in config file and command line
Revert "systemid: Add ACCESS_NEEDS_SYSTEM_ID VG flag."
system_id: make new VGs read-only for old lvm versions
system_id: undo the previous changes to the lvm1 code
system_id: avoid munging vg and lv fields
man: add info to lvmsystemid
tests: fix systemid uname test
system_id: detect an lvm1 system id
vgconvert: require lvmetad to not be used
WHATS_NEW vgconvert -M fix
tests: update to not run vgconvert -M with lvmetad
reporting: should not fail with foreign option if lvm1 pvs exist
Ondrej Kozina (2):
libdaemon: map error level properly
tests: add omitted --atomic mode in pvmove-restart
Peter Rajnoha (4):
report: fix seg_monitor field to display monitoring status for thick snapshots and mirrors
systemd: blk-availability.service: add After=iscsi-shutdown.service
lvmetad: pvscan: do not scan and read ignored MDAs from PVs
pvmove: use safe version of iteration when iterating over vg->lvs list in _poll_vg
Zdenek Kabelac (38):
devices: avoid extra open() syscall
lib: zero returned labeller struct
lib: return value
cleanup: add stack trace
lib: avoid reparsing same metadata
lib: reduce parsing in vgname_from_mda
lib: drop unneeded vg_read call
tests: slightly more efficient vgcreate
tests: speed of many PVS in a VG
display: fix return values
configure: check for sync-nand
tests: extend test timeout to 180sec
tests: enable kmsg by default
tests: cleanup some cxx warnings
tests: specify old mirror type
tests: drop old workaround
tests: extend race
makefiles: split gcc -W options
tests: do not leak in mem in destructor
tests: capture and print thrown errors
tests: drop unneeded comment
tests: update makefile
tests: update runner
tests: avoid loop on older system
tests: few more warnings for gcc only
tests: drop unused ""
tests: check for dmeventd first
tests: fix select report
tests: add ""
lvchange: disable persistent minors for pools
configure: detect st_ctim
lvm-file: wrapper to read ctim from stat
config: use timestamp with nanosecond precision
pvscan: check sysfs dev entry before rescan
makefiles: add more dirs for lcov
tests: export shell vars
tests: start clvmd without lib/
tests: revert should removal in mirror test
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8bb1dfdd323cb701…
Commit: 8bb1dfdd323cb70160f37a2d3a4cba48d5243be7
Parent: 192a83def3095b33b5590d0531d24a26588b4aef
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Mar 24 01:59:35 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Mar 24 01:59:35 2015 +0000
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 8 +++++---
WHATS_NEW_DM | 5 +++--
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/VERSION b/VERSION
index 4f24316..ef6bee0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.118(2)-git (2015-03-04)
+2.02.118(2)-git (2015-03-24)
diff --git a/VERSION_DM b/VERSION_DM
index 649324d..ca20a0d 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.95-git (2015-03-04)
+1.02.95-git (2015-03-24)
diff --git a/WHATS_NEW b/WHATS_NEW
index c9242fe..558bdb5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,5 @@
-Version 2.02.118 -
-=================================
+Version 2.02.118 - 23rd March 2015
+==================================
Store metadata size + checksum in lvmcache and add struct lvmcache_vgsummary.
Remove inaccessible clustered PVs from 'pvs -a'.
Don't invalidate cached orphan information while global lock is held.
@@ -14,11 +14,13 @@ Version 2.02.118 -
Avoid reparsing same metadata when reading same metadata from multiple PVs.
Save extra device open/close when scanning device for size.
Fix seg_monitor field to report status also for mirrors and thick snapshots.
+ Replace LVM_WRITE with LVM_WRITE_LOCKED flags in metadata if system ID is set.
+ Remove ACCESS_NEEDS_SYSTEM_ID VG status flag. (2.02.117)
+ Enable system ID features.
Version 2.02.117 - 4th March 2015
=================================
Add CFG_DISABLED for new system ID config settings that must not yet be used.
- Set ACCESS_NEEDS_SYSTEM_ID VG status flag while system_id is set.
Preserve original format type field when processing backup files.
Implement status action for lvm2-monitor initscript to display monitored LVs.
Allow lvchange -p to change kernel state only if metadata state differs.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 9286bc6..08975b6 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
-Version 1.02.95 -
-================================
+Version 1.02.95 - 15th March 2015
+=================================
+ Makefile regenerated.
Version 1.02.94 - 4th March 2015
================================
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6e7b24d34ff3da1c…
Commit: 6e7b24d34ff3da1c56718bb7def8a8ecd4258c43
Parent: 361e2d8df726e8428ed917939dab54643761b9e4
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 23 13:33:57 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Mar 23 13:40:39 2015 +0100
pvmove: use safe version of iteration when iterating over vg->lvs list in _poll_vg
When we're iterating over LVs in _poll_vg fn, we need to use the safe
version of iteration - the LV can be removed from the list which we're
just iterating over if we're finishing or aborting pvmove operation.
---
tools/polldaemon.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 10ca4a5..53dab96 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -192,7 +192,7 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
struct volume_group *vg, struct processing_handle *handle)
{
struct daemon_parms *parms = (struct daemon_parms *) handle->custom_handle;
- struct lv_list *lvl;
+ struct lv_list *lvl, *tmp_lvl;
struct logical_volume *lv;
const char *name;
int finished;
@@ -202,7 +202,7 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
return ECMD_FAILED;
}
- dm_list_iterate_items(lvl, &vg->lvs) {
+ dm_list_iterate_items_safe(lvl, tmp_lvl, &vg->lvs) {
lv = lvl->lv;
if (!(lv->status & parms->lv_type))
continue;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=361e2d8df726e842…
Commit: 361e2d8df726e8428ed917939dab54643761b9e4
Parent: 21343ffbfed94f41da11fac4dd056af58f4341a9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 20 11:08:44 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 20 11:08:44 2015 +0100
tests: revert should removal in mirror test
Since cluster test was actually not been working,
removal of should has been premature.
So restore 'should' back - bug in mirror code is still there.
---
test/shell/lvconvert-mirror-updown.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-mirror-updown.sh b/test/shell/lvconvert-mirror-updown.sh
index ddd34c7..4d401fb 100644
--- a/test/shell/lvconvert-mirror-updown.sh
+++ b/test/shell/lvconvert-mirror-updown.sh
@@ -29,6 +29,9 @@ lvconvert -m+1 -b $vg/$lv1 "$dev3"
lvs -a $vg
-lvconvert -m-1 $vg/$lv1 "$dev2"
+#
+# It fails so use 'should' and -vvvv for now
+#
+should lvconvert -vvvv -m-1 $vg/$lv1 "$dev2"
vgremove -f $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5bf74f2997cedb48…
Commit: 5bf74f2997cedb481e0fac21e3aa30fc61f8e5b1
Parent: 87941ccd1706ac9818f0f4828cade1d4cfae622d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 18 23:31:46 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 18 23:31:46 2015 +0000
pvs: Hide inaccessible clustered PVs.
Inaccessible clustered PVs can be hidden from pvs -a in the same way as
foreign PVs, rather than showing them as if they do not belong to a VG.
---
WHATS_NEW | 1 +
tools/toollib.c | 15 +++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2e50b18..b182925 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Remove inaccessible clustered PVs from 'pvs -a'.
Don't invalidate cached orphan information while global lock is held.
Avoid rescan of all devices when requested pvscan for removed device.
Measure configuration timestamps with nanoseconds when available.
diff --git a/tools/toollib.c b/tools/toollib.c
index 12fe1e2..98e5879 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -175,6 +175,7 @@ const char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name,
* and the command option has been used to ignore clustered vgs.
*
* Case c covers the other errors returned when reading the VG.
+ * If *skip is 1, it's OK for the caller to read the list of PVs in the VG.
*/
static int _ignore_vg(struct volume_group *vg, const char *vg_name,
struct dm_list *arg_vgnames, int allow_inconsistent, int *skip)
@@ -211,7 +212,14 @@ static int _ignore_vg(struct volume_group *vg, const char *vg_name,
}
}
+ if ((read_error == FAILED_CLUSTERED)) {
+ *skip = 1;
+ stack; /* Error already logged */
+ return 1;
+ }
+
if (read_error != SUCCESS) {
+ *skip = 0;
log_error("Cannot process volume group %s", vg_name);
return 1;
}
@@ -2718,8 +2726,11 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t flags,
if (_ignore_vg(vg, vg_name, NULL, flags & READ_ALLOW_INCONSISTENT, &skip)) {
stack;
ret_max = ECMD_FAILED;
- release_vg(vg);
- continue;
+ if (!skip) {
+ release_vg(vg);
+ continue;
+ }
+ /* Drop through to eliminate a clustered VG's PVs from the devices list */
}
/*
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=80f4b4b8039a88df…
Commit: 80f4b4b8039a88dfa2648a9b5bb5e16f41b81f87
Parent: 32a6c11877946bfc34a7af0821a793fd62f6bb36
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 18 23:20:09 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 18 23:20:09 2015 +0000
cache: Retain orphans while global lock held.
Fixes segfault when 'pvs' encounters two different PVs sharing the same
uuid but one an orphan, the other in a VG.
If VG_GLOBAL is held, there seems no point in doing a full scan more
than once.
If undesirable side-effects show up, we can try restricting this to
VG_GLOBAL READ locks. The original code dates back to 2.02.40.
---
WHATS_NEW | 1 +
lib/cache/lvmcache.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7d0038a..2e50b18 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Don't invalidate cached orphan information while global lock is held.
Avoid rescan of all devices when requested pvscan for removed device.
Measure configuration timestamps with nanoseconds when available.
Disable lvchange of major and minor of pool LVs.
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 6a9a05f..b8096d7 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -285,6 +285,9 @@ void lvmcache_commit_metadata(const char *vgname)
void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
{
+ if (lvmcache_vgname_is_locked(VG_GLOBAL))
+ return;
+
/* For VG_ORPHANS, we need to invalidate all labels on orphan PVs. */
if (!strcmp(vgname, VG_ORPHANS)) {
_drop_metadata(FMT_TEXT_ORPHAN_VG_NAME, 0);
@@ -293,7 +296,7 @@ void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
/* Indicate that PVs could now be missing from the cache */
init_full_scan_done(0);
- } else if (!lvmcache_vgname_is_locked(VG_GLOBAL))
+ } else
_drop_metadata(vgname, drop_precommitted);
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a10a11bd54d9f338…
Commit: a10a11bd54d9f33842eee8c168dc3c47aebec05b
Parent: 95fbbf4f40e8d0e9d9565f5a25f66a8127986822
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 17 09:44:26 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 18 13:42:13 2015 +0100
lvchange: disable persistent minors for pools
There is no reason to support persistent major/minor numbers
for pool volumes - it's only meant to be supported for filesystems
(since i.e. nfs may need to keep volume on a persistent device node.)
Support for pools is now explicitely disabled and documented.
---
WHATS_NEW | 1 +
man/lvchange.8.in | 1 +
test/shell/lvchange-cache.sh | 4 ++++
test/shell/lvchange-thin.sh | 5 +++--
tools/lvchange.c | 5 +++++
5 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d0a0c2d..0ce81fb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Disable lvchange of major and minor of pool LVs.
Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
Add After=iscsi-shutdown.service to blk-availability.service systemd unit.
Disallow vgconvert from changing metadata format when lvmetad is used.
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index fbae953..6b41c81 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -279,6 +279,7 @@ Do not use this if dmeventd is already monitoring a device.
.TP
.BR \-M ", " \-\-persistent " {" \fIy | \fIn }
Set to y to make the minor number specified persistent.
+Change of persistent numbers is not supported for pool volumes.
.TP
.BR \-p ", " \-\-permission " {" \fIr | \fIrw }
Change access permission to read-only or read/write.
diff --git a/test/shell/lvchange-cache.sh b/test/shell/lvchange-cache.sh
index 9959f93..20826fb 100644
--- a/test/shell/lvchange-cache.sh
+++ b/test/shell/lvchange-cache.sh
@@ -18,6 +18,10 @@ lvcreate --type cache-pool -an -v -L 2 -n cpool $vg
lvcreate -H -L 4 -n corigin --cachepool $vg/cpool
lvcreate -n noncache -l 1 $vg
+# cannot change major minor for pools
+not lvchange --yes -M y --minor 235 --major 253 $vg/cpool
+not lvchange -M n $vg/cpool
+
not lvchange --cachepolicy mq $vg/noncache
not lvchange --cachesettings foo=bar $vg/noncache
diff --git a/test/shell/lvchange-thin.sh b/test/shell/lvchange-thin.sh
index 4d33563..87919bc 100644
--- a/test/shell/lvchange-thin.sh
+++ b/test/shell/lvchange-thin.sh
@@ -54,8 +54,9 @@ lvchange -r auto $vg/$lv1
lvchange --yes -M y --minor 234 --major 253 $vg/$lv1
lvchange -M n $vg/$lv1
-lvchange --yes -M y --minor 235 --major 253 $vg/pool
-lvchange -M n $vg/pool
+# cannot change major minor for pools
+not lvchange --yes -M y --minor 235 --major 253 $vg/pool
+not lvchange -M n $vg/pool
# addtag_ARG
lvchange --addtag foo $vg/$lv1
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 5e90adc..096aae4 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -966,6 +966,11 @@ static int _lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_FAILED;
}
+ if (arg_count(cmd, persistent_ARG) && lv_is_pool(lv)) {
+ log_error("Persistent major and minor numbers are not supported with pools.");
+ return ECMD_FAILED;
+ }
+
/*
* FIXME: DEFAULT_BACKGROUND_POLLING should be "unspecified".
* If --poll is explicitly provided use it; otherwise polling
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=038013cf42710da3…
Commit: 038013cf42710da3e815713c7e7482fca00e110b
Parent: ff5217f85079fa8cc969e0a81a66f1e1bd6490b5
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 16 17:00:36 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Mar 16 17:00:36 2015 +0100
lvmetad: pvscan: do not scan and read ignored MDAs from PVs
Metadata areas which are marked as ignored should not be scanned
and read during pvscan --cache. Otherwise, this can cause lvmetad
to cache out-of-date metadata in case other PVs with fresh metadata
are missing by chance.
Make this to work like in non-lvmetad case where the behaviour would
be the same as if the PV was orphan (in case we have no other PVs
with valid non-ignored metadata areas).
---
WHATS_NEW | 1 +
lib/cache/lvmetad.c | 4 +++-
test/shell/lvmetad-pvscan-cache.sh | 13 +++++++++++++
3 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 97b562d..d0a0c2d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
Add After=iscsi-shutdown.service to blk-availability.service systemd unit.
Disallow vgconvert from changing metadata format when lvmetad is used.
Don't do a full read of VG when creating a new VG with an existing name.
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 08c58d2..d878c17 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -895,7 +895,9 @@ struct _lvmetad_pvscan_baton {
static int _lvmetad_pvscan_single(struct metadata_area *mda, void *baton)
{
struct _lvmetad_pvscan_baton *b = baton;
- struct volume_group *this = mda->ops->vg_read(b->fid, "", mda, 1);
+ struct volume_group *this;
+
+ this = mda_is_ignored(mda) ? NULL : mda->ops->vg_read(b->fid, "", mda, 1);
/* FIXME Also ensure contents match etc. */
if (!b->vg || this->seqno > b->vg->seqno)
diff --git a/test/shell/lvmetad-pvscan-cache.sh b/test/shell/lvmetad-pvscan-cache.sh
index 5c48817..75890a5 100644
--- a/test/shell/lvmetad-pvscan-cache.sh
+++ b/test/shell/lvmetad-pvscan-cache.sh
@@ -22,4 +22,17 @@ pvscan --cache
vgs | grep $vg1
+# When MDA is ignored on PV, do not read any VG
+# metadata from such PV as it may contain old
+# metadata which hasn't been updated for some
+# time and also since the MDA is marked as ignored,
+# it should really be *ignored*!
+pvchange --metadataignore y "$dev1"
+aux disable_dev "$dev2"
+pvscan --cache
+check pv_field "$dev1" vg_name ""
+aux enable_dev "$dev2"
+pvscan --cache
+check pv_field "$dev1" vg_name "$vg1"
+
vgremove -ff $vg1
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=05f23e77634b2ed3…
Commit: 05f23e77634b2ed3d7861511c07ed73a3bb6d096
Parent: c6d96efc38b2d1af9e81d96f27f17eea90fe7623
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 13 12:05:47 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 13 12:08:20 2015 +0100
systemd: blk-availability.service: add After=iscsi-shutdown.service
The iscsi-shutdown.service is the one responsible for logging out
iscsi sessions so blk-availability.service (running the blkdeactivate
script) should be run before that on shutdown (so we need to use
After=iscsi-shutdown.service because "After" relates to starting
the service and the opposite order is automatically applied on
stopping the service at shutdown).
---
WHATS_NEW | 1 +
.../blk_availability_systemd_red_hat.service.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b4fd415..97b562d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Add After=iscsi-shutdown.service to blk-availability.service systemd unit.
Disallow vgconvert from changing metadata format when lvmetad is used.
Don't do a full read of VG when creating a new VG with an existing name.
Reduce number of VG metadata parsing when looking for vgname on a PV.
diff --git a/scripts/blk_availability_systemd_red_hat.service.in b/scripts/blk_availability_systemd_red_hat.service.in
index 9c1cb78..3506738 100644
--- a/scripts/blk_availability_systemd_red_hat.service.in
+++ b/scripts/blk_availability_systemd_red_hat.service.in
@@ -1,6 +1,6 @@
[Unit]
Description=Availability of block devices
-After=lvm2-activation.service lvm2-lvmetad.service iscsi.service iscsid.service fcoe.service
+After=lvm2-activation.service lvm2-lvmetad.service iscsi-shutdown.service iscsi.service iscsid.service fcoe.service
DefaultDependencies=no
Conflicts=shutdown.target
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8a2b9f045fffd4e9…
Commit: 8a2b9f045fffd4e9d9450477b946af31dde5848f
Parent: ed2dcb796ffc0cac6cee38b5198816e77a3a3bfd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 19 17:08:33 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 11 11:02:35 2015 +0100
tests: extend race
Mark test as skipped, if the test could not be made.
---
test/shell/lvextend-snapshot-dmeventd.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvextend-snapshot-dmeventd.sh b/test/shell/lvextend-snapshot-dmeventd.sh
index 448df96..c944322 100644
--- a/test/shell/lvextend-snapshot-dmeventd.sh
+++ b/test/shell/lvextend-snapshot-dmeventd.sh
@@ -47,6 +47,10 @@ lvchange --monitor y $vg/snap
write_ 1000 1700
pre=$(percent_)
+# Normally the usage should be ~66% here, however on slower systems
+# dmeventd could be actually 'fast' enough to have COW already resized now
+# so mark test skipped if we are bellow 50% by now
+test $pre -gt 50 || skip
wait_for_change_ $pre
test $pre -gt $(percent_)
@@ -56,6 +60,8 @@ test $pre -gt $(percent_)
write_ 2700 2000
pre=$(percent_)
+# Mark test as skipped if already resized...
+test $pre -gt 70 || skip
wait_for_change_ $pre
test $pre -gt $(percent_)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f5cc96a54e9563b8…
Commit: f5cc96a54e9563b8aa5445a049facbe30a59fb39
Parent: 321e19d9cc868ae475ea1a0a4b026bf5b84ccd5a
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 10 09:38:43 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 10 09:38:43 2015 -0500
WHATS_NEW vgconvert -M fix
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 680879d..b4fd415 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Disallow vgconvert from changing metadata format when lvmetad is used.
Don't do a full read of VG when creating a new VG with an existing name.
Reduce number of VG metadata parsing when looking for vgname on a PV.
Avoid reparsing same metadata when reading same metadata from multiple PVs.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=321e19d9cc868ae4…
Commit: 321e19d9cc868ae475ea1a0a4b026bf5b84ccd5a
Parent: 5dbcbbea58508854904dafe054945ea48baa1642
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 10 09:31:54 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 10 09:31:54 2015 -0500
vgconvert: require lvmetad to not be used
lvmetad does not work with lvm1/format1 metadata,
and vgconvert -M converts to or from lvm1 metadata,
so disallow vgconvert -M when lvmetad is used.
---
tools/vgconvert.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/vgconvert.c b/tools/vgconvert.c
index 3742237..c4bb37a 100644
--- a/tools/vgconvert.c
+++ b/tools/vgconvert.c
@@ -214,6 +214,11 @@ int vgconvert(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
+ if (arg_is_set(cmd, metadatatype_ARG) && lvmetad_used()) {
+ log_error("lvmetad must be disabled to change metadata types.");
+ return EINVALID_CMD_LINE;
+ }
+
if (arg_int_value(cmd, labelsector_ARG, 0) >= LABEL_SCAN_SECTORS) {
log_error("labelsector must be less than %lu",
LABEL_SCAN_SECTORS);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=458b0210d1b41951…
Commit: 458b0210d1b4195171992f112aeb3a798d4509a3
Parent: 1334ea214ea1f55173f2ff7e3045cc72a8c4e7c7
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Mar 9 19:03:11 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Mar 9 19:03:11 2015 +0000
vgchange: Additional system ID warnings.
Also prompt before setting a system ID on a VG when none is set
on the host.
Put quotes round system ID in messages where it could be blank.
---
tools/vgchange.c | 57 ++++++++++++++++++++++++++++-------------------------
1 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 36b44a9..88a85d8 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -536,42 +536,45 @@ static int _vgchange_system_id(struct cmd_context *cmd, struct volume_group *vg)
}
if (!strcmp(vg->system_id, system_id)) {
- log_error("Volume Group system ID is already %s", vg->system_id);
+ log_error("Volume Group system ID is already \"%s\".", vg->system_id);
return 0;
}
- if (cmd->system_id && strcmp(system_id, cmd->system_id)) {
- if (!*system_id) {
- log_warn("WARNING: Removing the system ID allows unsafe access from other hosts.");
+ if (!*system_id && cmd->system_id && strcmp(system_id, cmd->system_id)) {
+ log_warn("WARNING: Removing the system ID allows unsafe access from other hosts.");
- if (!arg_count(cmd, yes_ARG) &&
- yes_no_prompt("Remove system ID %s on volume group %s? [y/n]: ",
- vg->system_id, vg->name) == 'n') {
- log_error("Volume group %s system ID not changed.", vg->name);
- return 0;
- }
- } else {
- if (lvs_in_vg_activated(vg)) {
- log_error("Logical Volumes in VG %s must be deactivated before system ID can be changed.",
- vg->name);
- return 0;
- }
+ if (!arg_count(cmd, yes_ARG) &&
+ yes_no_prompt("Remove system ID %s from volume group %s? [y/n]: ",
+ vg->system_id, vg->name) == 'n') {
+ log_error("System ID of volume group %s not changed.", vg->name);
+ return 0;
+ }
+ }
- log_warn("WARNING: Requested system ID %s does not match local system ID %s",
- system_id, cmd->system_id);
- log_warn("WARNING: Volume group %s might become inaccessible from this machine.",
- vg->name);
+ if (*system_id && (!cmd->system_id || strcmp(system_id, cmd->system_id))) {
+ if (lvs_in_vg_activated(vg)) {
+ log_error("Logical Volumes in VG %s must be deactivated before system ID can be changed.",
+ vg->name);
+ return 0;
+ }
- if (!arg_count(cmd, yes_ARG) &&
- yes_no_prompt("Set foreign system ID %s on volume group %s? [y/n]: ",
- system_id, vg->name) == 'n') {
- log_error("Volume group %s system ID not changed.", vg->name);
- return 0;
- }
+ if (cmd->system_id)
+ log_warn("WARNING: Requested system ID %s does not match local system ID %s.",
+ system_id, cmd->system_id ? : "");
+ else
+ log_warn("WARNING: No local system ID is set.");
+ log_warn("WARNING: Volume group %s might become inaccessible from this machine.",
+ vg->name);
+
+ if (!arg_count(cmd, yes_ARG) &&
+ yes_no_prompt("Set foreign system ID %s on volume group %s? [y/n]: ",
+ system_id, vg->name) == 'n') {
+ log_error("Volume group %s system ID not changed.", vg->name);
+ return 0;
}
}
- log_verbose("Changing system ID for VG %s from %s to %s.",
+ log_verbose("Changing system ID for VG %s from \"%s\" to \"%s\".",
vg->name, vg->system_id, system_id);
vg->system_id = system_id;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1334ea214ea1f551…
Commit: 1334ea214ea1f55173f2ff7e3045cc72a8c4e7c7
Parent: a8545462349c560cf66362cb3d25b44b7b0e819b
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Mar 9 19:01:12 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Mar 9 19:01:12 2015 +0000
vgconvert: Check system ID compatibility.
If system ID is set, don't switch to a format that doesn't support it.
---
tools/vgconvert.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/vgconvert.c b/tools/vgconvert.c
index 50b3e44..3742237 100644
--- a/tools/vgconvert.c
+++ b/tools/vgconvert.c
@@ -94,6 +94,13 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
return ECMD_FAILED;
}
+ /* New-style system ID supported? */
+ if (vg->system_id && *vg->system_id && (cmd->fmt->features & FMT_SYSTEMID_ON_PVS)) {
+ log_error("Unable to convert VG %s while it has a system ID set (%s).", vg->name,
+ vg->system_id);
+ return ECMD_FAILED;
+ }
+
/* Attempt to change any LVIDs that are too big */
if (cmd->fmt->features & FMT_RESTRICTED_LVIDS) {
dm_list_iterate_items(lvl, &vg->lvs) {
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=faccdeda83ee8c04…
Commit: faccdeda83ee8c04546a2224fa2dee82a55413fe
Parent: e9a233ee8ef362fccc5537125a19c28e5d596168
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Mar 9 18:53:22 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Mar 9 18:53:22 2015 +0000
comments: Use full flag names.
---
lib/format_text/export.c | 8 ++++----
lib/metadata/metadata-exported.h | 2 +-
lib/metadata/metadata.c | 14 +++++++-------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 2d985b4..018772e 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -411,8 +411,8 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
outfc(f, "# informational", "format = \"%s\"", fmt->name);
/*
- * Removing WRITE and adding WRITE_LOCKED makes it read-only
- * to old versions of lvm that only look for WRITE.
+ * Removing WRITE and adding LVM_WRITE_LOCKED makes it read-only
+ * to old versions of lvm that only look for LVM_WRITE.
*/
if ((status & LVM_WRITE) && vg_flag_write_locked(vg)) {
status &= ~LVM_WRITE;
@@ -630,8 +630,8 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv)
outf(f, "id = \"%s\"", buffer);
/*
- * Removing WRITE and adding WRITE_LOCKED makes it read-only
- * to old versions of lvm that only look for WRITE.
+ * Removing WRITE and adding LVM_WRITE_LOCKED makes it read-only
+ * to old versions of lvm that only look for LVM_WRITE.
*/
if ((status & LVM_WRITE) && vg_flag_write_locked(lv->vg)) {
status &= ~LVM_WRITE;
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index b5ab1f2..414216a 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -58,6 +58,7 @@
#define LVM_READ UINT64_C(0x0000000000000100) /* LV, VG */
#define LVM_WRITE UINT64_C(0x0000000000000200) /* LV, VG */
+#define LVM_WRITE_LOCKED UINT64_C(0x0020000000000000) /* LV, VG */
#define CLUSTERED UINT64_C(0x0000000000000400) /* VG */
//#define SHARED UINT64_C(0x0000000000000800) /* VG */
@@ -122,7 +123,6 @@
#define PV_ALLOCATION_PROHIBITED UINT64_C(0x0010000000000000) /* PV - internal use only - allocation prohibited
e.g. to prohibit allocation of a RAID image
on a PV already holing an image of the RAID set */
-#define LVM_WRITE_LOCKED UINT64_C(0x0020000000000000) /* VG, LV */
/* Next unused flag: UINT64_C(0x0040000000000000) */
/* Format features flags */
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index f495bdd..ab23d25 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4249,22 +4249,22 @@ int vg_check_write_mode(struct volume_group *vg)
/*
* Return 1 if the VG metadata should be written
- * *without* the WRITE flag in the status line, and
- * *with* the WRITE_LOCKED flag in the flags line.
+ * *without* the LVM_WRITE flag in the status line, and
+ * *with* the LVM_WRITE_LOCKED flag in the flags line.
*
* If this is done for a VG, it forces previous versions
- * of lvm (before the WRITE_LOCKED flag was added), to view
- * the VG and its LVs as read-only (because the WRITE flag
+ * of lvm (before the LVM_WRITE_LOCKED flag was added), to view
+ * the VG and its LVs as read-only (because the LVM_WRITE flag
* is missing). Versions of lvm that understand the
- * WRITE_LOCKED flag know to check the other methods of
+ * LVM_WRITE_LOCKED flag know to check the other methods of
* access control for the VG, specifically system_id and lock_type.
*
* So, if a VG has a system_id or lock_type, then the
* system_id and lock_type control access to the VG in
* addition to its basic writable status. Because previous
* lvm versions do not know about system_id or lock_type,
- * VGs depending on either of these should have WRITE_LOCKED
- * instead of WRITE to prevent the previous lvm versions from
+ * VGs depending on either of these should have LVM_WRITE_LOCKED
+ * instead of LVM_WRITE to prevent the previous lvm versions from
* assuming they can write the VG and its LVs.
*/
int vg_flag_write_locked(struct volume_group *vg)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e9a233ee8ef362fc…
Commit: e9a233ee8ef362fccc5537125a19c28e5d596168
Parent: 08371a8b8031b43394d80612d24029cfd4c710d4
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Mar 9 13:27:34 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Mar 9 13:27:34 2015 -0500
system_id: detect an lvm1 system id
Detect an lvm1 system id by looking at the WRITE_LOCKED flag.
Don't copy this lvm1 system id into vg->system_id so that the
restrictions associated with the new system id are not applied
to the old VG with the inherited lvm1 system id.
---
lib/format_text/import_vsn1.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 6afe71d..837af6b 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -812,6 +812,14 @@ static struct volume_group *_read_vg(struct format_instance *fid,
goto bad;
}
+ /*
+ * A system id without WRITE_LOCKED is an old lvm1 system id.
+ */
+ if (!(vg->status & LVM_WRITE_LOCKED) && system_id[0]) {
+ memcpy(vg->lvm1_system_id, system_id, NAME_LEN + 1);
+ memset(system_id, 0, NAME_LEN + 1);
+ }
+
if (vg->status & LVM_WRITE_LOCKED) {
vg->status |= LVM_WRITE;
vg->status &= ~LVM_WRITE_LOCKED;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=08371a8b8031b433…
Commit: 08371a8b8031b43394d80612d24029cfd4c710d4
Parent: 588b3bd7a16b19423f9c4d06b27a3cbe7ac9d623
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 6 09:55:24 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Mar 6 09:57:37 2015 -0600
tests: fix systemid uname test
The string reported by uname -n may include characters
that lvm omits from the system id (like parens, as seen
on a test machine.) Check against the final system id
string that lvm uses.
---
test/shell/system_id.sh | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
index 6e80c1a..6aa367b 100644
--- a/test/shell/system_id.sh
+++ b/test/shell/system_id.sh
@@ -38,12 +38,13 @@ fi
## uname
-SID=$(uname -n)
-if [ -n $SID ]; then
+SID1=$(uname -n)
+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 $SID
+check vg_field $vg1 systemid $SID2
vgremove $vg1
fi
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=588b3bd7a16b1942…
Commit: 588b3bd7a16b19423f9c4d06b27a3cbe7ac9d623
Parent: 85ef614b37bafd3c91c9fb6e6cfb6c40d6f80f99
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 6 14:29:26 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 6 14:29:26 2015 +0100
tests: speed of many PVS in a VG
---
test/shell/vgcreate-many-pvs.sh | 62 +++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/test/shell/vgcreate-many-pvs.sh b/test/shell/vgcreate-many-pvs.sh
new file mode 100644
index 0000000..c6d3852
--- /dev/null
+++ b/test/shell/vgcreate-many-pvs.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+# Copyright (C) 2015 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
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/inittest
+
+#
+# Test to exercise larger number of PVs in a VG
+# Related to https://bugzilla.redhat.com/show_bug.cgi?id=736027
+#
+# Original measured times of the whole test case before
+# and with the acceleration patch from my bare metal hw
+# (Lenovo T61, 2.2GHz, 4G RAM, rawhide 2015-03-06 with ndebug kernel):
+#
+# export LVM_TEST_PVS=300
+#
+# make check_local ~52sec (U:29s, S:13s)
+# make check_lvmetad ~20sec (U: 4s, S: 5s)
+#
+# With patch from 2015-03-06:
+#
+# make check_local ~30sec (U:10s, S:12s)
+# make check_lvmetad ~20sec (U: 4s, S: 5s)
+#
+
+# TODO: extend test suite to monitor performance and report regressions...
+
+# Use just 100 to get 'decent' speed on slow boxes
+LVM_TEST_PVS=${LVM_TEST_PVS:-100}
+
+#aux prepare_devs $LVM_TEST_PVS 8
+#vgcreate $vg $(< DEVICES)
+
+# prepare_vg is now directly using steps above
+aux prepare_vg $LVM_TEST_PVS
+
+# Check we have decent speed with typical commands
+vgs
+
+lvs
+
+pvs
+
+lvcreate -l1 -n $lv1 $vg
+
+lvremove -f $vg/$lv1
+
+vgremove -ff $vg
+
+#
+# TODO Turn this into another test case:
+#
+#for i in $(seq 1 $LVM_TEST_PVS); do
+# vgcreate ${vg}$i "$DM_DEV_DIR/mapper/${PREFIX}pv$i"
+#done
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=04101bc4307e14f7…
Commit: 04101bc4307e14f71f6ca3a1d253761f82e6a76e
Parent: a9b28a4f2105b92fdfc9f3915859e0deec4004a0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 6 10:22:33 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 6 14:05:06 2015 +0100
lib: drop unneeded vg_read call
Since we take a lock inside vg_lock_newname() and we do a full
detection of presence of vgname inside all scanned labels,
there is no point to do this for second time to be sure
there is no such vg.
The only side-effect of such call would be a full validation of
some already exising VG metadata - but that's not the task for
vgcreate when create a new VG.
This call noticable reduces number of scans during 'vgcreate'.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 10 ----------
2 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9bf8699..680879d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Don't do a full read of VG when creating a new VG with an existing name.
Reduce number of VG metadata parsing when looking for vgname on a PV.
Avoid reparsing same metadata when reading same metadata from multiple PVs.
Save extra device open/close when scanning device for size.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 57066a5..f495bdd 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1009,7 +1009,6 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name)
.context.vg_ref.vg_name = vg_name
};
struct format_instance *fid;
- int consistent = 0;
uint32_t rc;
if (!validate_name(vg_name)) {
@@ -1023,15 +1022,6 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name)
/* NOTE: let caller decide - this may be check for existence */
return _vg_make_handle(cmd, NULL, rc);
- /* FIXME: Is this vg_read_internal necessary? Move it inside
- vg_lock_newname? */
- /* is this vg name already in use ? */
- if ((vg = vg_read_internal(cmd, vg_name, NULL, WARN_PV_READ, &consistent))) {
- log_error("A volume group called '%s' already exists.", vg_name);
- unlock_and_release_vg(cmd, vg, vg_name);
- return _vg_make_handle(cmd, NULL, FAILED_EXIST);
- }
-
/* Strip dev_dir if present */
vg_name = strip_dir(vg_name, cmd->dev_dir);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b48ff3b94e7cd771…
Commit: b48ff3b94e7cd771bbaf42f38b546054d02bc0f2
Parent: 5e25bca1a98f2376b94904a2e220a3e2f68923ad
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Mar 5 12:12:42 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Mar 5 12:12:42 2015 -0600
man: add info to lvmsystemid
about losing access to a VG if lvm is downgraded
to an earlier version.
---
man/lvmsystemid.7.in | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/man/lvmsystemid.7.in b/man/lvmsystemid.7.in
index 0881b1e..76b0e83 100644
--- a/man/lvmsystemid.7.in
+++ b/man/lvmsystemid.7.in
@@ -42,13 +42,7 @@ maximum length of a system_id is 128 characters.
To benefit fully from system_id, all hosts must have system_id set, and
VGs must have system_id set. A VG on shared storage can be damaged or
-destroyed in the following cases which the user must be careful to avoid:
-
-.IP \[bu] 2
-A host using an old version of lvm without the system_id feature will not
-recognize the system_id of other hosts' VGs. VGs with a new system_id
-are nominally protected from old versions of lvm by appearing to be
-read-only to the old versions.
+destroyed in some cases which the user must be careful to avoid.
.IP \[bu] 2
A VG without a system_id can be used without restriction from any host,
@@ -73,6 +67,19 @@ operations and corrupting the PVs. See the
.B orphans
section for more information.
+.IP \[bu] 2
+A host using an old version of lvm without the system_id feature will not
+recognize a new system_id in VGs from other hosts. Even though the old
+version of lvm is not blocked from reading a VG with a system_id, it is
+blocked from writing to the VG (or its LVs). The new system_id changes
+the write mode of a VG, making it appear read-only to previous lvm
+versions.
+
+This also means that if a host downgrades its version of lvm, it would
+lose access to any VGs it had created with a system_id. To avoid this,
+the system_id should be removed from VGs before downgrading to an lvm
+version without the system_id feature.
+
.P
.SS Types of VG access
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1e65fdd9ba00ab24…
Commit: 1e65fdd9ba00ab249ab07d8b5815c398ded556e3
Parent: c6a57dc4f3af6aa8912fc1f969937e3e3c47f725
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Mar 4 11:30:53 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Mar 5 09:50:43 2015 -0600
system_id: make new VGs read-only for old lvm versions
Previous versions of lvm will not obey the restrictions
imposed by the new system_id, and would allow such a VG
to be written. So, a VG with a new system_id is further
changed to force previous lvm versions to treat it as
read-only. This is done by removing the WRITE flag from
the metadata status line of these VGs, and putting a new
WRITE_LOCKED flag in the flags line of the metadata.
Versions of lvm that recognize WRITE_LOCKED, also obey the
new system_id. For these lvm versions, WRITE_LOCKED is
identical to WRITE, and the rules associated with matching
system_id's are imposed.
A new VG lock_type field is also added that causes the same
WRITE/WRITE_LOCKED transformation when set. A previous
version of lvm will also see a VG with lock_type as read-only.
Versions of lvm that recognize WRITE_LOCKED, must also obey
the lock_type setting. Until the lock_type feature is added,
lvm will fail to read any VG with lock_type set and report an
error about an unsupported lock_type. Once the lock_type
feature is added, lvm will allow VGs with lock_type to be
used according to the rules imposed by the lock_type.
When both system_id and lock_type settings are removed, a VG
is written with the old WRITE status flag, and without the
new WRITE_LOCKED flag. This allows old versions of lvm to
use the VG as before.
---
lib/format1/disk-rep.h | 2 +
lib/format1/import-export.c | 16 ++++++++++-
lib/format_text/export.c | 31 ++++++++++++++++++++++
lib/format_text/flags.c | 2 +
lib/format_text/import_vsn1.c | 15 ++++++++++
lib/metadata/metadata-exported.h | 5 +++-
lib/metadata/metadata.c | 53 ++++++++++++++++++++++++++++++++++++++
lib/metadata/vg.h | 1 +
man/lvmsystemid.7.in | 5 ++-
9 files changed, 125 insertions(+), 5 deletions(-)
diff --git a/lib/format1/disk-rep.h b/lib/format1/disk-rep.h
index 9d1c8a5..37f7282 100644
--- a/lib/format1/disk-rep.h
+++ b/lib/format1/disk-rep.h
@@ -41,6 +41,7 @@
#define VG_WRITE 0x02 /* " */
#define VG_CLUSTERED 0x04 /* " */
#define VG_SHARED 0x08 /* " */
+#define VG_WRITE_LOCKED 0x10 /* " */
/* logical volume */
#define LV_ACTIVE 0x01 /* lv_status */
@@ -51,6 +52,7 @@
#define LV_WRITE 0x02 /* " */
#define LV_SNAPSHOT 0x04 /* " */
#define LV_SNAPSHOT_ORG 0x08 /* " */
+#define LV_WRITE_LOCKED 0x10 /* " */
#define LV_BADBLOCK_ON 0x01 /* lv_badblock */
diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c
index 9b387e2..b898e65 100644
--- a/lib/format1/import-export.c
+++ b/lib/format1/import-export.c
@@ -242,6 +242,9 @@ int import_vg(struct dm_pool *mem,
if (vgd->vg_access & VG_WRITE)
vg->status |= LVM_WRITE;
+ if (vgd->vg_access & VG_WRITE_LOCKED)
+ vg->status |= LVM_WRITE;
+
if (vgd->vg_access & VG_CLUSTERED)
vg->status |= CLUSTERED;
@@ -266,9 +269,12 @@ int export_vg(struct vg_disk *vgd, struct volume_group *vg)
if (vg->status & LVM_READ)
vgd->vg_access |= VG_READ;
- if (vg->status & LVM_WRITE)
+ if ((vg->status & LVM_WRITE) && !vg_flag_write_locked(vg))
vgd->vg_access |= VG_WRITE;
+ if ((vg->status & LVM_WRITE) && vg_flag_write_locked(vg))
+ vgd->vg_access |= VG_WRITE_LOCKED;
+
if (vg_is_clustered(vg))
vgd->vg_access |= VG_CLUSTERED;
@@ -320,6 +326,9 @@ int import_lv(struct cmd_context *cmd, struct dm_pool *mem,
if (lvd->lv_access & LV_WRITE)
lv->status |= LVM_WRITE;
+ if (lvd->lv_access & LV_WRITE_LOCKED)
+ lv->status |= LVM_WRITE;
+
if (lvd->lv_badblock)
lv->status |= BADBLOCK_ON;
@@ -352,9 +361,12 @@ static void _export_lv(struct lv_disk *lvd, struct volume_group *vg,
if (lv->status & LVM_READ)
lvd->lv_access |= LV_READ;
- if (lv->status & LVM_WRITE)
+ if ((lv->status & LVM_WRITE) && !vg_flag_write_locked(vg))
lvd->lv_access |= LV_WRITE;
+ if ((lv->status & LVM_WRITE) && vg_flag_write_locked(vg))
+ lvd->lv_access |= LV_WRITE_LOCKED;
+
if (lv->status & SPINDOWN_LV)
lvd->lv_status |= LV_SPINDOWN;
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 8232e2f..ec01fcc 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -409,9 +409,23 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
if (fmt)
outfc(f, "# informational", "format = \"%s\"", fmt->name);
+ /*
+ * Removing WRITE and adding WRITE_LOCKED makes it read-only
+ * to old versions of lvm that only look for WRITE.
+ */
+ if ((vg->status & LVM_WRITE) && vg_flag_write_locked(vg)) {
+ vg->status &= ~LVM_WRITE;
+ vg->status |= LVM_WRITE_LOCKED;
+ }
+
if (!_print_flag_config(f, vg->status, VG_FLAGS))
return_0;
+ if (vg->status & LVM_WRITE_LOCKED) {
+ vg->status |= LVM_WRITE;
+ vg->status &= ~LVM_WRITE_LOCKED;
+ }
+
if (!_out_tags(f, &vg->tags))
return_0;
@@ -420,6 +434,9 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
else if (vg->lvm1_system_id && *vg->lvm1_system_id)
outf(f, "system_id = \"%s\"", vg->lvm1_system_id);
+ if (vg->lock_type)
+ outf(f, "lock_type = \"%s\"", vg->lock_type);
+
outsize(f, (uint64_t) vg->extent_size, "extent_size = %u",
vg->extent_size);
outf(f, "max_lv = %u", vg->max_lv);
@@ -615,9 +632,23 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv)
outf(f, "id = \"%s\"", buffer);
+ /*
+ * Removing WRITE and adding WRITE_LOCKED makes it read-only
+ * to old versions of lvm that only look for WRITE.
+ */
+ if ((lv->status & LVM_WRITE) && vg_flag_write_locked(lv->vg)) {
+ lv->status &= ~LVM_WRITE;
+ lv->status |= LVM_WRITE_LOCKED;
+ }
+
if (!_print_flag_config(f, lv->status, LV_FLAGS))
return_0;
+ if (lv->status & LVM_WRITE_LOCKED) {
+ lv->status |= LVM_WRITE;
+ lv->status &= ~LVM_WRITE_LOCKED;
+ }
+
if (!_out_tags(f, &lv->tags))
return_0;
diff --git a/lib/format_text/flags.c b/lib/format_text/flags.c
index cf01271..a975606 100644
--- a/lib/format_text/flags.c
+++ b/lib/format_text/flags.c
@@ -34,6 +34,7 @@ static const struct flag _vg_flags[] = {
{PVMOVE, "PVMOVE", STATUS_FLAG},
{LVM_READ, "READ", STATUS_FLAG},
{LVM_WRITE, "WRITE", STATUS_FLAG},
+ {LVM_WRITE_LOCKED, "WRITE_LOCKED", COMPATIBLE_FLAG},
{CLUSTERED, "CLUSTERED", STATUS_FLAG},
{SHARED, "SHARED", STATUS_FLAG},
{PARTIAL_VG, NULL, 0},
@@ -53,6 +54,7 @@ static const struct flag _pv_flags[] = {
static const struct flag _lv_flags[] = {
{LVM_READ, "READ", STATUS_FLAG},
{LVM_WRITE, "WRITE", STATUS_FLAG},
+ {LVM_WRITE_LOCKED, "WRITE_LOCKED", COMPATIBLE_FLAG},
{FIXED_MINOR, "FIXED_MINOR", STATUS_FLAG},
{VISIBLE_LV, "VISIBLE", STATUS_FLAG},
{PVMOVE, "PVMOVE", STATUS_FLAG},
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 64c08a0..6afe71d 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -550,6 +550,11 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
return 0;
}
+ if (lv->status & LVM_WRITE_LOCKED) {
+ lv->status |= LVM_WRITE;
+ lv->status &= ~LVM_WRITE_LOCKED;
+ }
+
if (dm_config_has_node(lvn, "creation_time")) {
if (!_read_uint64(lvn, "creation_time", ×tamp)) {
log_error("Invalid creation_time for logical volume %s.",
@@ -785,6 +790,11 @@ static struct volume_group *_read_vg(struct format_instance *fid,
if (dm_config_get_str(vgn, "system_id", &str))
strncpy(system_id, str, NAME_LEN);
+ if (dm_config_get_str(vgn, "lock_type", &str)) {
+ if (!(vg->lock_type = dm_pool_strdup(vg->vgmem, str)))
+ goto bad;
+ }
+
if (!_read_id(&vg->id, vgn, "id")) {
log_error("Couldn't read uuid for volume group %s.", vg->name);
goto bad;
@@ -802,6 +812,11 @@ static struct volume_group *_read_vg(struct format_instance *fid,
goto bad;
}
+ if (vg->status & LVM_WRITE_LOCKED) {
+ vg->status |= LVM_WRITE;
+ vg->status &= ~LVM_WRITE_LOCKED;
+ }
+
if (!_read_int32(vgn, "extent_size", &vg->extent_size)) {
log_error("Couldn't read extent size for volume group %s.",
vg->name);
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 758fa53..8c081d9 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -122,7 +122,8 @@
#define PV_ALLOCATION_PROHIBITED UINT64_C(0x0010000000000000) /* PV - internal use only - allocation prohibited
e.g. to prohibit allocation of a RAID image
on a PV already holing an image of the RAID set */
-/* Next unused flag: UINT64_C(0x0020000000000000) */
+#define LVM_WRITE_LOCKED UINT64_C(0x0020000000000000) /* VG, LV */
+/* Next unused flag: UINT64_C(0x0040000000000000) */
/* Format features flags */
#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */
@@ -170,6 +171,7 @@
#define FAILED_EXIST 0x00000100U
#define FAILED_RECOVERY 0x00000200U
#define FAILED_SYSTEMID 0x00000400U
+#define FAILED_LOCK_TYPE 0x00000800U
#define SUCCESS 0x00000000U
#define VGMETADATACOPIES_ALL UINT32_MAX
@@ -1167,6 +1169,7 @@ char *generate_lv_name(struct volume_group *vg, const char *format,
int pv_change_metadataignore(struct physical_volume *pv, uint32_t mda_ignore);
+int vg_flag_write_locked(struct volume_group *vg);
int vg_check_write_mode(struct volume_group *vg);
#define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)
#define vg_is_exported(vg) (vg_status((vg)) & EXPORTED_VG)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 68651f5..7e440a4 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4257,6 +4257,37 @@ int vg_check_write_mode(struct volume_group *vg)
}
/*
+ * Return 1 if the VG metadata should be written
+ * *without* the WRITE flag in the status line, and
+ * *with* the WRITE_LOCKED flag in the flags line.
+ *
+ * If this is done for a VG, it forces previous versions
+ * of lvm (before the WRITE_LOCKED flag was added), to view
+ * the VG and its LVs as read-only (because the WRITE flag
+ * is missing). Versions of lvm that understand the
+ * WRITE_LOCKED flag know to check the other methods of
+ * access control for the VG, specifically system_id and lock_type.
+ *
+ * So, if a VG has a system_id or lock_type, then the
+ * system_id and lock_type control access to the VG in
+ * addition to its basic writable status. Because previous
+ * lvm versions do not know about system_id or lock_type,
+ * VGs depending on either of these should have WRITE_LOCKED
+ * instead of WRITE to prevent the previous lvm versions from
+ * assuming they can write the VG and its LVs.
+ */
+int vg_flag_write_locked(struct volume_group *vg)
+{
+ if (vg->system_id && vg->system_id[0])
+ return 1;
+
+ if (vg->lock_type && vg->lock_type[0] && strcmp(vg->lock_type, "none"))
+ return 1;
+
+ return 0;
+}
+
+/*
* Performs a set of checks against a VG according to bits set in status
* and returns FAILED_* bits for those that aren't acceptable.
*
@@ -4377,6 +4408,23 @@ static int _access_vg_clustered(struct cmd_context *cmd, struct volume_group *vg
return 1;
}
+static int _access_vg_lock_type(struct cmd_context *cmd, struct volume_group *vg)
+{
+ if (!is_real_vg(vg->name))
+ return 1;
+
+ /*
+ * Until lock_type support is added, reject any VG that has a lock_type.
+ */
+ if (vg->lock_type && vg->lock_type[0] && strcmp(vg->lock_type, "none")) {
+ log_error("Cannot access VG %s with unsupported lock_type %s.",
+ vg->name, vg->lock_type);
+ return 0;
+ }
+
+ return 1;
+}
+
static int _access_vg_systemid(struct cmd_context *cmd, struct volume_group *vg)
{
/*
@@ -4468,6 +4516,11 @@ static int _vg_access_permitted(struct cmd_context *cmd, struct volume_group *vg
return 0;
}
+ if (!_access_vg_lock_type(cmd, vg)) {
+ *failure |= FAILED_LOCK_TYPE;
+ return 0;
+ }
+
if (!_access_vg_systemid(cmd, vg)) {
*failure |= FAILED_SYSTEMID;
return 0;
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index 2467721..67a04a0 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -70,6 +70,7 @@ struct volume_group {
const char *old_name; /* Set during vgrename and vgcfgrestore */
const char *system_id;
char *lvm1_system_id;
+ const char *lock_type;
uint32_t extent_size;
uint32_t extent_count;
diff --git a/man/lvmsystemid.7.in b/man/lvmsystemid.7.in
index c5e69be..0881b1e 100644
--- a/man/lvmsystemid.7.in
+++ b/man/lvmsystemid.7.in
@@ -46,8 +46,9 @@ destroyed in the following cases which the user must be careful to avoid:
.IP \[bu] 2
A host using an old version of lvm without the system_id feature will not
-recognize the system_id of other hosts' VGs and will not be stopped from
-using them.
+recognize the system_id of other hosts' VGs. VGs with a new system_id
+are nominally protected from old versions of lvm by appearing to be
+read-only to the old versions.
.IP \[bu] 2
A VG without a system_id can be used without restriction from any host,
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=190d591fbec672a2…
Commit: 190d591fbec672a2e1f77d4709fcee75cc695a06
Parent: 56606b5f21682cfb8f36aef419f0cb7dcf55cce9
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 5 10:45:29 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 5 14:05:34 2015 +0100
report: fix seg_monitor field to display monitoring status for thick snapshots and mirrors
The seg_monitor did not display monitored status for thick snapshots
and mirrors (with mirror log *not* mirrored). The seg monitor did work
correctly even before for other segtypes - thins and raids.
Before (mirrors and snapshots, only mirrors with mirrored log properly displayed monitoring status):
[0] f21/~ # lvs -a -o lv_name,lv_layout,lv_role,seg_monitor vg
LV Layout Role Monitor
mirror mirror public
[mirror_mimage_0] linear private,mirror,image
[mirror_mimage_1] linear private,mirror,image
[mirror_mlog] linear private,mirror,log
mirror_with_mirror_log mirror public monitored
[mirror_with_mirror_log_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mimage_1] linear private,mirror,image
[mirror_with_mirror_log_mlog] mirror private,mirror,log monitored
[mirror_with_mirror_log_mlog_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mlog_mimage_1] linear private,mirror,image
thick_origin linear public,origin,thickorigin
thick_snapshot linear public,snapshot,thicksnapshot
With this patch applied (monitoring status displayed for all mirrors and snapshots):
[0] f21/~ # lvs -a -o lv_name,lv_layout,lv_role,seg_monitor vg
LV Layout Role Monitor
mirror mirror public monitored
[mirror_mimage_0] linear private,mirror,image
[mirror_mimage_1] linear private,mirror,image
[mirror_mlog] linear private,mirror,log
mirror_with_mirror_log mirror public monitored
[mirror_with_mirror_log_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mimage_1] linear private,mirror,image
[mirror_with_mirror_log_mlog] mirror private,mirror,log monitored
[mirror_with_mirror_log_mlog_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mlog_mimage_1] linear private,mirror,image
thick_origin linear public,origin,thickorigin
thick_snapshot linear public,snapshot,thicksnapshot monitored
---
WHATS_NEW | 1 +
lib/metadata/lv.c | 2 --
lib/report/report.c | 10 +++++-----
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f597980..46783e1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Fix seg_monitor field to report status also for mirrors and thick snapshots.
Version 2.02.117 - 4th March 2015
=================================
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index c3c5d4a..10ce906 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -152,8 +152,6 @@ char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg)
if (lv_is_cow(seg->lv) && !lv_is_merging_cow(seg->lv))
segm = first_seg(seg->lv->snapshot->lv);
- else if (seg->log_lv)
- segm = first_seg(seg->log_lv);
// log_debug("Query LV:%s mon:%s segm:%s tgtm:%p segmon:%d statusm:%d", seg->lv->name, segm->lv->name, segm->segtype->name, segm->segtype->ops->target_monitored, seg_monitored(segm), (int)(segm->status & PVMOVE));
if ((dmeventd_monitor_mode() != 1) ||
diff --git a/lib/report/report.c b/lib/report/report.c
index 75928c0..4ef2b04 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -791,14 +791,14 @@ static int _segmonitor_disp(struct dm_report *rh, struct dm_pool *mem,
const struct lv_segment *seg = (const struct lv_segment *)data;
char *str;
- if (!seg->segtype->ops || !seg->segtype->ops->target_monitored)
- return _field_set_value(field, GET_FIRST_RESERVED_NAME(seg_monitor_undef),
- GET_FIELD_RESERVED_VALUE(seg_monitor_undef));
-
if (!(str = lvseg_monitor_dup(mem, seg)))
return_0;
- return _field_set_value(field, str, NULL);
+ if (*str)
+ return _field_set_value(field, str, NULL);
+
+ return _field_set_value(field, GET_FIRST_RESERVED_NAME(seg_monitor_undef),
+ GET_FIELD_RESERVED_VALUE(seg_monitor_undef));
}
static int _segstart_disp(struct dm_report *rh, struct dm_pool *mem,
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=94d85f815e0ba1f0…
Commit: 94d85f815e0ba1f06f7cb9c4c4e9e97468c970a6
Parent: 56606b5f21682cfb8f36aef419f0cb7dcf55cce9
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 5 10:45:29 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 5 10:54:25 2015 +0100
report: fix seg_monitor field to display monitoring status for thin snapshots and mirrors
The seg_monitor did not display monitored status for thick snapshots
and mirrors (with mirror log *not* mirrored). The seg monitor did work
correctly even before for other segtypes - thins and raids.
Before (mirrors and snapshots, only mirrors with mirrored log properly displayed monitoring status):
[0] f21/~ # lvs -a -o lv_name,lv_layout,lv_role,seg_monitor vg
LV Layout Role Monitor
mirror mirror public
[mirror_mimage_0] linear private,mirror,image
[mirror_mimage_1] linear private,mirror,image
[mirror_mlog] linear private,mirror,log
mirror_with_mirror_log mirror public monitored
[mirror_with_mirror_log_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mimage_1] linear private,mirror,image
[mirror_with_mirror_log_mlog] mirror private,mirror,log monitored
[mirror_with_mirror_log_mlog_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mlog_mimage_1] linear private,mirror,image
thick_origin linear public,origin,thickorigin
thick_snapshot linear public,snapshot,thicksnapshot
With this patch applied (monitoring status displayed for all mirrors and snapshots):
[0] f21/~ # lvs -a -o lv_name,lv_layout,lv_role,seg_monitor vg
LV Layout Role Monitor
mirror mirror public monitored
[mirror_mimage_0] linear private,mirror,image
[mirror_mimage_1] linear private,mirror,image
[mirror_mlog] linear private,mirror,log
mirror_with_mirror_log mirror public monitored
[mirror_with_mirror_log_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mimage_1] linear private,mirror,image
[mirror_with_mirror_log_mlog] mirror private,mirror,log monitored
[mirror_with_mirror_log_mlog_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mlog_mimage_1] linear private,mirror,image
thick_origin linear public,origin,thickorigin
thick_snapshot linear public,snapshot,thicksnapshot monitored
---
WHATS_NEW | 1 +
lib/metadata/lv.c | 2 --
lib/report/report.c | 10 +++++-----
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f597980..46783e1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Fix seg_monitor field to report status also for mirrors and thick snapshots.
Version 2.02.117 - 4th March 2015
=================================
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index c3c5d4a..10ce906 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -152,8 +152,6 @@ char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg)
if (lv_is_cow(seg->lv) && !lv_is_merging_cow(seg->lv))
segm = first_seg(seg->lv->snapshot->lv);
- else if (seg->log_lv)
- segm = first_seg(seg->log_lv);
// log_debug("Query LV:%s mon:%s segm:%s tgtm:%p segmon:%d statusm:%d", seg->lv->name, segm->lv->name, segm->segtype->name, segm->segtype->ops->target_monitored, seg_monitored(segm), (int)(segm->status & PVMOVE));
if ((dmeventd_monitor_mode() != 1) ||
diff --git a/lib/report/report.c b/lib/report/report.c
index 75928c0..4ef2b04 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -791,14 +791,14 @@ static int _segmonitor_disp(struct dm_report *rh, struct dm_pool *mem,
const struct lv_segment *seg = (const struct lv_segment *)data;
char *str;
- if (!seg->segtype->ops || !seg->segtype->ops->target_monitored)
- return _field_set_value(field, GET_FIRST_RESERVED_NAME(seg_monitor_undef),
- GET_FIELD_RESERVED_VALUE(seg_monitor_undef));
-
if (!(str = lvseg_monitor_dup(mem, seg)))
return_0;
- return _field_set_value(field, str, NULL);
+ if (*str)
+ return _field_set_value(field, str, NULL);
+
+ return _field_set_value(field, GET_FIRST_RESERVED_NAME(seg_monitor_undef),
+ GET_FIELD_RESERVED_VALUE(seg_monitor_undef));
}
static int _segstart_disp(struct dm_report *rh, struct dm_pool *mem,
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e518dc4ec835a03a…
Commit: e518dc4ec835a03a044ae169bf283e983f27d4c1
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2015-03-04 13:51 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2015-03-04 13:51 +0000
annotated tag: v2_02_117 has been created
at e518dc4ec835a03a044ae169bf283e983f27d4c1 (tag)
tagging 930fa3290debbdecca44f334426d960e3160e7bf (commit)
replaces v2_02_116
Release 2.02.117.
148 files changed, 6636 insertions(+), 1287 deletions(-)
The system ID documentation included in this release relates
to code that is still under development and the code that
lets you set a system ID has not yet been enabled.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlT3DvIACgkQIoGRwVZ+LBfbhgCeLj1aGiB48lVV/l8PI8naYXpm
VVcAoLmX+qnzBHk72FALuof6y4r4j8OK
=Mk0s
-----END PGP SIGNATURE-----
Alasdair G Kergon (34):
post-release
pvchange: Use process_each_pv.
conf: Set default global/etc from --with-confdir.
lvmetad: Add fn to scan only foreign VGs.
lvm-string: Fix HYPEN typo.
systemid: Add built-in systemid command.
config: Reinstate recursive tags setting.
format_text: Store creation_host_system_id.
format_text: Fix creation_host_system_id.
systemid: Require alphanumeric 1st character.
toolcontext: Move lvmlocal.conf loading.
toolcontext: Include system_id in refresh.
systemid: Add warnings if invalid.
systemid: Define file content more precisely.
config: Adjust system_id defaults.
config: Rename allow_system_id to extra_system_ids.
lvm1: Reenable sys ID.
systemid: Fix access restrictions.
systemid: Extend --foreign to reporting commands.
systemid: Allow empty systemid with warnings.
systemid: Improve concurrent warning.
example.conf: Update systemid comments.
toolcontext: Fix lvmlocal.conf load fail path.
lvchange: Allow -prw to change kernel only.
mirror: Avoid region size compiler warning.
mirror: Explicit cast in region_size_max
lvchange: Allow -pr to change kernel only.
archives: Preserve format type in file.
format1: Export generate_lvm1_system_id.
vgchange: Prevent lvm1 system ID changes.
systemid: Init and merge lvm2 and lvm1 fields.
systemid: Add ACCESS_NEEDS_SYSTEM_ID VG flag.
systemid: Disable --systemid.
pre-release
David Teigland (31):
toollib: prepare select_match_{pv,vg,lv} hooks
vgextend: Use process_each_vg.
system_id: use for VG ownership
WHATS_NEW for system_id
toollib: add underscore to static ignore_vg function
system_id: omit leading hyphens from system_id
system_id: warn if the system_id_file cannot be opened
man: update lvmthin about repair and recovery
doc: explanation of caching foreign VGs
tests: add system_id test
report: fix foreign reporting without lvmetad
man lvmsystemid: expanded limitations and warnings
tests: skip system_id machineid case when not available
man: systemid option for vgcreate and vgchange
vgchange, vgcreate: add systemid option to command help
man lvm: document --foreign option
man lvmsystemid: update changing the system_id
systemid: silently ignore foreign vgs unless named
vgcfgbackup: enable foreign VG access
lvchange: deactivate is always possible in foreign vgs
tests: add more systemid tests
tests: fix the system_id tests
WHATS_NEW: vgimport with lvmetad
pvscan, vgscan: include foreign vgs with --cache
tests: add more system_id tests
man: lvmsystemid: empty string equals no system_id
tests: more system_id tests
system_id: remove unwanted foreign error for some commands
system_id: apply consistent naming
vgchange: deactivate LVs in foreign VG
lvchange, vgchange: fix the system_id check
Jonathan Brassow (1):
cmirror: Adjust region size to work around CPG msg limit to avoid hang.
Jose Castillo (1):
initscripts: lvm2-monitor: implement status action
Marian Csontos (2):
test: Fix harness not building on RHEL5
test: Fix missing return in new test harness.
Ondrej Kozina (2):
libdaemon: set CLOEXEC on client socket fd
libdaemon: set CLOEXEC flag on systemd socket
Peter Rajnoha (55):
reporter: properly check for _do_info_and_status return value and free the mempool if created within the fn
lvm: recognize LVM_COMMAND_PROFILE env var for default command profile to use in LVM commands
libdm: report: add dm_report_object_is_selected
cleanup: make report type condition consistent with the rest of the code
toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related)
report: add report_init_for_selection fn and modify report_object to support reporting for selection only
toollib: pass struct processing_handle to _select_match_* functions
toollib: add init_processing_handle, init_selection_handle and destroy_processing_handle helper functions
toollib: initialize handles (including reporting for selection) for _select_match_* used in process_each_* fns
toollib: select the whole structure if at least one of its items is selected
refactor: report: factor out code to determine final report type
report: add report_for_selection and use it in select_match_{pv,vg,lv}
report: implement report_for_selection
pvchange: use processing_handle when processing items for pvchange
tools: allow -S|--select for vgchange, lvchange and pvchange
tools: allow -S|--select for vgremove and lvremove
tools: allow -S|--select for vgdisplay, lvdisplay and pvdisplay without -C
tools: allow -S|--select for vgexport and vgimport
select: initialize selection handle for process_each_* fns with initial report type
man: dumpconfig: mention LVM_COMMAND_PROFILE env var and add more references to --mergedconfig option
toollib: select: issue an error message for failed VG/LV/PV selection
man: reference -S/--select in {vg,lv,pv}change, {vg,lv}remove, {vg,lv,pv}display and vg{import,export} man pages
conf: update profile templates for recent changes
report: define ba_start, vg_free and seg_start fields as DM_REPORT_FIELD_TYPE_SIZE instead of DM_REPORT_FIELD_TYPE_NUM
tests: rename report-select.sh to select-report.sh
tests: add select-tools.sh to test selection support in toollib
config: fix version of introduction for devices/external_device_info_source (v115->v116)
toollib: process_each_pv: do not acquire list of all devices if not necessary
toollib: process_each_pv: use cmd->full_filter, not cmd->filter if we're getting full list of PV-capable devices (not just PVs)
toollib: process_each_pv: fix commit d38d047e which worked for processing "all devices", but didn't work for "all PVs"
autoreconf: recent changes
lvchange: change msg about required params (LV or selection) to be consistent with msgs used in other tools
pvchange: no need to initialize selection handle directly, process_each_pv will do that automatically
cleanup: replace static struct processing_handle initializer with common init_processing_handle
cleanup: remove deallocate_handle_root arg from destroy_procesing_handle fnw
tests: select-tools.sh: pvchange now uses process_each_pv
tolllib: process_each_pv: always use full_filter unconditionally when getting all devices
tests: comment in select-tools.sh
tests: fix pvcreate-operation-md test to properly clean up devs before their reuse
pvcreate: switch to "none" dev-ext source during pvcreate
filters: no need to refresh filters/rescan if no signature is wiped during pvcreate at all
wiping: blkid: do not count skipped signatures in final number of wipes
pvcreate: switch to "none" dev-ext source during pvcreate
configure: typo in configure --with-default-raid10-segtype causing it to be unrecognized
conf: be more clear about wipe_signatures_when_zeroing_new_lvs option in comments
report: fix handling of reports with pure label fields
report: one more comment explaining change of report type when tags are used for original LABEL reporting
cleanup: change check order in condition in _check_pv_list fn
initscripts: lvm2-monitor: use @DMEVENTD_PIDFILE@ instead of hardcoded /var/run/dmeventd.pid
report: check value of args_are_pvs, not the pointer (fix for commit 9ea77b7)
metadata: vg: add missing vg->lvm1_system_id initialization
metadata: vg: alloc lvm1_system_id in alloc_vg sooner
vgremove: select: direct selection to be done per-VG, not per-LV
config: add CFG_DISABLED flag and mark system_id settings with that flag
cleanup: tools: "or use -S for selection" --> "or use --select for selection"
Petr Rockai (113):
test: Import first draft of a new test runner.
configure: Allow C++ components.
configure: Add libexecdir/datadir to make.tmpl.in.
test: Build the new test runner.
test: Use the new runner in make check.
test: Split up the new runner into multiple files.
test: Implement journalling and --continue.
test: Clean up fds properly in the runner.
test: Write a results/list at the end of a test run.
test: Add new flavour definition files.
test: Allow test devices backed by a permanent block device.
test: Make runner use bigger IO buffers, put them on stack.
test: Implement a file-backed IO sink in the runner.
test: Add a buffer-backed IO sink (for interactive runs).
test: Fix IO sink destructors in the runner.
test: Use the new flavour setup files in lib/inittest.
test: Make it possible to run tests from an installed location.
test: Makefile updates.
test: Fix handling of envvars in the runner.
test: Implement flavours in the runner.
test: Make the runner's journal more reliable.
test: Improve tracking of silence (stuck testcases) in the runner.
test: Improve IO handling in the runner.
test: Run the testcases chdir'd into --testdir.
test: Targets and sources can't have the same name if builddir == srcdir.
test: Rename the --quiet option to --batch.
test: Run in /tmp if LVM_TEST_DIR is unset.
test: Avoid sleeps in the runner monitoring loop.
test: Print a heartbeat file (every 20s) in the runner.
test: Add time/rusage formatting to the runner.
test: Implement specialised --batch output style w/ rusage stats.
test: Use append for journal maintenance instead of rename.
test: Fix a precedence bug in the runner.
test: Add a missing copyright/licence notice to journal.h.
test: Fix loading of an append-mode journal.
test: Implement --only option to runner.
spec: Add an (optional) lvm2-testsuite subpackage.
NIX: Refactor around the new test runner.
NIX: Use --batch mode for running the testsuite.
NIX: Implement a smarter VM monitoring loop.
NIX: Adapt to the append-based test journal.
NIX: Use nixpkgs kernel for building, distro kernel for testing.
NIX: Drop -h from rpm invocations as it messes up logs.
NIX: Existence of results list no longer indicates that the suite has finished.
NIX: Add Fedora 20 jobs.
NIX: Re-work VM monitoring.
test: Disable lvmetad logging in lvconvert-{mirror,raid}*.
test: Make the runner's heartbeat more reliable.
test: Implement --fatal-timeouts to allow a timely VM restart.
NIX: Pass --fatal-timeouts to the testsuite.
test: Package up the test runner in a reusable C++ "brick".
NIX: Use the new --heartbeat option on lvm2-testsuite.
test: Update brick-shelltest, adding timestamps to logs.
libdaemon: Use select to yield CPU on a blocked read or write.
NIX: Use IDE drive emulation instead of virtio.
NIX: Some kernels need ide/ata modules (i.e. no builtin ata).
NIX: Keep the udev log out of tmpfs.
test: Update brick-shelltest.h.
NIX: Add --kmsg to lvm2-testsuite invocations.
NIX: Run each test flavour as a separate derivation.
NIX: Do not fail aggregation when a sub-job fails to produce output.
NIX: Update path to /xchg (was /tmp/xchg with older nixpkgs).
test: Fix implementation of check targets with new flavour system.
test: Do not rely on dev/mapper/* nodes in pvmove-restart.sh.
NIX: Mark builds with failed tests as such.
test: Update brick-shelltest (configurable timeout, better banner, exit code).
test: Fix 100%FREE RAID tests since test device sizes changed slightly.
test: Avoid running 'dmsetup remove' with no devices.
test: Fix failures due to undefined abs_top_builddir.
NIX: Avoid a spurious failure when all tests pass.
NIX: Detect that the VM booted up more directly.
test: Re-try with loopback if a backing device is too small.
test: Avoid passing -c to flock.
test: Fix prepare_scsi_debug_dev.
NIX: Make timeout and test envvars configurable via --arg.
NIX: Install valgrind, gdb and strace in the test environment.
test: Make lvm-wrapper available in the installed testsuite, too.
test: Add support for running LVM commands in tests through strace.
configure: Look for valgrind.h independently of VALGRIND_POOLS.
memlock: Do not check memory balance if RUNNING_ON_VALGRIND.
NIX: Add valgrind-devel to the build environment.
test: Call $VALGRIND directly in lvm-wrapper.
test: Disable lvmetad debug log on another bunch of tests.
test: Make killing local (test) daemons more robust.
test: Make dmsetup remove more robust in pvmove-restart.
test: Allow a longer timeout for lvextend-snapshot-dmeventd.
test: Only force an IO sync when the testcase has finished.
test: Properly detect warnings from testcases.
test: Remove spurious set -x in lvm-wrapper.
test: It is not an error for a test daemon to exit before teardown.
test: Fix a segfault in the test runner.
NIX: Add a CentOS 7.0 64b build.
NIX: Set ulimit -c to unlimited, to get backtraces in logs.
NIX: Allow adding/overriding test configurations.
NIX: Move corosynclib-devel & valgrind-devel out of common.
NIX: We need to install lcov for ./configure now as well.
NIX: Adjust install_rpms (kernel rpm is now required).
NIX: Request {fedora,centos}-release packages explicitly.
configure: Fix a warning about test/Makefile.in.
test: Fix a typo in shell/pvmove-restart.sh.
NIX: Adjust lists of extra RPMs to install.
NIX: Drop Fedora 16 builds.
NIX: Resolve issues with fedora-release and kernel-modules-extra.
NIX: Fix CentOS builds.
spec: Include lvmsystemid.7 in RPMs.
NIX: Fix a typo that broke evaluation of fc19+.
test: Make pvmove0 device removal more robust, in pvmove-restart.sh.
test: Avoid a race in pvmove-restart.sh.
clvmd: Fix BZ 1140095 by updating lastfd upon EINTR.
cache: Fix a segfault when passing --cachepolicy without --cachesettings.
lvmcache.7: add a section on --cachepolicy/--cachesettings
lvcreate.8: Mention --cachepolicy and --cachesettings.
spec: Add lvmlocal.conf to RPMs.
Zdenek Kabelac (17):
tests: respect LVM_TEST_DIR
makefiles: more _CFLAGS for -MM
tests: don't crash if checked string is shorter
tests: ensure array is synchronized
tests: BACKING_DEV
configure.in: AC_SUBST needs to be always executed
memory: disable check with valgrind pool build
valgrind: when executed within valrind skip close
tests: ensure lv1 goes away first
tests: syncaction update
cleanup: drop unused val
cleanup: drop !! from code
cleanup: fix compate of return value
tests: hide uninteresting output
cleanup: drop unused value assign
cleanup: simplify error path code
cleanup: drop unused header file
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=930fa3290debbdec…
Commit: 930fa3290debbdecca44f334426d960e3160e7bf
Parent: a7bfc2cbb565eb668068a091d7c2a7a4f4f2ffcc
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 4 13:49:51 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 4 13:49:51 2015 +0000
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 14 +++++++-------
WHATS_NEW_DM | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/VERSION b/VERSION
index 071f5f4..22c760d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.117(2)-git (2015-01-30)
+2.02.117(2)-git (2015-03-04)
diff --git a/VERSION_DM b/VERSION_DM
index dc719d2..4541e24 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.94-git (2015-01-30)
+1.02.94-git (2015-03-04)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9beb668..af5704a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
-Version 2.02.117 -
-====================================
+Version 2.02.117 - 4th March 2015
+=================================
+ Add CFG_DISABLED for new system ID config settings that must not yet be used.
Set ACCESS_NEEDS_SYSTEM_ID VG status flag while system_id is set.
Preserve original format type field when processing backup files.
Implement status action for lvm2-monitor initscript to display monitored LVs.
@@ -12,14 +13,13 @@ Version 2.02.117 -
Add NEEDS_FOREIGN_VGS flag to vgimport so --foreign is always supplied.
Add --foreign to the 6 display and reporting tools and vgcfgbackup.
Install /etc/lvm/lvmlocal.conf template with local section for systemid.
- Record creation_host_system_id in lvm2 metadata.
+ Record creation_host_system_id in lvm2 metadata (never set yet).
Reinstate recursive config file tag section processing. (2.02.99)
- Add 'lvm systemid' to display the current system ID.
+ Add 'lvm systemid' to display the current system ID (never set yet).
Fix configure to properly recognize --with-default-raid10-segtype option.
Do not refresh filters/rescan if no signature is wiped during pvcreate.
Enforce none external dev info for wiping during pvcreate to avoid races.
- Add global/system_id_source and system_id_file to lvm.conf.
- Add --systemid to vgcreate and vchange to set / change a system ID.
+ Add global/system_id_source and system_id_file to lvm.conf (disabled).
Add support for VG system_id to control host access to VGs.
Update vgextend to use process_each_vg.
Add --ignoreskippedcluster to pvchange.
@@ -33,7 +33,7 @@ Version 2.02.117 -
Add support for -S/--select to vgchange,lvchange and pvchange.
Add infrastructure to support selection for non-reporting tools.
Add LVM_COMMAND_PROFILE env var to set default command profile name to use.
- set CLOEXEC flag on file descriptors originating in libdaemon
+ Set CLOEXEC flag on file descriptors originating in libdaemon.
Version 2.02.116 - 30th January 2015
====================================
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 183ef15..8816312 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,5 @@
-Version 1.02.94 -
-===================================
+Version 1.02.94 - 4th March 2015
+================================
Add dm_report_object_is_selected for generalized interface for report/select.
Version 1.02.93 - 21st January 2015
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a7bfc2cbb565eb66…
Commit: a7bfc2cbb565eb668068a091d7c2a7a4f4f2ffcc
Parent: 733bfe36f5ba34f11b297e41ec249aaa6b238d7b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Mar 4 14:40:04 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Mar 4 14:40:58 2015 +0100
cleanup: tools: "or use -S for selection" --> "or use --select for selection"
---
tools/lvchange.c | 2 +-
tools/lvremove.c | 2 +-
tools/pvchange.c | 2 +-
tools/vgexport.c | 2 +-
tools/vgremove.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 0351e4e..5e90adc 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1182,7 +1182,7 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
cmd->handles_missing_pvs = 1;
if (!argc && !arg_is_set(cmd, select_ARG)) {
- log_error("Please give logical volume path(s) or use -S for selection.");
+ log_error("Please give logical volume path(s) or use --select for selection.");
return EINVALID_CMD_LINE;
}
diff --git a/tools/lvremove.c b/tools/lvremove.c
index df920fb..ce0b65b 100644
--- a/tools/lvremove.c
+++ b/tools/lvremove.c
@@ -19,7 +19,7 @@ int lvremove(struct cmd_context *cmd, int argc, char **argv)
{
if (!argc && !arg_is_set(cmd, select_ARG)) {
log_error("Please enter one or more logical volume paths "
- "or use -S for selection.");
+ "or use --select for selection.");
return EINVALID_CMD_LINE;
}
diff --git a/tools/pvchange.c b/tools/pvchange.c
index 3eb9e96..3e0894f 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -180,7 +180,7 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
handle->custom_handle = ¶ms;
if (!(arg_count(cmd, all_ARG)) && !argc && !handle->internal_report_for_select) {
- log_error("Please give a physical volume path or use -S for selection.");
+ log_error("Please give a physical volume path or use --select for selection.");
ret = EINVALID_CMD_LINE;
goto out;
}
diff --git a/tools/vgexport.c b/tools/vgexport.c
index 4bed421..6d5b4f6 100644
--- a/tools/vgexport.c
+++ b/tools/vgexport.c
@@ -53,7 +53,7 @@ bad:
int vgexport(struct cmd_context *cmd, int argc, char **argv)
{
if (!argc && !arg_count(cmd, all_ARG) && !arg_is_set(cmd, select_ARG)) {
- log_error("Please supply volume groups or use -S for selection or use -a for all.");
+ log_error("Please supply volume groups or use --select for selection or use -a for all.");
return EINVALID_CMD_LINE;
}
diff --git a/tools/vgremove.c b/tools/vgremove.c
index d33ab1b..fd97356 100644
--- a/tools/vgremove.c
+++ b/tools/vgremove.c
@@ -85,7 +85,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
if (!argc && !arg_is_set(cmd, select_ARG)) {
log_error("Please enter one or more volume group paths "
- "or use -S for selection.");
+ "or use --select for selection.");
return EINVALID_CMD_LINE;
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e73dad787439c137…
Commit: e73dad787439c1376dfa00fef6d1ee0f18f42c9b
Parent: bfbb5d269aa1ed56d9308117b57d4d2da49d53f6
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Mar 4 10:44:31 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Mar 4 10:44:31 2015 +0100
vgremove: select: direct selection to be done per-VG, not per-LV
Though vgremove operates per VG by definition, internally, it
actually means iterating over each LV it contains to do the
remove.
So we need to direct selection a bit in this case so that the
selection is done per-VG, not per-LV.
That means, use processing handle with void_handle.internal_report_for_select=0
for the process_each_lv_in_vg that is called later in vgremove_single fn.
We need to disable internal selection for process_each_lv_in_vg
here as selection is already done by process_each_vg which calls
vgremove_single. Otherwise selection would be done per-LV and not
per-VG as we intend!
An intra-release fix for commit 00744b053f395be79ab1cb80fdf7342548aa79e2.
---
test/shell/select-tools.sh | 10 ++++++++++
tools/vgremove.c | 16 +++++++++++++++-
2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/test/shell/select-tools.sh b/test/shell/select-tools.sh
index c418716..1738a45 100644
--- a/test/shell/select-tools.sh
+++ b/test/shell/select-tools.sh
@@ -263,3 +263,13 @@ not check pv_field $dev2 pv_tags "309,tag"
not check pv_field $dev3 pv_tags "309,tag"
not check pv_field $dev4 pv_tags "309,tag"
pvchange -a --deltag 309 --deltag tag
+
+#########################
+# special cases to test #
+#########################
+
+# if calling vgremove, make sure we're doing selection per-VG, not per-LV
+# (vgremove calls process_each_vg with vgremove_single which itself
+# iterates over LVs with process_each_lv_in_vg - so internally it actually
+# operates per-LV, but we still need the selection to be done per-VG)
+vgremove --yes -S 'lv_name=lv2' # should remove whole vg1, not just the lv2
diff --git a/tools/vgremove.c b/tools/vgremove.c
index 3ce0763..d33ab1b 100644
--- a/tools/vgremove.c
+++ b/tools/vgremove.c
@@ -20,6 +20,19 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
struct processing_handle *handle __attribute__((unused)))
{
/*
+ * Though vgremove operates per VG by definition, internally, it
+ * actually means iterating over each LV it contains to do the remove.
+ *
+ * Use processing handle with void_handle.internal_report_for_select=0
+ * for the process_each_lv_in_vg that is called later in this fn.
+ * We need to disable internal selection for process_each_lv_in_vg
+ * here as selection is already done by process_each_vg which calls
+ * vgremove_single. Otherwise selection would be done per-LV and
+ * not per-VG as we intend!
+ */
+ struct processing_handle void_handle = {0};
+
+ /*
* Single force is equivalent to sinle --yes
* Even multiple --yes are equivalent to single --force
* When we require -ff it cannot be replaces with -f -y
@@ -47,7 +60,8 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
return ECMD_FAILED;
}
}
- if ((ret = process_each_lv_in_vg(cmd, vg, NULL, NULL, 1, NULL,
+
+ if ((ret = process_each_lv_in_vg(cmd, vg, NULL, NULL, 1, &void_handle,
(process_single_lv_fn_t)lvremove_single)) != ECMD_PROCESSED) {
stack;
return ret;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=24774959221ab750…
Commit: 24774959221ab75038c336074470108a0727e672
Parent: cccc2b2980f8321e5f8c8b553f50966f7e1b5abc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 3 16:45:16 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 3 16:45:16 2015 -0600
lvchange, vgchange: fix the system_id check
The check for matching system_id needs to check
that the system_id is not blank.
---
tools/lvchange.c | 3 ++-
tools/vgchange.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index bf7e356..0351e4e 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -191,7 +191,8 @@ static int _lvchange_activate(struct cmd_context *cmd, struct logical_volume *lv
* a foreign VG, which allows the VG to be accessed by lvchange -a
* so the LV can be deactivated.
*/
- if (lv->vg->system_id && cmd->system_id &&
+ if (lv->vg->system_id && lv->vg->system_id[0] &&
+ cmd->system_id && cmd->system_id[0] &&
strcmp(lv->vg->system_id, cmd->system_id) &&
is_change_activating(activate)) {
log_error("Cannot activate LVs in a foreign VG.");
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 38a129f..8371310 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -201,7 +201,8 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
* a foreign VG, which allows the VG to be accessed by vgchange -a
* so the LV can be deactivated.
*/
- if (vg->system_id && cmd->system_id &&
+ if (vg->system_id && vg->system_id[0] &&
+ cmd->system_id && cmd->system_id[0] &&
strcmp(vg->system_id, cmd->system_id) &&
is_change_activating(activate)) {
log_error("Cannot activate LVs in a foreign VG.");
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cccc2b2980f8321e…
Commit: cccc2b2980f8321e5f8c8b553f50966f7e1b5abc
Parent: 926b38c0d73d958e5774082ff17fb2a48e20d32e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 3 13:23:13 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 3 13:23:13 2015 -0600
vgchange: deactivate LVs in foreign VG
Apply the same logic as lvchange, which allows
deactivating LVs in a foreign VG.
---
tools/vgchange.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 199ee82..38a129f 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -197,6 +197,18 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
int do_activate = is_change_activating(activate);
/*
+ * We can get here in the odd case where an LV is already active in
+ * a foreign VG, which allows the VG to be accessed by vgchange -a
+ * so the LV can be deactivated.
+ */
+ if (vg->system_id && cmd->system_id &&
+ strcmp(vg->system_id, cmd->system_id) &&
+ is_change_activating(activate)) {
+ log_error("Cannot activate LVs in a foreign VG.");
+ return ECMD_FAILED;
+ }
+
+ /*
* Safe, since we never write out new metadata here. Required for
* partial activation to work.
*/
@@ -795,6 +807,9 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
if (!update || !update_partial_unsafe)
cmd->handles_missing_pvs = 1;
+ if (arg_is_set(cmd, activate_ARG))
+ cmd->include_active_foreign_vgs = 1;
+
return process_each_vg(cmd, argc, argv, update ? READ_FOR_UPDATE : 0,
NULL, &vgchange_single);
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eeaf3f2e88ef2c66…
Commit: eeaf3f2e88ef2c664b5cbefb9c9a9e7ada0c752b
Parent: 047fe6c59fe2cf3a52208b219caebed469ed6bdc
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 2 12:16:55 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Mar 2 12:17:27 2015 +0100
metadata: vg: add missing vg->lvm1_system_id initialization
The vg->lvm1_systemd_id needs to be initialized as all the code around
counts with that. Just like we initialize lvm1_system_id in vg_create
(no matter if it's actually LVM1 or LVM2 format), this patch adds this
init in alloc_vg as well so the rest of the code does not segfaul
when trying to access vg->lvm1_system_id.
---
lib/metadata/vg.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 446aa7c..2993655 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -57,6 +57,12 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
dm_list_init(&vg->tags);
dm_list_init(&vg->removed_pvs);
+ if (!(vg->lvm1_system_id = dm_pool_zalloc(vg->vgmem, NAME_LEN + 1))) {
+ log_error("Failed to allocate VG systemd id.");
+ dm_pool_destroy(vgmem);
+ return NULL;
+ }
+
log_debug_mem("Allocated VG %s at %p.", vg->name, vg);
return vg;