Skip to contentSkip to conversation

main - lvmlockctl: use lvm.conf lvmlockctl_kill_command

PATCH David Teigland 1 participant 1 message Mar 3, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=89a3440fc0179318954855aa251b0aae4f5c1a63
Commit:        89a3440fc0179318954855aa251b0aae4f5c1a63
Parent:        e9d10f371199055e9ed0c2715b5353491cb759b0
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Mar 1 15:22:54 2021 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Mar 3 13:57:15 2021 -0600

lvmlockctl: use lvm.conf lvmlockctl_kill_command

which specifies a command to run by lvmlockctl --kill.

---
 configure                     |   3 +
 configure.ac                  |   2 +
 daemons/lvmlockd/lvmlockctl.c | 197 +++++++++++++++++++++++++++++++++---------
 include/configure.h.in        |   3 +
 lib/config/config_settings.h  |   9 ++
 man/lvmlockctl.8_main         |  14 +--
 6 files changed, 180 insertions(+), 48 deletions(-)
configure +3 -0
index 4c38cbebb..b84a20144 100755
@@ -693,6 +693,7 @@ MANGLING
 LVM_RELEASE_DATE
 LVM_RELEASE
 LVM_PATH
+LVM_DIR
 LVM_PATCHLEVEL
 LVM_MINOR
 LVM_MAJOR
@@ -13766,9 +13767,11 @@ SYSCONFDIR="$(eval echo $(eval echo $sysconfdir))"
 
 SBINDIR="$(eval echo $(eval echo $sbindir))"
 LVM_PATH="$SBINDIR/lvm"
+LVM_DIR="$SBINDIR/"
 
 cat >>confdefs.h <<_ACEOF
 #define LVM_PATH "$LVM_PATH"
+#define LVM_DIR "$LVM_DIR"
 _ACEOF
 
 
configure.ac +2 -0
index ee21b879d..93f91384d 100644
@@ -1607,7 +1607,9 @@ SYSCONFDIR="$(eval echo $(eval echo $sysconfdir))"
 
 SBINDIR="$(eval echo $(eval echo $sbindir))"
 LVM_PATH="$SBINDIR/lvm"
+LVM_DIR="$SBINDIR/"
 AC_DEFINE_UNQUOTED(LVM_PATH, ["$LVM_PATH"], [Path to lvm binary.])
+AC_DEFINE_UNQUOTED(LVM_DIR, ["$LVM_DIR"], [Path to lvm binary dir.])
 
 LVMCONFIG_PATH="$SBINDIR/lvmconfig"
 AC_DEFINE_UNQUOTED(LVMCONFIG_PATH, ["$LVMCONFIG_PATH"], [Path to lvmconfig binary.])
daemons/lvmlockd/lvmlockctl.c +154 -43

294 lines not on this page · raw message

include/configure.h.in +3 -0
index 59b4da86f..2597651e3 100644
@@ -586,6 +586,9 @@
 /* Path to lvm binary. */
 #undef LVM_PATH
 
+/* Path to lvm binary dir. */
+#undef LVM_DIR
+
 /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
    */
 #undef MAJOR_IN_MKDEV
lib/config/config_settings.h +9 -0
index f04b435fb..fac5d6317 100644
@@ -1152,6 +1152,15 @@ cfg(global_sanlock_lv_extend_CFG, "sanlock_lv_extend", global_CFG_SECTION, CFG_D
 	"and can cause lvcreate to fail. Applicable only if LVM is compiled\n"
 	"with lockd support\n")
 
+cfg(global_lvmlockctl_kill_command_CFG, "lvmlockctl_kill_command", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, "", vsn(2, 3, 12), NULL, 0, NULL,
+	"The command that lvmlockctl --kill should use to force LVs offline.\n"
+	"The lvmlockctl --kill command is run when a shared VG has lost\n"
+	"access to locks (e.g. when sanlock has lost access to storage.)\n"
+	"An empty string means that there will be no automatic attempt by\n"
+	"lvmlockctl --kill to forcibly shut down LVs in the VG, and the user\n"
+	"can manually intervene as described in lvmlockd(8).\n"
+	"The VG name will be appended to the command specified here.\n")
+
 cfg(global_thin_check_executable_CFG, "thin_check_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, THIN_CHECK_CMD, vsn(2, 2, 94), "@THIN_CHECK_CMD@", 0, NULL,
 	"The full path to the thin_check command.\n"
 	"LVM uses this command to check that a thin metadata device is in a\n"
man/lvmlockctl.8_main +9 -5
index b7ac0ecd6..14ce926b5 100644
@@ -65,17 +65,21 @@ and prints it.
 .SS kill
 
 This is run by sanlock when it loses access to the storage holding leases
-for a VG.  It currently emits a syslog message stating that the VG must
-be immediately deactivated.  In the future it may automatically attempt to
-forcibly deactivate the VG.  For more, see
+for a VG.  It runs the command specified in lvm.conf
+lvmlockctl_kill_command to deactivate LVs in the VG.  If the specified
+command is successful, locks will be dropped for the VG in lvmlockd
+(the equivalent of lvmlockctl --drop will be run.)  If no command
+is specified, or the command fails, then the user must intervene
+to forcefully deactivate LVs in the VG, and if successful, run
+lvmlockctl --drop.  For more, see
 .BR lvmlockd (8).
 
 .SS drop
 
 This should only be run after a VG has been successfully deactivated
 following an lvmlockctl --kill command.  It clears the stale lockspace
-from lvmlockd.  In the future, this may become automatic along with an
-automatic handling of --kill.  For more, see
+from lvmlockd.  When lvmlockctl_kill_command is used, the --kill
+command may run drop automatically.  For more, see
 .BR lvmlockd (8).
 
 .SS gl-enable