summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2013-09-24 14:03:42 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2013-09-24 14:03:42 +0200
commit6553f86818404cd34fa3600dc976ed25fcf6d65a (patch)
tree61db25ab940d8be90248f6de8f09e0c1edeffffc /scripts
parentf050278a35ec0049fa333ce82abfc2bf6a231c62 (diff)
downloadlvm2-6553f86818404cd34fa3600dc976ed25fcf6d65a.tar.gz
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lvmconf.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/lvmconf.sh b/scripts/lvmconf.sh
index 5a8e9e84f..bfe518e82 100644
--- a/scripts/lvmconf.sh
+++ b/scripts/lvmconf.sh
@@ -16,6 +16,8 @@
# Edit an lvm.conf file to adjust various properties
#
+DEFAULT_USE_LVMETAD=0
+
function usage
{
echo "usage: $0 <command>"
@@ -37,10 +39,12 @@ function parse_args
case $1 in
--enable-cluster)
LOCKING_TYPE=3
+ USE_LVMETAD=0
shift
;;
--disable-cluster)
LOCKING_TYPE=1
+ USE_LVMETAD=$DEFAULT_USE_LVMETAD
shift
;;
--lockinglibdir)
@@ -129,6 +133,7 @@ TMPFILE=/etc/lvm/.lvmconf-tmp.tmp
have_type=1
have_dir=1
have_library=1
+have_use_lvmetad=1
have_global=1
grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' $CONFIGFILE
@@ -140,8 +145,11 @@ have_dir=$?
grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' $CONFIGFILE
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.
-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
# See if we can find it...
@@ -174,6 +182,8 @@ global {
# Enable locking for cluster LVM
locking_type = $LOCKING_TYPE
library_dir = "$LOCKINGLIBDIR"
+ # Disable lvmetad in cluster
+ use_lvmetad = 0
EOF
if [ $? != 0 ]
then
@@ -233,6 +243,13 @@ else
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
sed <$CONFIGFILE >$TMPFILE -f $SCRIPTFILE
if [ $? != 0 ]