This is useful for memory/cpu hotplug udev events. With this
function, we can add "ExecReload=/usr/bin/kdumpctl reload" in
"kdump.service", and "/bin/systemctl reload kdump.service" will
trigger the kdump kernel reload.
We will specify it in "/usr/lib/udev/rules.d/98-kexec.rules" as
the "PROGRAM" executed as follows:
PROGRAM="/bin/systemctl reload-or-try-restart kdump.service"
instead of
PROGRAM="/bin/systemctl try-restart kdump.service"
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
kdumpctl | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 69b2f3b..811d7f2 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -615,7 +615,7 @@ need_64bit_headers()
print (strtonum("0x" r[2]) > strtonum("0xffffffff")); }'`
}
-# Load the kdump kerel specified in /etc/sysconfig/kdump
+# Load the kdump kernel specified in /etc/sysconfig/kdump
# If none is specified, try to load a kdump kernel with the same version
# as the currently running kernel.
load_kdump()
@@ -664,6 +664,30 @@ load_kdump()
fi
}
+# Reload the kdump kernel specified in /etc/sysconfig/kdump.
+# If none is specified, try to load a kdump kernel with the same version
+# as the currently running kernel.
+#
+# This is useful for memory/cpu hotplug udev events. With this function,
+# we can add "ExecReload=/usr/bin/kdumpctl reload" in
"kdump.service",
+# and "/bin/systemctl reload kdump.service" will trigger the kernel reload.
+
+# We use it as "PROGRAM" executed in
"/usr/lib/udev/rules.d/98-kexec.rules":
+# PROGRAM="/bin/systemctl reload-or-try-restart kdump.service"
+reload_dump()
+{
+ # Since systemctl reload kdump.service is called to enter it, we must have
+ # an active kdump.service, thus we assume all prerequisites are going well
+ # and call kexec -p (for kdump) to reload the kernel without any validation.
+
+ prepare_dump
+ if [ $? -ne 0 ]; then
+ return
+ fi
+
+ start_dump
+}
+
check_ssh_config()
{
while read config_opt config_val; do
@@ -1146,6 +1170,9 @@ main ()
stop
start
;;
+ reload)
+ reload_dump
+ ;;
condrestart)
;;
propagate)
--
1.8.3.1