[Patch v5 1/6] introduce several basic utility function
by Baoquan He
These utility function will be shared by several files, they are all
operation related to mount stuff.
Meantime define DEFAULT_PATH="/var/crash".
Signed-off-by: Baoquan He <bhe(a)redhat.com>
Acked-by: Vivek Goyal <vgoyal(a)redhat.com>
---
kdump-lib.sh | 21 +++++++++++++++++++++
mkdumprd | 2 +-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index de32650..bf57a91 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -3,6 +3,7 @@
# Kdump common variables and functions
#
+DEFAULT_PATH="/var/crash/"
FENCE_KDUMP_CONFIG="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FENCE_KDUMP_NODES="/etc/fence_kdump_nodes"
@@ -75,3 +76,23 @@ get_root_fs_device()
return
}
+get_mntpoint_from_path()
+{
+ echo $(df $1 | tail -1 | awk '{print $NF}')
+}
+
+get_target_from_path()
+{
+ echo $(df $1 | tail -1 | awk '{print $1}')
+}
+
+get_fs_type_from_target()
+{
+ echo $(findmnt -k -f -n -r -o FSTYPE $1)
+}
+
+get_mntpoint_from_target()
+{
+ echo $(findmnt -k -f -n -r -o TARGET $1)
+}
+
diff --git a/mkdumprd b/mkdumprd
index 84f1e18..3849866 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -12,7 +12,7 @@ export IN_KDUMP=1
conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
-[ -z "$SAVE_PATH" ] && SAVE_PATH="/var/crash"
+[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
extra_modules=""
dracut_args=("--hostonly" "-o" "plymouth dash resume")
OVERRIDE_RESETTABLE=0
--
1.8.5.3
10 years
[RFC][PATCH] Add --split support for dump on filesystem
by HATAYAMA Daisuke
Hello,
This is an RFC patch intended to first review basic design of --split option support.
This version automatically appends --split option if more than 1 cpu is available on kdump 2nd kernel. I guess someone propably doesn't like the situation that multiple vmcores are generated implicitly without any explicit user operation. So, I'd like comments on this design first.
Another idea is to introduce a new directive to specify the number of vmcores into which we split /proc/vmcore, and then we append --split option if and only if the directive is specified with the value more than 1 cpu.
>From e6afa242829768ee0b9e58637444acf3fed4b442 Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama(a)jp.fujitsu.com>
Date: Tue, 25 Mar 2014 17:09:42 +0900
Subject: [PATCH] Add --split support for dump on filesystem
This commit implement makedumpfile --split option support, allowing
filtering and compression in paralell.
In this design, --split option is automatically appended if more than
1 cpu is available. Also, the number of generated dump files are
automatically decided to the number of online cpus.
To support --split option for dump on network, it's necessary to add
new feature in makedumpfile to make it possible to specify --split
option and -F option at the same time. This is going to be done
separately.
Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)jp.fujitsu.com>
---
dracut-kdump.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index d9e65ac..76494ab 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -88,6 +88,8 @@ dump_fs()
{
local _dev=$(findmnt -k -f -n -r -o SOURCE $1)
local _mp=$(findmnt -k -f -n -r -o TARGET $1)
+ local _savedir="$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR"
+ local _nr_cpus=$(grep processor /proc/cpuinfo | wc -l)
echo "kdump: dump target is $_dev"
@@ -100,16 +102,23 @@ dump_fs()
# Remove -F in makedumpfile case. We don't want a flat format dump here.
[[ $CORE_COLLECTOR = *makedumpfile* ]] && CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e "s/-F//g"`
- echo "kdump: saving to $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ echo "kdump: saving to $_savedir"
mount -o remount,rw $_mp || return 1
- mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1
+ mkdir -p $_savedir || return 1
- save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_savedir"
echo "kdump: saving vmcore"
- $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete || return 1
- mv $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore
+ if [[ $CORE_COLLECTOR = *makedumpfile* && $_nr_cpus > 1 ]] ; then
+ $CORE_COLLECTOR --split /proc/vmcore $(seq -s " " -f "$_savedir/vmcore-incomplete-%g" $_nr_cpus) || return 1
+ for i in $(seq $_nr_cpus); do
+ mv $_savedir/vmcore-incomplete-$i $_savedir/vmcore-$i
+ done
+ else
+ $CORE_COLLECTOR /proc/vmcore $_savedir/vmcore-incomplete || return 1
+ mv $_savedir/vmcore-incomplete $_savedir/vmcore
+ fi
sync
echo "kdump: saving vmcore complete"
--
1.8.5.3
10 years
[PATCH v2] kdump-dep-generator: Add kdump service dependencies on the fly
by WANG Chao
kdump-dep-generator is a systemd generator, used to write out kdump
service dependencies.
Currently it's only useful for ssh dump case. And in ssh dump case, it
writes out a dependency which kdump.service "Wants"
network-online.target:
# ls -l /run/systemd/generator/kdump.service.wants/
[..] network-online.target -> /usr/lib/systemd/system/network-online.target
So that kdump.service will pull in network-online.target and delayed
start until network-online.target is reached.
In the future, we could use generator to write out kdump.service
dynamically and get rid of the static defined kdump.service at all.
v1->v2:
Vivek: not using hardcoded run time generator path, use what systemd pass in.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdump-dep-generator.sh | 22 ++++++++++++++++++++++
kexec-tools.spec | 3 +++
2 files changed, 25 insertions(+)
create mode 100644 kdump-dep-generator.sh
diff --git a/kdump-dep-generator.sh b/kdump-dep-generator.sh
new file mode 100644
index 0000000..b6fab2d
--- /dev/null
+++ b/kdump-dep-generator.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# More details about systemd generator:
+# http://www.freedesktop.org/wiki/Software/systemd/Generators/
+
+. /usr/lib/kdump/kdump-lib.sh
+
+# If invokded with no arguments for testing purpose, output to /tmp to
+# avoid overriding the existing.
+dest_dir="/tmp"
+
+if [ -n "$1" ]; then
+ dest_dir=$1
+fi
+
+systemd_dir=/usr/lib/systemd/system
+kdump_wants=$dest_dir/kdump.service.wants
+
+if is_ssh_dump_target; then
+ mkdir -p $kdump_wants
+ ln -sf $systemd_dir/network-online.target $kdump_wants/
+fi
diff --git a/kexec-tools.spec b/kexec-tools.spec
index cfe14c4..e6ffade 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -26,6 +26,7 @@ Source18: kdump.sysconfig.s390x
Source19: eppic_030413.tar.gz
Source20: kdump-lib.sh
Source21: kdump-in-cluster-environment.txt
+Source22: kdump-dep-generator.sh
#######################################
# These are sources for mkdumpramfs
@@ -181,6 +182,7 @@ install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/98-kexec.r
%endif
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
+install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
mkdir -p $RPM_BUILD_ROOT/usr/sbin
install -m 755 %{SOURCE17} $RPM_BUILD_ROOT/usr/sbin/rhcrashkernel-param
@@ -320,6 +322,7 @@ done
%{_mandir}/man8/*
%{_mandir}/man5/*
%{_unitdir}/kdump.service
+%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
%doc News
%doc COPYING
%doc TODO
--
1.8.5.3
10 years
[PATCH] kdump-dep-generator: Add kdump service dependencies on the fly
by WANG Chao
kdump-dep-generator is a systemd generator, used to write out kdump
service dependencies.
Currently it's only useful for ssh dump case. And in ssh dump case, it
writes out a dependency which kdump.service "Wants"
network-online.target:
# ls -l /run/systemd/generator/kdump.service.wants/
[..] network-online.target -> /usr/lib/systemd/system/network-online.target
So that kdump.service will pull in network-online.target and delayed
start until network-online.target is reached.
In the future, we could use generator to write out kdump.service
dynamically and get rid of the static defined kdump.service at all.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdump-dep-generator.sh | 12 ++++++++++++
kexec-tools.spec | 3 +++
2 files changed, 15 insertions(+)
create mode 100644 kdump-dep-generator.sh
diff --git a/kdump-dep-generator.sh b/kdump-dep-generator.sh
new file mode 100644
index 0000000..669013a
--- /dev/null
+++ b/kdump-dep-generator.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+. /usr/lib/kdump/kdump-lib.sh
+
+systemd_dir=/usr/lib/systemd/system
+generator_dir=/run/systemd/generator
+kdump_wants=$generator_dir/kdump.service.wants
+
+if is_ssh_dump_target; then
+ mkdir -p $kdump_wants
+ ln -sf $systemd_dir/network-online.target $kdump_wants/
+fi
diff --git a/kexec-tools.spec b/kexec-tools.spec
index cfe14c4..e6ffade 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -26,6 +26,7 @@ Source18: kdump.sysconfig.s390x
Source19: eppic_030413.tar.gz
Source20: kdump-lib.sh
Source21: kdump-in-cluster-environment.txt
+Source22: kdump-dep-generator.sh
#######################################
# These are sources for mkdumpramfs
@@ -181,6 +182,7 @@ install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/98-kexec.r
%endif
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
+install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
mkdir -p $RPM_BUILD_ROOT/usr/sbin
install -m 755 %{SOURCE17} $RPM_BUILD_ROOT/usr/sbin/rhcrashkernel-param
@@ -320,6 +322,7 @@ done
%{_mandir}/man8/*
%{_mandir}/man5/*
%{_unitdir}/kdump.service
+%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
%doc News
%doc COPYING
%doc TODO
--
1.8.5.3
10 years
[PATCH 1/7] Rename FENCE_KDUMP_CONFIG to FENCE_KDUMP_CONFIG_FILE
by mperina@redhat.com
Renames FENCE_KDUMP_CONFIG variable to FENCE_KDUMP_CONFIG_FILE to
distinguish it from values read from fence_kdump_args option in
kdump.conf (introduced in following patches).
Bug-Url: https://bugzilla.redhat.com/1078134
Signed-off-by: Martin Perina <mperina(a)redhat.com>
---
dracut-kdump.sh | 4 ++--
dracut-module-setup.sh | 2 +-
kdump-lib.sh | 2 +-
kdumpctl | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index d9e65ac..06e41bc 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -292,8 +292,8 @@ fence_kdump_notify()
local nodes
if [ -f $FENCE_KDUMP_NODES ]; then
- if [ -f $FENCE_KDUMP_CONFIG ]; then
- . $FENCE_KDUMP_CONFIG
+ if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
+ . $FENCE_KDUMP_CONFIG_FILE
fi
read nodes < $FENCE_KDUMP_NODES
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..cd60cf1 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -444,7 +444,7 @@ kdump_check_fence_kdump () {
echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES
dracut_install $FENCE_KDUMP_SEND
- dracut_install -o $FENCE_KDUMP_CONFIG
+ dracut_install -o $FENCE_KDUMP_CONFIG_FILE
}
# Install a random seed used to feed /dev/urandom
diff --git a/kdump-lib.sh b/kdump-lib.sh
index de32650..d72e16b 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -3,7 +3,7 @@
# Kdump common variables and functions
#
-FENCE_KDUMP_CONFIG="/etc/sysconfig/fence_kdump"
+FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FENCE_KDUMP_NODES="/etc/fence_kdump_nodes"
diff --git a/kdumpctl b/kdumpctl
index 8d5498a..24fb988 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -249,8 +249,8 @@ function check_rebuild()
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS"
- if [ -f $FENCE_KDUMP_CONFIG ]; then
- files="$files $FENCE_KDUMP_CONFIG"
+ if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
+ files="$files $FENCE_KDUMP_CONFIG_FILE"
fi
check_exist "$files" && check_executable "$EXTRA_BINS"
--
1.8.3.1
10 years
[PATCH 6/7] Add get_option_value()
by mperina@redhat.com
Adds get_option_value() function to retrieve value of specified option
from /etc/kdump.conf.
Bug-Url: https://bugzilla.redhat.com/1078134
Signed-off-by: Martin Perina <mperina(a)redhat.com>
---
kdump-lib.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 7103ba9..abf2eb3 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -75,3 +75,9 @@ get_root_fs_device()
return
}
+# get_option_value <option_name>
+# retrieves value of option defined in kdump.conf
+get_option_value() {
+ echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
+}
+
--
1.8.3.1
10 years
[PATCH 1/6] fence_kdump for generic clusters v4: Rename FENCE_KDUMP_CONFIG to FENCE_KDUMP_CONFIG_FILE
by mperina@redhat.com
Renames FENCE_KDUMP_CONFIG variable to FENCE_KDUMP_CONFIG_FILE to
distinguish it from values read from fence_kdump_args option in
kdump.conf (introduced in following patches).
Bug-Url: https://bugzilla.redhat.com/1078134
Signed-off-by: Martin Perina <mperina(a)redhat.com>
---
dracut-kdump.sh | 4 ++--
dracut-module-setup.sh | 2 +-
kdump-lib.sh | 2 +-
kdumpctl | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index d9e65ac..06e41bc 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -292,8 +292,8 @@ fence_kdump_notify()
local nodes
if [ -f $FENCE_KDUMP_NODES ]; then
- if [ -f $FENCE_KDUMP_CONFIG ]; then
- . $FENCE_KDUMP_CONFIG
+ if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
+ . $FENCE_KDUMP_CONFIG_FILE
fi
read nodes < $FENCE_KDUMP_NODES
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..cd60cf1 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -444,7 +444,7 @@ kdump_check_fence_kdump () {
echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES
dracut_install $FENCE_KDUMP_SEND
- dracut_install -o $FENCE_KDUMP_CONFIG
+ dracut_install -o $FENCE_KDUMP_CONFIG_FILE
}
# Install a random seed used to feed /dev/urandom
diff --git a/kdump-lib.sh b/kdump-lib.sh
index de32650..d72e16b 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -3,7 +3,7 @@
# Kdump common variables and functions
#
-FENCE_KDUMP_CONFIG="/etc/sysconfig/fence_kdump"
+FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FENCE_KDUMP_NODES="/etc/fence_kdump_nodes"
diff --git a/kdumpctl b/kdumpctl
index 8d5498a..24fb988 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -249,8 +249,8 @@ function check_rebuild()
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS"
- if [ -f $FENCE_KDUMP_CONFIG ]; then
- files="$files $FENCE_KDUMP_CONFIG"
+ if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
+ files="$files $FENCE_KDUMP_CONFIG_FILE"
fi
check_exist "$files" && check_executable "$EXTRA_BINS"
--
1.8.3.1
10 years
[PATCH] README: Add a README file
by Vivek Goyal
Add a README file which explains what's the process for kexec-tools patch
inclusion and where one should post patches for review. This should help
with removing some confusion.
Signed-off-by: Vivek Goyal <vgoyal(a)redhat.com>
---
README | 12 ++++++++++++
1 file changed, 12 insertions(+)
Index: kexec-tools-fedora/README
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-fedora/README 2014-03-27 14:44:38.210938613 -0400
@@ -0,0 +1,12 @@
+Adding a patch to kexec-tools
+=============================
+There is a mailing list kexec(a)lists.fedoraproject.org where all the dicussion
+related to fedora kexec-tools happen. All the patches are posted there for
+inclusion and committed to kexec-tools after review.
+
+So if you want your patches to be included in fedora kexec-tools package,
+post these to kexec(a)lists.fedoraproject.org.
+
+One can subscribe to list and browse through archives here.
+
+https://admin.fedoraproject.org/mailman/listinfo/kexec
10 years
[PATCH 1/6] fence_kdump for generic clusters v3: Rename FENCE_KDUMP_CONFIG to FENCE_KDUMP_CONFIG_FILE
by mperina@redhat.com
Bug-Url: https://bugzilla.redhat.com/1079821
Signed-off-by: Martin Perina <mperina(a)redhat.com>
---
dracut-kdump.sh | 4 ++--
dracut-module-setup.sh | 2 +-
kdump-lib.sh | 2 +-
kdumpctl | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index d9e65ac..06e41bc 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -292,8 +292,8 @@ fence_kdump_notify()
local nodes
if [ -f $FENCE_KDUMP_NODES ]; then
- if [ -f $FENCE_KDUMP_CONFIG ]; then
- . $FENCE_KDUMP_CONFIG
+ if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
+ . $FENCE_KDUMP_CONFIG_FILE
fi
read nodes < $FENCE_KDUMP_NODES
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..cd60cf1 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -444,7 +444,7 @@ kdump_check_fence_kdump () {
echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES
dracut_install $FENCE_KDUMP_SEND
- dracut_install -o $FENCE_KDUMP_CONFIG
+ dracut_install -o $FENCE_KDUMP_CONFIG_FILE
}
# Install a random seed used to feed /dev/urandom
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 384f7b4..db0615f 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -3,7 +3,7 @@
# Kdump common variables and functions
#
-FENCE_KDUMP_CONFIG="/etc/sysconfig/fence_kdump"
+FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FENCE_KDUMP_NODES="/etc/fence_kdump_nodes"
diff --git a/kdumpctl b/kdumpctl
index 8d5498a..24fb988 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -249,8 +249,8 @@ function check_rebuild()
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS"
- if [ -f $FENCE_KDUMP_CONFIG ]; then
- files="$files $FENCE_KDUMP_CONFIG"
+ if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
+ files="$files $FENCE_KDUMP_CONFIG_FILE"
fi
check_exist "$files" && check_executable "$EXTRA_BINS"
--
1.8.3.1
10 years