Skip to content

Commit

Permalink
Merge pull request ClusterLabs#1824 from oalbrigt/lvmlockd-add-use_lv…
Browse files Browse the repository at this point in the history
…mlockd-if-missing

lvmlockd: add "use_lvmlockd = 1" if it's commented out or missing
  • Loading branch information
oalbrigt committed Dec 1, 2022
2 parents eb56aef + 2695888 commit 3e84b0b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions heartbeat/lvmlockd
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,23 @@ setup_lvm_config()
lock_type=$(echo "$out" | cut -d'=' -f2)

if [ -z "$use_lvmlockd" ]; then
ocf_exit_reason "\"use_lvmlockd\" not set in /etc/lvm/lvm.conf ..."
exit $OCF_ERR_CONFIGURED
fi
ocf_log info "adding \"use_lvmlockd=1\" to /etc/lvm/lvm.conf ..."
cat >> /etc/lvm/lvm.conf << EOF
global {
use_lvmlockd = 1
}
EOF

if [ -n "$use_lvmlockd" ] && [ "$use_lvmlockd" != 1 ] ; then
if [ $? -ne 0 ]; then
ocf_exit_reason "unable to add \"use_lvmlockd=1\" to /etc/lvm/lvm.conf ..."
exit $OCF_ERR_CONFIGURED
fi
elif [ "$use_lvmlockd" != 1 ] ; then
ocf_log info "setting \"use_lvmlockd=1\" in /etc/lvm/lvm.conf ..."
sed -i 's,^[[:blank:]]*use_lvmlockd[[:blank:]]*=.*,\ \ \ \ use_lvmlockd = 1,g' /etc/lvm/lvm.conf
fi

if [ -n "$lock_type" ] ; then
# locking_type was removed from config in v2.03
ocf_version_cmp "$(lvmconfig --version | awk '/LVM ver/ {sub(/\(.*/, "", $3); print $3}')" "2.03"
Expand Down

0 comments on commit 3e84b0b

Please sign in to comment.