master - tests: skip system_id machineid case when not available
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55dd45239a52a7...
Commit: 55dd45239a52a7349f8a2380b3e29dc3beee39f5
Parent: e0946dca69d631106c99edcef1221af78819e2c0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Feb 20 13:12:38 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Feb 20 13:12:38 2015 -0600
tests: skip system_id machineid case when not available
instead of creating a fake /etc/machine-id file on the
system to test with.
---
test/shell/system_id.sh | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
index 71e6ee9..98924b0 100644
--- a/test/shell/system_id.sh
+++ b/test/shell/system_id.sh
@@ -27,16 +27,14 @@ vgremove $vg1
## machineid
-if [ ! -e /etc/machine-id ]; then
- echo "49e0eef929d541a0b8b56128441b2d60" > /etc/machine-id
-fi
+if [ -e /etc/machine-id ]; then
SID=$(cat /etc/machine-id)
aux lvmconf "global/system_id_source = machineid"
vgcreate $vg1 "$dev1"
vgs -o+systemid $vg1
check vg_field $vg1 systemid $SID
vgremove $vg1
-# FIXME: remove file if created
+fi
## uname
9 years, 1 month
master - man lvmsystemid: expanded limitations and warnings
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e0946dca69d631...
Commit: e0946dca69d631106c99edcef1221af78819e2c0
Parent: 6bc35a351ace5ff5da07280fda288027cf614a13
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Feb 20 12:21:23 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Feb 20 12:21:23 2015 -0600
man lvmsystemid: expanded limitations and warnings
---
man/lvmsystemid.7.in | 55 ++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/man/lvmsystemid.7.in b/man/lvmsystemid.7.in
index 15b69a2..9e3e6f8 100644
--- a/man/lvmsystemid.7.in
+++ b/man/lvmsystemid.7.in
@@ -23,23 +23,56 @@ set to a custom value or it can be assigned automatically by lvm using a
unique identifier already available on the host, e.g. machine-id or uname.
In vgcreate, the local system_id is saved in the new VG metadata. The
-local host owns the new VG, and other hosts will ignore it.
+local host owns the new VG, and other hosts cannot use it.
A VG without a system_id can be used by any host, and a VG with a
system_id can only be used by a host with a matching system_id. A
-"foreign VG" is a VG with a system_id as viewed by a host with a system_id
+.B foreign VG
+is a VG with a system_id as viewed by a host with a system_id
that does not match the VG's system_id. (Or from a host without a
system_id.)
-To benefit fully from system_id, all hosts must have system_id set, and
-VGs must have system_id set. Two hosts should not be assigned the same
-system_id. Doing so defeats the purpose of the system_id.
-
Valid system_id characters are the same as valid VG name characters. If a
system_id contains invalid characters, those characters are omitted and
remaining characters are used. If a system_id is longer than the maximum
name length, the characters up to the maximum length are used. The
-maximum length of a system_id is 128 characters.
+maximum length of a system_id is 127 characters.
+
+.SS Limitations and warnings
+
+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 corrupted 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 and will not be stopped from
+using them.
+
+.IP \[bu] 2
+A VG without a system_id can be used without restriction from any host,
+even from hosts that have a system_id. Many VGs will not have a system_id
+and are unprotected. Verify that a VG has a system_id by running the
+command 'vgs -o+systemid'
+
+A VG will not have a system_id if it was created before this feature was
+added to lvm, or if it was created by a host that did not have a system_id
+defined. A system_id can be assigned to these VGs by using vgchange
+--systemid (see below).
+
+.IP \[bu] 2
+Two hosts should not be assigned the same system_id. Doing so defeats
+the purpose of the system_id which is to distinguish different hosts.
+
+.IP \[bu] 2
+Orphan PVs (or unused devices) on shared storage are completely
+unprotected by the system_id feature. Commands that use these PVs, such
+as vgcreate or vgextend, are not prevented from performing conflicting
+operations and corrupting the PVs. See the
+.B orphans
+section for more information.
+
+.P
.SS Types of VG access
A "local VG" is meant to be used by a single host.
@@ -267,10 +300,10 @@ The effects of this are especially evident when lvm uses lvmetad caching.
For example, if multiple hosts see an orphan PV, and one host creates a VG
using the orphan, the other hosts will continue to report the PV as an
orphan. Nothing would automatically prevent the other hosts from using
-the newly allocated PV. If the other hosts run a command to rescan
-devices, and update lvmetad, they would then recognize the PV has become
-used by another host. A command that rescans devices could be pvscan
---cache, or vgs --foreign.
+the newly allocated PV and corrupting it. If the other hosts run a
+command to rescan devices, and update lvmetad, they would then recognize
+the PV has been used by another host. A command that rescans devices
+could be pvscan --cache, or vgs --foreign.
.SH SEE ALSO
.BR vgcreate (8),
9 years, 1 month
master - report: fix foreign reporting without lvmetad
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6bc35a351ace5f...
Commit: 6bc35a351ace5ff5da07280fda288027cf614a13
Parent: b896bf8f5a4e811578c0cb606b2ad73220f985fd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Feb 19 15:24:31 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 19 15:24:31 2015 -0600
report: fix foreign reporting without lvmetad
---
test/shell/system_id.sh | 3 ---
tools/reporter.c | 5 ++---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
index feb66ae..71e6ee9 100644
--- a/test/shell/system_id.sh
+++ b/test/shell/system_id.sh
@@ -13,9 +13,6 @@ test_description='Test system_id'
. lib/inittest
-# FIXME: vgs --foreign is not seeing foreign vg when lvmetad is not used
-test -e LOCAL_LVMETAD || skip
-
aux prepare_devs 1
# create vg with system_id using each source
diff --git a/tools/reporter.c b/tools/reporter.c
index ef74dc4..cd0db6f 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -587,10 +587,9 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
* to their own VGs. We also want to override the default
* behavior which skips over foreign VGs.
*/
- if (arg_is_set(cmd, foreign_ARG) && lvmetad_used()) {
+ cmd->include_foreign_vgs = arg_is_set(cmd, foreign_ARG);
+ if (cmd->include_foreign_vgs && lvmetad_used())
lvmetad_pvscan_all_devs(cmd, NULL);
- cmd->include_foreign_vgs = 1;
- }
aligned = find_config_tree_bool(cmd, report_aligned_CFG, NULL);
buffered = find_config_tree_bool(cmd, report_buffered_CFG, NULL);
9 years, 1 month
master - tests: add system_id test
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b896bf8f5a4e81...
Commit: b896bf8f5a4e811578c0cb606b2ad73220f985fd
Parent: 0c6faaab4321ff91672ad818c47b8120d2b14180
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Feb 19 14:08:51 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 19 14:42:39 2015 -0600
tests: add system_id test
---
test/shell/system_id.sh | 425 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 425 insertions(+), 0 deletions(-)
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
new file mode 100644
index 0000000..feb66ae
--- /dev/null
+++ b/test/shell/system_id.sh
@@ -0,0 +1,425 @@
+#!/bin/sh
+# Copyright (C) 2008-2013 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
+
+test_description='Test system_id'
+
+. lib/inittest
+
+# FIXME: vgs --foreign is not seeing foreign vg when lvmetad is not used
+test -e LOCAL_LVMETAD || skip
+
+aux prepare_devs 1
+
+# create vg with system_id using each source
+
+## none
+
+SID=""
+aux lvmconf "global/system_id_source = none"
+vgcreate $vg1 "$dev1"
+check vg_field $vg1 systemid $SID
+vgremove $vg1
+
+## machineid
+
+if [ ! -e /etc/machine-id ]; then
+ echo "49e0eef929d541a0b8b56128441b2d60" > /etc/machine-id
+fi
+SID=$(cat /etc/machine-id)
+aux lvmconf "global/system_id_source = machineid"
+vgcreate $vg1 "$dev1"
+vgs -o+systemid $vg1
+check vg_field $vg1 systemid $SID
+vgremove $vg1
+# FIXME: remove file if created
+
+## uname
+
+SID=$(uname -n)
+if [ -n $SID ]; then
+aux lvmconf "global/system_id_source = uname"
+vgcreate $vg1 "$dev1"
+vgs -o+systemid $vg1
+check vg_field $vg1 systemid $SID
+vgremove $vg1
+fi
+
+## lvmlocal
+
+SID=sidfoolocal
+LVMLOCAL=etc/lvmlocal.conf
+rm -f $LVMLOCAL
+echo "local {" > $LVMLOCAL
+echo " system_id = $SID" >> $LVMLOCAL
+echo "}" >> $LVMLOCAL
+aux lvmconf "global/system_id_source = lvmlocal"
+vgcreate $vg1 "$dev1"
+vgs -o+systemid $vg1
+check vg_field $vg1 systemid $SID
+vgremove $vg1
+rm -f $LVMLOCAL
+
+## file
+
+SID=sidfoofile
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+echo "$SID" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+vgcreate $vg1 "$dev1"
+vgs -o+systemid $vg1
+check vg_field $vg1 systemid $SID
+vgremove $vg1
+rm -f $SIDFILE
+
+# override system_id to create a foreign vg, then fail to use the vg
+
+SID1=sidfoofile1
+SID2=sidfoofile2
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg, overriding the local system_id so the vg looks foreign
+vgcreate --systemid $SID2 $vg1 "$dev1"
+# normal vgs is not an error and does not see the vg
+vgs >err
+not grep $vg1 err
+# vgs on the foreign vg is an error and not displayed
+not vgs $vg1 >err
+not grep $vg1 err
+# fail to remove foreign vg
+not vgremove $vg1
+# using --foreign we can see foreign vg
+vgs --foreign >err
+grep $vg1 err
+vgs --foreign $vg1 >err
+grep $vg1 err
+# change the local system_id to the second value, making the vg not foreign
+echo "$SID2" > $SIDFILE
+# we can now see and remove the vg
+vgs $vg1 >err
+grep $vg1 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# create a vg, then change the local system_id, making the vg foreign
+
+SID1=sidfoofile1
+SID2=sidfoofile2
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+# normal vgs sees the vg
+vgs >err
+grep $vg1 err
+# change the local system_id, making the vg foreign
+echo "$SID2" > $SIDFILE
+# normal vgs doesn't see the vg
+vgs >err
+not grep $vg1 err
+# using --foreign we can see the vg
+vgs --foreign >err
+grep $vg1 err
+# change the local system_id back to the first value, making the vg not foreign
+echo "$SID1" > $SIDFILE
+vgs >err
+grep $vg1 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# create a vg, then change the vg's system_id, making it foreign
+
+SID1=sidfoofile1
+SID2=sidfoofile2
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+# normal vgs sees the vg
+vgs >err
+grep $vg1 err
+# change the vg's system_id, making the vg foreign
+echo "y" | vgchange --systemid $SID2 $vg1
+# normal vgs doesn't see the vg
+vgs >err
+not grep $vg1 err
+# using --foreign we can see the vg
+vgs --foreign >err
+grep $vg1 err
+# change the local system_id to the second system_id so we can remove the vg
+echo "$SID2" > $SIDFILE
+vgs >err
+grep $vg1 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# create a vg, create active lvs in it, change our system_id, making
+# the VG foreign, verify that we can still see the foreign VG,
+# and can deactivate the LVs
+
+SID1=sidfoofile1
+SID2=sidfoofile2
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+lvcreate -n $lv1 -l 2 $vg1
+# normal vgs sees the vg and lv
+vgs >err
+grep $vg1 err
+check lv_exists $vg1 $lv1
+# change our system_id, making the vg foreign, but accessible
+echo "$SID2" > $SIDFILE
+vgs >err
+grep $vg1 err
+check lv_exists $vg1 $lv1
+# can deactivate the lv
+lvchange -an $vg1/$lv1
+# now that the foreign vg has no active lvs, we can't access it
+not lvremove $vg1/$lv1
+not vgremove $vg1
+# change our system_id back to match the vg so it's not foreign
+echo "$SID1" > $SIDFILE
+vgs >err
+grep $vg1 err
+lvremove $vg1/$lv1
+vgremove $vg1
+rm -f $SIDFILE
+
+# local system has no system_id, so it can't access a vg with a system_id
+
+SID1=sidfoofile1
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+aux lvmconf "global/system_id_source = none"
+vgs >err
+not grep $vg1 err
+not vgs $vg1 >err
+not grep $vg1 err
+aux lvmconf "global/system_id_source = file"
+vgs >err
+grep $vg1 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# local system has a system_id, and can use a vg without a system_id
+
+SID1=sidfoofile1
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+# create a vg with no system_id
+aux lvmconf "global/system_id_source = none"
+vgcreate $vg1 "$dev1"
+check vg_field $vg1 systemid ""
+# set a local system_id
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# check we can see and use the vg with no system_id
+vgs >err
+grep $vg1 err
+vgs $vg1 >err
+grep $vg1 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# vgexport clears system_id, vgimport sets system_id
+
+SID1=sidfoofile1
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+# normal vgs sees the vg
+vgs -o+systemid >err
+grep $vg1 err
+grep $SID1 err
+# after vgexport there is no systemid
+vgexport $vg1
+vgs -o+systemid >err
+grep $vg1 err
+not grep $SID1 err
+# after vgimport there is a systemid
+vgimport $vg1
+vgs -o+systemid >err
+grep $vg1 err
+grep $SID1 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# vgchange -cy clears system_id, vgchange -cn sets system_id
+
+SID1=sidfoofile1
+SIDFILE=etc/lvm_test.conf
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+# normal vgs sees the vg
+vgs -o+systemid >err
+grep $vg1 err
+grep $SID1 err
+# after vgchange -cy there is no systemid
+echo "y" | vgchange -cy $vg1
+vgs --config 'global { locking_type=0 }' -o+systemid $vg1 >err
+grep $vg1 err
+not grep $SID1 err
+# after vgchange -cn there is a systemid
+vgchange --config 'global { locking_type=0 }' -cn $vg1
+vgs -o+systemid >err
+grep $vg1 err
+grep $SID1 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# Test max system_id length (127) and invalid system_id characters.
+# The 127 length limit is imposed before invalid characters are omitted.
+
+SIDFILE=etc/lvm_test.conf
+
+# 120 numbers followed by 7 letters (max len)
+SID1=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abcdefg
+# 120 numbers followed by 8 letters (too long by 1 character, the last is omitted)
+SID2=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abcdefgh
+
+# max len system_id should appear normally
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+# normal vgs sees the vg
+vgs -o+systemid $vg1 >err
+grep $vg1 err
+grep $SID1 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# max+1 len system_id should be missing the last character
+rm -f $SIDFILE
+echo "$SID2" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+# normal vgs sees the vg
+vgs -o+systemid $vg1 >err
+grep $vg1 err
+grep $SID1 err
+not grep $SID2 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# max len system_id containing an invalid character should appear without
+# the invalid character
+# 120 numbers followed by invalid '#' character followed by 7 letters (too long by 1 character)
+SID1=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789#abcdefg
+# After the invalid character is omitted from SID1
+# The string is truncated to max length (127) before the invalid character is omitted
+SID2=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abcdef
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+# normal vgs sees the vg
+vgs -o+systemid $vg1 >err
+grep $vg1 err
+not grep $SID1 err
+grep $SID2 err
+vgremove $vg1
+rm -f $SIDFILE
+
+# contains a bunch of invalid characters
+SID1="?#$&A.@1]"
+# SID1 without the invalid characters
+SID2=A.1
+
+rm -f $SIDFILE
+echo "$SID1" > $SIDFILE
+aux lvmconf "global/system_id_source = file"
+aux lvmconf "global/system_id_file = $SIDFILE"
+# create a vg
+vgcreate $vg1 "$dev1"
+# normal vgs sees the vg
+vgs -o+systemid $vg1 >err
+grep $vg1 err
+not grep $SID1 err
+grep $SID2 err
+vgremove $vg1
+rm -f $SIDFILE
+
+
+# pvs: pv in a foreign vg not reported
+# pvs --foreign: pv in a foreign vg is reported
+# TODO
+
+# lvs: lvs in a foreign vg not reported
+# lvs --foreign: lvs in a foreign vg are reported
+# TODO
+
+# use allow_system_id to read a foreign VG
+# TODO
+
+
+# Test handling of bad system_id source configurations
+# The commands should proceed without a system_id.
+# Look at the warning/error messages.
+
+# vgcreate with source machineid, where no /etc/machine-id file exists
+# TODO
+
+# vgcreate with source uname, but uname is localhost
+# TODO
+
+# vgcreate with source lvmlocal, but no lvmlocal.conf file
+# vgcreate with source lvmlocal, but no system_id = "x" entry
+# TODO
+
+# vgcreate with source file, but no system_id_file config
+# vgcreate with source file, but system_id_file does not exist
+# TODO
+
+
+# Test cases where lvmetad cache of a foreign VG are out of date
+# because the foreign owner has changed the VG.
+# . Using the --foreign option should update the cache and produce
+# correct output
+# . Using vgimport should see that the VG is no longer foreign,
+# but has been exported.
+# TODO
+
+
9 years, 1 month
master - doc: explanation of caching foreign VGs
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0c6faaab4321ff...
Commit: 0c6faaab4321ff91672ad818c47b8120d2b14180
Parent: 97e3e84c2ca8678630ee8a45cb5e3cc2949c607b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Feb 19 11:33:23 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 19 11:33:23 2015 -0600
doc: explanation of caching foreign VGs
---
doc/caching_foreign_vgs.txt | 86 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 86 insertions(+), 0 deletions(-)
diff --git a/doc/caching_foreign_vgs.txt b/doc/caching_foreign_vgs.txt
new file mode 100644
index 0000000..12ffeca
--- /dev/null
+++ b/doc/caching_foreign_vgs.txt
@@ -0,0 +1,86 @@
+Q: Why should lvmetad cache foreign VGs?
+A: It's the most useful behavior in the "steady state".
+
+How to arrive at that conclusion.
+Four code configurations to consider, each in two different circumstances.
+
+configurations:
+
+1. lvm not using lvmetad
+2. lvm using lvmetad and lvmlockd
+3. lvm using lvmetad, and lvmetad does not cache foreign VGs
+ (Not currently implemented.)
+4. lvm using lvmetad, and lvmetad caches foreign VGs
+
+circumstances:
+
+A. steady state: PVs are not added or removed to/from foreign VGs
+B. transient state: PVs are added or removed to/from foreign VGs
+
+combinations:
+
+1.A. A PV is correctly shown in the foreign VG.
+1.B. A PV is correctly shown in the foreign VG.
+
+The most accurate representation, at the cost of always scanning disks.
+
+
+2.A. A PV is correctly shown in the foreign VG.
+2.B. A PV is correctly shown in the foreign VG.
+
+The most accurate representation, at the cost of using lvmlockd.
+
+
+3.A. A PV in a foreign VG is shown as unused.
+3.B. A PV in a foreign VG is shown as unused.
+
+If lvmetad ignores foreign VGs and does not cache them, the PVs in the
+foreign VGs appear to be unused. This largely defeats the purpose of
+system_id, which is meant to treat VGs/PVs as foreign instead of free
+(albeit imperfectly, see below.)
+
+
+4.A. A PV is correctly shown in the foreign VG.
+4.B. A PV is not correctly shown in the foreign VG.
+
+This avoids the cost of always scanning disks, and avoids the cost of
+using lvmlockd. The steady state 4.A. is an improvement over the steady
+state 3.A. When the steady state is the common case, this is a big
+advantage. When the steady state is *not* the common case, the foreign VG
+concept is not as useful (if shared devices are this dynamic, lvmlockd
+should be considered.)
+
+The limitations related to the transient state 4.B. are explained in
+lvmsystemid(7), along with how to handle it. The specific inaccuracies
+possible in 4.B. are:
+
+. PV is shown as belonging to a foreign VG, but is actually unused.
+. PV is shown as unused, but actually belongs to a foreign VG.
+
+To resolve the inaccuracies in the transient state (4.B.), and return the
+system to an accurate steady state (4.A.), the disks need to be scanned,
+which updates lvmetad. The scanning/updating is a manual step, i.e.
+running 'pvscan --cache', which by definition scans disks and updates
+lvmetad.
+
+--
+
+The --foreign command line option for report/display commands
+(vgs/lvs/pvs/vgdisplay/lvdisplay/pvdisplay) is not directly related to
+whether or not lvmetad caches foreign VGs.
+
+By default, foreign VGs are silently ignored and not printed by these
+commands. However, when the --foreign option is used, these commands do
+produce output about foreign VGs.
+
+(When --foreign is not used, and the command specifically requests a
+foreign VG by name, an error is produced about not accessing foreign VGs,
+and the foreign VG is not displayed.)
+
+The decision to report/display foreign VGs or not is independent of
+whether lvmetad is caching those VGs. When lvmetad is caching the foreign
+VG, a report/display command run with --foreign will scan disks to read
+the foreign VG and give the most up to date version of it (the copy of the
+foreign VG in lvmetad may be out of date due to changes to the VG by the
+foreign host.)
+
9 years, 1 month
master - man: update lvmthin about repair and recovery
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=97e3e84c2ca867...
Commit: 97e3e84c2ca8678630ee8a45cb5e3cc2949c607b
Parent: f80e7bb61bb794bfbedcca95a5dea8b1aac560b2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Feb 6 04:24:30 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Feb 19 10:49:39 2015 -0600
man: update lvmthin about repair and recovery
Explain the thin metadata repair might not work.
Clarify that a full thin pool won't require fsck for journaled fs.
---
man/lvmthin.7.in | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in
index e342a2d..dab2d7e 100644
--- a/man/lvmthin.7.in
+++ b/man/lvmthin.7.in
@@ -431,8 +431,13 @@ This is not recommended.
controls the command options used for the thin_check command.
If the thin_check command finds a problem with the metadata,
-the thin pool LV is not activated, and the thin pool metadata should
-be repaired.
+the thin pool LV is not activated, and the thin pool metadata needs
+to be repaired.
+
+Simple repair commands are not always successful. Advanced repair may
+require editing thin pool metadata and lvm metadata. Newer versions of
+the kernel and lvm tools may be more successful at repair. Report the
+details of damaged thin metadata to get the best advice on recovery.
Command to repair a thin pool:
.br
@@ -785,7 +790,9 @@ return to normal operation.
While waiting to be extended, the thin pool will queue writes for up to 60
seconds (the default). If data space has not been extended after this
time, the queued writes will return an error to the caller, e.g. the file
-system. This can result in file system corruption that may require fsck.
+system. This can result in file system corruption for non-journaled file
+systems that may require fsck. When a thin pool returns errors for writes
+to a thin LV, any file system is subject to losing unsynced user data.
The 60 second timeout can be changed or disabled with the dm\-thin\-pool
kernel module option
9 years, 1 month
master - configure: typo in configure --with-default-raid10-segtype causing it to be unrecognized
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f80e7bb61bb794...
Commit: f80e7bb61bb794bfbedcca95a5dea8b1aac560b2
Parent: af395e61d52af330f5927f5dbf528c995574ee45
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Feb 19 16:17:19 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Feb 19 16:19:15 2015 +0100
configure: typo in configure --with-default-raid10-segtype causing it to be unrecognized
AC_ARG_WITH(default-raid10r-segtype --> AC_ARG_WITH(default-raid10-segtype
(...raid10r... --> ...raid10... - extra "r")
---
WHATS_NEW | 1 +
aclocal.m4 | 2 +-
configure | 8 ++++----
configure.in | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b956a80..7bf4dfb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.117 -
====================================
+ 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 support for VG system_id to control host access to VGs.
diff --git a/aclocal.m4 b/aclocal.m4
index 6f752f2..2325191 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.13.4 -*- Autoconf -*-
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
diff --git a/configure b/configure
index ef0ae96..935702a 100755
--- a/configure
+++ b/configure
@@ -880,7 +880,7 @@ with_snapshots
with_mirrors
with_raid
with_default_mirror_segtype
-with_default_raid10r_segtype
+with_default_raid10_segtype
with_replicators
with_default_sparse_segtype
with_thin
@@ -7572,9 +7572,9 @@ else
fi
-# Check whether --with-default-raid10r-segtype was given.
-if test "${with_default_raid10r_segtype+set}" = set; then :
- withval=$with_default_raid10r_segtype; DEFAULT_RAID10_SEGTYPE=$withval
+# Check whether --with-default-raid10-segtype was given.
+if test "${with_default_raid10_segtype+set}" = set; then :
+ withval=$with_default_raid10_segtype; DEFAULT_RAID10_SEGTYPE=$withval
else
DEFAULT_RAID10_SEGTYPE="raid10"
fi
diff --git a/configure.in b/configure.in
index 73ca4cd..7c855bf 100644
--- a/configure.in
+++ b/configure.in
@@ -354,7 +354,7 @@ AC_ARG_WITH(default-mirror-segtype,
AC_HELP_STRING([--with-default-mirror-segtype=TYPE],
[default mirror segtype: raid1/mirror [raid1]]),
DEFAULT_MIRROR_SEGTYPE=$withval, DEFAULT_MIRROR_SEGTYPE="raid1")
-AC_ARG_WITH(default-raid10r-segtype,
+AC_ARG_WITH(default-raid10-segtype,
AC_HELP_STRING([--with-default-raid10-segtype=TYPE],
[default mirror segtype: raid10/mirror [raid10]]),
DEFAULT_RAID10_SEGTYPE=$withval, DEFAULT_RAID10_SEGTYPE="raid10")
9 years, 1 month
master - cleanup: drop unused header file
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=af395e61d52af3...
Commit: af395e61d52af330f5927f5dbf528c995574ee45
Parent: a18d789684e0fd1864e419b4ee8ba97c3a37030f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 19 14:42:27 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 19 14:44:04 2015 +0100
cleanup: drop unused header file
---
lib/filters/filter-partitioned.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/lib/filters/filter-partitioned.c b/lib/filters/filter-partitioned.c
index 2c21452..9ca8f6f 100644
--- a/lib/filters/filter-partitioned.c
+++ b/lib/filters/filter-partitioned.c
@@ -15,9 +15,6 @@
#include "lib.h"
#include "filter.h"
-#ifdef UDEV_SYNC_SUPPORT
-#include <libudev.h>
-#endif
static int _passes_partitioned_filter(struct dev_filter *f, struct device *dev)
{
9 years, 1 month
master - cleanup: simplify error path code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a18d789684e0fd...
Commit: a18d789684e0fd1864e419b4ee8ba97c3a37030f
Parent: 4c184e9d6b4aa74b5fbed0fb8710dc38b38545f9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 19 14:06:17 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 19 14:44:04 2015 +0100
cleanup: simplify error path code
Mempool needs to free only with first alllocated element,
everything allocated afterwards is released as well.
---
lib/metadata/lv_manip.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 088daaf..a77142c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -460,7 +460,7 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
if (!(*layout = str_list_create(mem))) {
log_error("LV layout list allocation failed");
- goto bad;
+ return 0;
}
if (!(*role = str_list_create(mem))) {
@@ -549,10 +549,8 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
return 1;
bad:
- if (*role)
- dm_pool_free(mem, *role);
- if (*layout)
- dm_pool_free(mem, *layout);
+ dm_pool_free(mem, *layout);
+
return 0;
}
9 years, 1 month
master - cleanup: drop unused value assign
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4c184e9d6b4aa7...
Commit: 4c184e9d6b4aa74b5fbed0fb8710dc38b38545f9
Parent: ed420fb6917162ed17af69a9a0ec9ae26e61e209
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 19 14:03:45 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Feb 19 14:43:25 2015 +0100
cleanup: drop unused value assign
Dop unused value assignments.
Unknown is detected via other combination
(!linear && !striped).
Also change the log_error() message into a warning,
since the function is not really returning error,
but still keep the INTERNAL_ERROR.
Ret value is always set later.
---
lib/device/dev-type.c | 5 ++---
lib/metadata/lv_manip.c | 11 +++++------
libdm/libdm-config.c | 4 ++--
tools/lvconvert.c | 2 +-
tools/pvchange.c | 3 +--
tools/pvresize.c | 2 +-
6 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index 1649a3a..882c08d 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -332,16 +332,15 @@ static int _has_partition_table(struct device *dev)
#ifdef UDEV_SYNC_SUPPORT
static int _udev_dev_is_partitioned(struct device *dev)
{
- const char *value;
struct dev_ext *ext;
if (!(ext = dev_ext_get(dev)))
return_0;
- if (!(value = udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE)))
+ if (!udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE))
return 0;
- if ((value = udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_ENTRY_DISK)))
+ if (udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_ENTRY_DISK))
return 0;
return 1;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index bdb2ef2..088daaf 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -452,7 +452,7 @@ bad:
int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
struct dm_list **layout, struct dm_list **role) {
- int linear, striped, unknown;
+ int linear, striped;
struct lv_segment *seg;
int public_lv = 1;
@@ -505,7 +505,7 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
* linear or striped or mixture of these two.
*/
if (dm_list_empty(*layout)) {
- linear = striped = unknown = 0;
+ linear = striped = 0;
dm_list_iterate_items(seg, &lv->segments) {
if (seg_is_linear(seg))
linear = 1;
@@ -519,10 +519,9 @@ int lv_layout_and_role(struct dm_pool *mem, const struct logical_volume *lv,
* the role above and we need add proper
* detection for such role!
*/
- unknown = 1;
- log_error(INTERNAL_ERROR "Failed to properly detect "
- "layout and role for LV %s/%s",
- lv->vg->name, lv->name);
+ log_warn(INTERNAL_ERROR "WARNING: Failed to properly detect "
+ "layout and role for LV %s/%s.",
+ lv->vg->name, lv->name);
}
}
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index 1ec604f..f7b07a5 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -522,7 +522,7 @@ static struct dm_config_node *_section(struct parser *p, struct dm_config_node *
{
/* IDENTIFIER SECTION_B_CHAR VALUE* SECTION_E_CHAR */
- struct dm_config_node *root, *n;
+ struct dm_config_node *root;
struct dm_config_value *value;
char *str;
@@ -555,7 +555,7 @@ static struct dm_config_node *_section(struct parser *p, struct dm_config_node *
if (p->t == TOK_SECTION_B) {
match(TOK_SECTION_B);
while (p->t != TOK_SECTION_E) {
- if (!(n = _section(p, root)))
+ if (!(_section(p, root)))
return_NULL;
}
match(TOK_SECTION_E);
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 935cbf9..9ec0b0b 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3538,7 +3538,7 @@ static int _lvconvert_merge_single(struct cmd_context *cmd, struct logical_volum
int lvconvert(struct cmd_context * cmd, int argc, char **argv)
{
- int ret = ECMD_PROCESSED;
+ int ret;
struct lvconvert_params lp = {
.target_attr = ~0,
};
diff --git a/tools/pvchange.c b/tools/pvchange.c
index c3e9215..3eb9e96 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -160,8 +160,7 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
{
struct pvchange_params params = { 0 };
struct processing_handle *handle = NULL;
-
- int ret = ECMD_PROCESSED;
+ int ret;
if (!(arg_count(cmd, allocatable_ARG) + arg_is_set(cmd, addtag_ARG) +
arg_is_set(cmd, deltag_ARG) + arg_count(cmd, uuid_ARG) +
diff --git a/tools/pvresize.c b/tools/pvresize.c
index 0f992a2..3057a7f 100644
--- a/tools/pvresize.c
+++ b/tools/pvresize.c
@@ -48,7 +48,7 @@ int pvresize(struct cmd_context *cmd, int argc, char **argv)
{
struct pvresize_params params;
struct processing_handle *handle = NULL;
- int ret = ECMD_PROCESSED;
+ int ret;
if (!argc) {
log_error("Please supply physical volume(s)");
9 years, 1 month