|
|
7b144c |
From 792077bf2994e2e582ccfb0768f3186517de9025 Mon Sep 17 00:00:00 2001
|
|
|
7b144c |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
7b144c |
Date: Fri, 21 Sep 2018 12:00:07 +0200
|
|
|
7b144c |
Subject: [PATCH] LVM-activate: fixes
|
|
|
7b144c |
|
|
|
7b144c |
- read parameters for start/stop/monitor-actions
|
|
|
7b144c |
- fail during monitor-action when run with incorrect access_mode
|
|
|
7b144c |
---
|
|
|
7b144c |
heartbeat/LVM-activate | 44 ++++++++++++++++++++++++++----------------
|
|
|
7b144c |
1 file changed, 27 insertions(+), 17 deletions(-)
|
|
|
7b144c |
|
|
|
7b144c |
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
|
|
|
7b144c |
index 55e36a2d2..f46932c1c 100755
|
|
|
7b144c |
--- a/heartbeat/LVM-activate
|
|
|
7b144c |
+++ b/heartbeat/LVM-activate
|
|
|
7b144c |
@@ -56,6 +56,7 @@ LV=${OCF_RESKEY_lvname}
|
|
|
7b144c |
# 3: vg has system_id (new)
|
|
|
7b144c |
# 4: vg has tagging (old)
|
|
|
7b144c |
VG_access_mode=${OCF_RESKEY_vg_access_mode}
|
|
|
7b144c |
+VG_access_mode_num=0
|
|
|
7b144c |
|
|
|
7b144c |
# Activate LV(s) with "shared" lock for cluster fs
|
|
|
7b144c |
# or "exclusive" lock for local fs
|
|
|
7b144c |
@@ -176,7 +177,9 @@ END
|
|
|
7b144c |
# 2: vg is clustered - clvmd (old)
|
|
|
7b144c |
# 3: vg has system_id (new)
|
|
|
7b144c |
# 4: vg has tagging (old)
|
|
|
7b144c |
-get_VG_access_mode() {
|
|
|
7b144c |
+
|
|
|
7b144c |
+get_VG_access_mode_num()
|
|
|
7b144c |
+{
|
|
|
7b144c |
local access_mode
|
|
|
7b144c |
local vg_locktype
|
|
|
7b144c |
local vg_clustered
|
|
|
7b144c |
@@ -415,11 +418,8 @@ tagging_check()
|
|
|
7b144c |
return $OCF_SUCCESS
|
|
|
7b144c |
}
|
|
|
7b144c |
|
|
|
7b144c |
-lvm_validate() {
|
|
|
7b144c |
- local lv_count
|
|
|
7b144c |
- local mode
|
|
|
7b144c |
-
|
|
|
7b144c |
- # Parameters checking
|
|
|
7b144c |
+read_parameters()
|
|
|
7b144c |
+{
|
|
|
7b144c |
if [ -z "$VG" ]
|
|
|
7b144c |
then
|
|
|
7b144c |
ocf_exit_reason "You must identify the volume group name!"
|
|
|
7b144c |
@@ -435,22 +435,30 @@ lvm_validate() {
|
|
|
7b144c |
# Convert VG_access_mode from string to index
|
|
|
7b144c |
case ${VG_access_mode} in
|
|
|
7b144c |
lvmlockd)
|
|
|
7b144c |
- VG_access_mode=1
|
|
|
7b144c |
+ VG_access_mode_num=1
|
|
|
7b144c |
;;
|
|
|
7b144c |
clvmd)
|
|
|
7b144c |
- VG_access_mode=2
|
|
|
7b144c |
+ VG_access_mode_num=2
|
|
|
7b144c |
;;
|
|
|
7b144c |
system_id)
|
|
|
7b144c |
- VG_access_mode=3
|
|
|
7b144c |
+ VG_access_mode_num=3
|
|
|
7b144c |
;;
|
|
|
7b144c |
tagging)
|
|
|
7b144c |
- VG_access_mode=4
|
|
|
7b144c |
+ VG_access_mode_num=4
|
|
|
7b144c |
;;
|
|
|
7b144c |
*)
|
|
|
7b144c |
+ # dont exit with error-code here or nodes will get fenced on
|
|
|
7b144c |
+ # e.g. "pcs resource create"
|
|
|
7b144c |
ocf_exit_reason "You specified an invalid value for vg_access_mode: $VG_access_mode"
|
|
|
7b144c |
- exit $OCF_ERR_CONFIGURED
|
|
|
7b144c |
;;
|
|
|
7b144c |
esac
|
|
|
7b144c |
+}
|
|
|
7b144c |
+
|
|
|
7b144c |
+lvm_validate() {
|
|
|
7b144c |
+ local lv_count
|
|
|
7b144c |
+ local mode
|
|
|
7b144c |
+
|
|
|
7b144c |
+ read_parameters
|
|
|
7b144c |
|
|
|
7b144c |
check_binary pgrep
|
|
|
7b144c |
# Every LVM command is just symlink to lvm binary
|
|
|
7b144c |
@@ -471,9 +479,9 @@ lvm_validate() {
|
|
|
7b144c |
# Get the access mode from VG metadata and check if it matches the input
|
|
|
7b144c |
# value. Skip to check "tagging" mode because there's no reliable way to
|
|
|
7b144c |
# automatically check if "tagging" mode is being used.
|
|
|
7b144c |
- get_VG_access_mode
|
|
|
7b144c |
+ get_VG_access_mode_num
|
|
|
7b144c |
mode=$?
|
|
|
7b144c |
- if [ $VG_access_mode -ne 4 ] && [ $mode -ne $VG_access_mode ]; then
|
|
|
7b144c |
+ if [ $VG_access_mode_num -ne 4 ] && [ $mode -ne $VG_access_mode_num ]; then
|
|
|
7b144c |
ocf_exit_reason "The specified vg_access_mode doesn't match the lock_type on VG metadata!"
|
|
|
7b144c |
exit $OCF_ERR_ARGS
|
|
|
7b144c |
fi
|
|
|
7b144c |
@@ -495,8 +503,8 @@ lvm_validate() {
|
|
|
7b144c |
fi
|
|
|
7b144c |
fi
|
|
|
7b144c |
|
|
|
7b144c |
- # VG_access_mode specific checking goes here
|
|
|
7b144c |
- case ${VG_access_mode} in
|
|
|
7b144c |
+ # VG_access_mode_num specific checking goes here
|
|
|
7b144c |
+ case ${VG_access_mode_num} in
|
|
|
7b144c |
1)
|
|
|
7b144c |
lvmlockd_check
|
|
|
7b144c |
;;
|
|
|
7b144c |
@@ -731,7 +739,7 @@ lvm_start() {
|
|
|
7b144c |
[ -z ${LV} ] && vol=${VG} || vol=${VG}/${LV}
|
|
|
7b144c |
ocf_log info "Activating ${vol}"
|
|
|
7b144c |
|
|
|
7b144c |
- case ${VG_access_mode} in
|
|
|
7b144c |
+ case ${VG_access_mode_num} in
|
|
|
7b144c |
1)
|
|
|
7b144c |
lvmlockd_activate
|
|
|
7b144c |
;;
|
|
|
7b144c |
@@ -773,7 +781,7 @@ lvm_stop() {
|
|
|
7b144c |
|
|
|
7b144c |
ocf_log info "Deactivating ${vol}"
|
|
|
7b144c |
|
|
|
7b144c |
- case ${VG_access_mode} in
|
|
|
7b144c |
+ case ${VG_access_mode_num} in
|
|
|
7b144c |
1)
|
|
|
7b144c |
lvmlockd_deactivate
|
|
|
7b144c |
;;
|
|
|
7b144c |
@@ -811,9 +819,11 @@ start)
|
|
|
7b144c |
lvm_start
|
|
|
7b144c |
;;
|
|
|
7b144c |
stop)
|
|
|
7b144c |
+ read_parameters
|
|
|
7b144c |
lvm_stop
|
|
|
7b144c |
;;
|
|
|
7b144c |
monitor)
|
|
|
7b144c |
+ lvm_validate
|
|
|
7b144c |
lvm_status
|
|
|
7b144c |
;;
|
|
|
7b144c |
validate-all)
|