[PATCH 2/3] kdumpctl: Check the update of the binary and script files
in /etc/kdump/{pre.d,post.d}
by onitsuka.shinic@fujitsu.com
This patch checks the update of the binary and script files in
/etc/kdump/{pre.d,post.d} for initramfs of kdump.
When kdumpd service is started or restarted, initramfs of kdump is recreated
by new the binary and script files, if the binary and script files in
/etc/kdump/{pre.d,post.d} are updated.
Signed-off-by: shin-onitsuka <onitsuka.shinic(a)fujitsu.com>
---
kdumpctl | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index f75b820..136fd36 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -335,9 +335,19 @@ check_files_modified()
EXTRA_BINS=`grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\ -f2`
CHECK_FILES=`grep ^kdump_pre $KDUMP_CONFIG_FILE | cut -d\ -f2`
+ if [ -d /etc/kdump/post.d ]; then
+ for file in `find /etc/kdump/post.d -type f`; do
+ POST_FILES="$POST_FILES $file"
+ done
+ fi
+ if [ -d /etc/kdump/pre.d ]; then
+ for file in `find /etc/kdump/pre.d -type f`; do
+ PRE_FILES="$PRE_FILES $file"
+ done
+ fi
CORE_COLLECTOR=`grep ^core_collector $KDUMP_CONFIG_FILE | cut -d\ -f2`
CORE_COLLECTOR=`type -P $CORE_COLLECTOR`
- EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
+ EXTRA_BINS="$EXTRA_BINS $CHECK_FILES $POST_FILES $PRE_FILES"
CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-`
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS $CORE_COLLECTOR"
--
1.8.3.1
4 years, 5 months
[PATCH 1/3] dracut-kdump.sh: Execute the binary and script files in
/etc/kdump/{pre.d,post.d}.
by onitsuka.shinic@fujitsu.com
This patch executes the binary and script files in /etc/kdump/{pre.d,post.d}
just like kdump_pre or kdump_post directive written in /etc/kdump.conf.
Signed-off-by: shin-onitsuka <onitsuka.shinic(a)fujitsu.com>
---
dracut-kdump.sh | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 2ae1c7c..51a1f73 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -30,15 +30,51 @@ do_dump()
do_kdump_pre()
{
+ local _ret
+
if [ -n "$KDUMP_PRE" ]; then
"$KDUMP_PRE"
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ echo "kdump: $KDUMP_PRE exited with $_ret status"
+ return $_ret
+ fi
+ fi
+
+ if [ -d /etc/kdump/pre.d ]; then
+ for file in `find /etc/kdump/pre.d -type f | sort`; do
+ "$file"
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ echo "kdump: $file exited with $_ret status"
+ return $_ret
+ fi
+ done
fi
}
do_kdump_post()
{
+ local _ret
+
+ if [ -d /etc/kdump/post.d ]; then
+ for file in `find /etc/kdump/post.d -type f | sort`; do
+ "$file" "$1"
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ echo "kdump: $file exited with $_ret status"
+ return $_ret
+ fi
+ done
+ fi
+
if [ -n "$KDUMP_POST" ]; then
"$KDUMP_POST" "$1"
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ echo "kdump: $KDUMP_POST exited with $_ret status"
+ return $_ret
+ fi
fi
}
--
1.8.3.1
4 years, 5 months
[PATCH 0/3]fix /etc/kdump/{pre.d,post.d} interface to set up multiple
binary and script files
by onitsuka.shinic@fujitsu.com
There is restriction on kdump_pre and kdump_post directives now that can be
specified only once in /etc/kdump.conf.
However, there are multiple components that need to use the directives.
This patch implements /etc/kdump/{pre.d,post.d} interface to set up multiple
binary and script files.
For example, users put multiple binary and script files under
/etc/kdump/pre.d directory as below:
# find /etc/kdump/pre.d
/etc/kdump/pre.d/50-foo.sh
/etc/kdump/pre.d/75-hoge.sh
Then, 50-foo.sh and 75-hoge.sh are executed in order before kdump dump process
begins just like kdump_pre directive written in /etc/kdump.conf.
This is composed of the following three patches created based on
commit 603cd09b76584a1e3a2363f939cec0b7e29e52fb.
shin-onitsuka (3):
dracut-kdump.sh: Execute the binary and script files in
/etc/kdump/{pre.d,post.d}.
kdumpctl: Check the update of the binary and script files in
/etc/kdump/{pre.d,post.d}
dracut-module-setup.sh: Install files under /etc/kdump/{pre.d,post.d}
into kdump initramfs
dracut-kdump.sh | 36 ++++++++++++++++++++++++++++++++++++
dracut-module-setup.sh | 20 ++++++++++++++++++++
kdumpctl | 12 +++++++++++-
3 files changed, 67 insertions(+), 1 deletion(-)
--
1.8.3.1
4 years, 5 months
[PATCH] Don't execute final_action if failure_action terminates the system
by Kairui Song
If failure_action is shutdown/reboot/halt, final_action is pointless as
the system will be already stopping. And if final_action is different
from failure_action, it will trigger a systemd race problem and cause
unexpected behavior to occur.
So let the error handler stop and exit after performing failure_action
successfully if failure_action is one of shutdown/reboot/halt.
This way, final_action will not be executed.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib-initramfs.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index c409dce..8530556 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -56,13 +56,13 @@ get_kdump_confs()
FAILURE_ACTION="kdump_emergency_shell"
;;
reboot)
- FAILURE_ACTION="systemctl reboot -f"
+ FAILURE_ACTION="systemctl reboot -f && exit"
;;
halt)
- FAILURE_ACTION="halt"
+ FAILURE_ACTION="halt && exit"
;;
poweroff)
- FAILURE_ACTION="systemctl poweroff -f"
+ FAILURE_ACTION="systemctl poweroff -f && exit"
;;
dump_to_rootfs)
FAILURE_ACTION="dump_to_rootfs"
--
2.21.0
4 years, 5 months