1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvmconf: use_lvmetad=0 on --enable-cluster, reset to default on --disable-cluster

lvmetad is not yet supported in clustered environment so
disable it automatically if using lvmconf --enable-cluster
and reset it to default value if using lvmconf --disable-cluster.

Also, add a few comments in lvm.conf about locking_type vs. use_lvmetad
if setting it for clustered environment.
This commit is contained in:
Peter Rajnoha 2013-09-24 14:03:42 +02:00
parent f050278a35
commit 6553f86818
4 changed files with 30 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.103 - Version 2.02.103 -
====================================== ======================================
Set use_lvmetad=0 on lvmconf --enable-cluster, reset to default on --disable-cluster.
Don't install separate command symlink in binary directory for 'lvm devtypes'. Don't install separate command symlink in binary directory for 'lvm devtypes'.
Add seg_size_pe field to reports. Add seg_size_pe field to reports.
Support start+length notation with command line PE ranges. Support start+length notation with command line PE ranges.

View File

@ -432,6 +432,10 @@ global {
# Type 3 uses built-in clustered locking. # Type 3 uses built-in clustered locking.
# Type 4 uses read-only locking which forbids any operations that might # Type 4 uses read-only locking which forbids any operations that might
# change metadata. # change metadata.
# N.B. Don't use lvmetad with locking type 3 as lvmetad is not yet
# supported in clustered environment. If use_lvmetad=1 and locking_type=3
# is set at the same time, LVM always issues a warning message about this
# and then it automatically disables lvmetad use.
locking_type = 1 locking_type = 1
# Set to 0 to fail when a lock request cannot be satisfied immediately. # Set to 0 to fail when a lock request cannot be satisfied immediately.
@ -571,6 +575,10 @@ global {
# setting itself. # setting itself.
# To prevent scanning devices completely, even when using lvmetad, # To prevent scanning devices completely, even when using lvmetad,
# the devices/global_filter must be used. # the devices/global_filter must be used.
# N.B. Don't use lvmetad with locking type 3 as lvmetad is not yet
# supported in clustered environment. If use_lvmetad=1 and locking_type=3
# is set at the same time, LVM always issues a warning message about this
# and then it automatically disables lvmetad use.
use_lvmetad = 0 use_lvmetad = 0
# Full path of the utility called to check that a thin metadata device # Full path of the utility called to check that a thin metadata device

View File

@ -22,10 +22,12 @@ an lvm configuration file. See \fBlvm.conf\fP(5).
.SH "OPTIONS" .SH "OPTIONS"
.TP .TP
.BR \-\-disable-cluster .BR \-\-disable-cluster
Set \fBlocking_type\fR to the default non-clustered type. Set \fBlocking_type\fR to the default non-clustered type. Also reset
lvmetad use to its default.
.TP .TP
.BR \-\-enable-cluster .BR \-\-enable-cluster
Set \fBlocking_type\fR to the default clustered type on this system. Set \fBlocking_type\fR to the default clustered type on this system.
Also disable lvmetad use as it is not yet supported in clustered environment.
.TP .TP
.BR \-\-file " <" \fIconfigfile > .BR \-\-file " <" \fIconfigfile >
Apply the changes to \fIconfigfile\fP instead of the default Apply the changes to \fIconfigfile\fP instead of the default

View File

@ -16,6 +16,8 @@
# Edit an lvm.conf file to adjust various properties # Edit an lvm.conf file to adjust various properties
# #
DEFAULT_USE_LVMETAD=0
function usage function usage
{ {
echo "usage: $0 <command>" echo "usage: $0 <command>"
@ -37,10 +39,12 @@ function parse_args
case $1 in case $1 in
--enable-cluster) --enable-cluster)
LOCKING_TYPE=3 LOCKING_TYPE=3
USE_LVMETAD=0
shift shift
;; ;;
--disable-cluster) --disable-cluster)
LOCKING_TYPE=1 LOCKING_TYPE=1
USE_LVMETAD=$DEFAULT_USE_LVMETAD
shift shift
;; ;;
--lockinglibdir) --lockinglibdir)
@ -129,6 +133,7 @@ TMPFILE=/etc/lvm/.lvmconf-tmp.tmp
have_type=1 have_type=1
have_dir=1 have_dir=1
have_library=1 have_library=1
have_use_lvmetad=1
have_global=1 have_global=1
grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' $CONFIGFILE grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' $CONFIGFILE
@ -140,8 +145,11 @@ have_dir=$?
grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' $CONFIGFILE grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' $CONFIGFILE
have_library=$? have_library=$?
grep -q '^[[:blank:]]*use_lvmetad[[:blank:]]*=' $CONFIGFILE
have_use_lvmetad=$?
# Those options are in section "global {" so we must have one if any are present. # Those options are in section "global {" so we must have one if any are present.
if [ "$have_type" = "0" -o "$have_dir" = "0" -o "$have_library" = "0" ] if [ "$have_type" = "0" -o "$have_dir" = "0" -o "$have_library" = "0" -o "$have_use_lvmetad" = "0" ]
then then
# See if we can find it... # See if we can find it...
@ -174,6 +182,8 @@ global {
# Enable locking for cluster LVM # Enable locking for cluster LVM
locking_type = $LOCKING_TYPE locking_type = $LOCKING_TYPE
library_dir = "$LOCKINGLIBDIR" library_dir = "$LOCKINGLIBDIR"
# Disable lvmetad in cluster
use_lvmetad = 0
EOF EOF
if [ $? != 0 ] if [ $? != 0 ]
then then
@ -233,6 +243,13 @@ else
fi fi
fi fi
if [ "$have_use_lvmetad" = "0" ]
then
SEDCMD="${SEDCMD}\ns'^[[:blank:]]*use_lvmetad[[:blank:]]*=.*'\ \ \ \ use_lvmetad = $USE_LVMETAD'g"
else
SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ use_lvmetad = $USE_LVMETAD"
fi
echo -e $SEDCMD > $SCRIPTFILE echo -e $SEDCMD > $SCRIPTFILE
sed <$CONFIGFILE >$TMPFILE -f $SCRIPTFILE sed <$CONFIGFILE >$TMPFILE -f $SCRIPTFILE
if [ $? != 0 ] if [ $? != 0 ]