[PATCH] mkdumprd fail if target is NFS and mounted on /var/crash
by Baoquan He
Now when dump target is not specified, separate disk can't be mounted on
"path", e.g /var/crash. However if target is specified, whatever the default
fail action is set, mkdumprd should go ahead and not be failed.
In check_block_dump_target(), the check only on disk is not complete,
NFS and ssh need be filtered too. So introduce is_user_configured_dump_target
to check this.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kdump-lib.sh | 14 ++++++++++++++
mkdumprd | 3 +--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 384f7b4..de32650 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -52,6 +52,20 @@ get_user_configured_dump_disk()
return
}
+is_user_configured_dump_target()
+{
+ local _target
+
+ if is_ssh_dump_target || is_nfs_dump_target; then
+ return 0
+ fi
+
+ _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}')
+ [ -n "$_target" ] && return 0
+
+ return 1
+}
+
get_root_fs_device()
{
local _target
diff --git a/mkdumprd b/mkdumprd
index bb1e01e..84f1e18 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -363,8 +363,7 @@ check_block_dump_target()
local _target
local _mntpoint
- _target=$(get_user_configured_dump_disk)
- [ -n "$_target" ] && return
+ is_user_configured_dump_target && return
_target=$(get_root_fs_device)
if [ -b "$_target" ]; then
--
1.8.5.3
10 years
[PATCH 1/5] fence_kdump configuration should be in one directory
by mperina@redhat.com
fence_kdump configuration and list of nodes should be in the same
directory:
/etc/sysconfig/fence_kdump
/etc/sysconfig/fence_kdump_nodes
Signed-off-by: Martin Perina <mperina(a)redhat.com>
---
dracut-module-setup.sh | 5 +++--
kdump-lib.sh | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..eae7cc4 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -418,7 +418,7 @@ kdump_check_iscsi_targets () {
# setup fence_kdump in cluster
# setup proper network and install needed files
-# also preserve '[node list]' for 2nd kernel /etc/fence_kdump_nodes
+# also preserve '[node list]' for 2nd kerneli in $FENCE_KDUMP_NODES
kdump_check_fence_kdump () {
local nodes
is_fence_kdump || return 1
@@ -442,7 +442,8 @@ kdump_check_fence_kdump () {
done
echo
- echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES
+ mkdir -p ${initdir}$FENCE_KDUMP_CFG_DIR
+ echo "$nodes" > ${initdir}$FENCE_KDUMP_NODES
dracut_install $FENCE_KDUMP_SEND
dracut_install -o $FENCE_KDUMP_CONFIG
}
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 384f7b4..cdffe35 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -3,9 +3,10 @@
# Kdump common variables and functions
#
-FENCE_KDUMP_CONFIG="/etc/sysconfig/fence_kdump"
+FENCE_KDUMP_CFG_DIR="/etc/sysconfig"
+FENCE_KDUMP_CONFIG="$FENCE_KDUMP_CFG_DIR/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
-FENCE_KDUMP_NODES="/etc/fence_kdump_nodes"
+FENCE_KDUMP_NODES="$FENCE_KDUMP_CFG_DIR/fence_kdump_nodes"
is_ssh_dump_target()
{
--
1.8.3.1
10 years
[Patch v3 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>
---
kdump-lib.sh | 21 +++++++++++++++++++++
mkdumprd | 2 +-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 384f7b4..fdcde83 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"
@@ -61,3 +62,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 bb1e01e..0295009 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
[Patch v2 1/4] user need make sure "path" on mounted fs has been created
by Baoquan He
kdump need create the dir specified in "path" formerly if it does not
exist. Now change the behavior to be that ueser takes charge of the
"path", make sure "path" has been created, especially when separate disk
is mounted on this "path".
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
mkdumprd | 38 ++++++++------------------------------
1 file changed, 8 insertions(+), 30 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index bb1e01e..93fc7fe 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -174,34 +174,13 @@ mkdir_save_path_ssh()
}
-#mkdir if save path does not exist on dump target filesystem
-#$1=dump target
-#caller should ensure $1 is mounted
-mkdir_save_path_fs() {
+#check whether $SAVE_PATH has been created.
+check_save_path_fs() {
local _mnt=$(to_mount_point $1)
- local _remount="no"
- local _ret
-
- [ ! -d ${_mnt}/$SAVE_PATH ] && {
- if is_readonly_mount $1; then
- echo "Mounting $1 as read-write for creating dump directory.."
- mount -o remount,rw $1 || {
- perror_exit "Mounting $1 as read-write failed."
- }
- _remount="yes"
- fi
- mkdir -p ${_mnt}/$SAVE_PATH
- _ret=$?
- [ "$_remount" = "yes" ] && {
- echo "Remounting $1 as read-only."
- mount -o remount,ro $1 || {
- perror_exit "Remounting $1 as read-only failed."
- }
- }
- [ $_ret -ne 0 ] && {
- perror_exit "Creating ${_mnt}/$SAVE_PATH failed."
- }
- }
+
+ if [ ! -d ${_mnt}/$SAVE_PATH ]; then
+ perror_exit "Please check if path:$SAVE_PATH has been created."
+ fi
}
#Function: get_fs_size
@@ -347,7 +326,6 @@ get_block_dump_target()
{
local _target
-
_target=$(get_user_configured_dump_disk)
[ -n "$_target" ] && echo $(to_dev_name $_target) && return
@@ -539,7 +517,7 @@ do
add_dracut_module "nfs"
fi
add_mount "$config_val"
- mkdir_save_path_fs $config_val
+ check_save_path_fs $config_val
check_size fs $config_val
;;
raw)
@@ -560,7 +538,7 @@ do
check_size ssh $config_val
mkdir_save_path_ssh $config_val
add_dracut_module "ssh-client"
- add_dracut_sshkey "$SSH_KEY_LOCATION"
+ add_dracut_sshkey "$SSH_KEY_LOCATION"
else
perror_exit "Bad ssh dump target $config_val"
fi
--
1.8.5.3
10 years
[PATCH 1/5] fence_kdump configuration should be in one directory
by mperina@redhat.com
fence_kdump configuration and list of nodes should be in the same
directory:
/etc/fence_kdump
/etc/fence_kdump_nodes
Bug-Url: https://bugzilla.redhat.com/1078134
Signed-off-by: Martin Perina <mperina(a)redhat.com>
---
dracut-module-setup.sh | 5 +++--
kdump-lib.sh | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..2777c75 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -418,7 +418,7 @@ kdump_check_iscsi_targets () {
# setup fence_kdump in cluster
# setup proper network and install needed files
-# also preserve '[node list]' for 2nd kernel /etc/fence_kdump_nodes
+# also preserve '[node list]' for 2nd kernel in $FENCE_KDUMP_NODES
kdump_check_fence_kdump () {
local nodes
is_fence_kdump || return 1
@@ -442,7 +442,8 @@ kdump_check_fence_kdump () {
done
echo
- echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES
+ mkdir -p ${initdir}$FENCE_KDUMP_CFG_DIR
+ echo "$nodes" > ${initdir}$FENCE_KDUMP_NODES
dracut_install $FENCE_KDUMP_SEND
dracut_install -o $FENCE_KDUMP_CONFIG
}
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 384f7b4..19389a6 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -3,9 +3,10 @@
# Kdump common variables and functions
#
-FENCE_KDUMP_CONFIG="/etc/sysconfig/fence_kdump"
+FENCE_KDUMP_CFG_DIR="/etc"
+FENCE_KDUMP_CONFIG="$FENCE_KDUMP_CFG_DIR/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
-FENCE_KDUMP_NODES="/etc/fence_kdump_nodes"
+FENCE_KDUMP_NODES="$FENCE_KDUMP_CFG_DIR/fence_kdump_nodes"
is_ssh_dump_target()
{
--
1.8.3.1
10 years
Adding support for manually configured fence_kdump v2
by mperina@redhat.com
Hi,
I changed this from initial patch:
1) /etc/sysconfig/fence_kdump is optional, only following two files are
mandatory:
/usr/libexec/fence_kdump_send
/etc/sysconfig/fence_kdump_nodes
2) Nodes read from /etc/sysconfig/fence_kdump_nodes are filtered not to
contain hostname
3) Patch is created against master on
http://pkgs.fedoraproject.org/cgit/kexec-tools.git/
Thanks
Martin Perina
>From 48f09ed8cda2c1fe52b0a48eb501373cd40d6b8f Mon Sep 17 00:00:00 2001
From: Martin Perina <mperina(a)redhat.com>
Date: Thu, 13 Mar 2014 14:59:08 +0100
Subject: [PATCH] fence_kdump manual configuration support
Adds ability to configure fence_kdump without Pacemaker. If following
files exist:
/usr/libexec/fence_kdump_send
/etc/sysconfig/fence_kdump_nodes
it's supposed that fence_kdump is configured manually.
Signed-off-by: Martin Perina <mperina(a)redhat.com>
---
dracut-module-setup.sh | 37 +++++++++++++++++++++++++------------
kdump-lib.sh | 20 +++++++++++++++-----
kdumpctl | 5 +++++
3 files changed, 45 insertions(+), 17 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..103a84e 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -421,28 +421,41 @@ kdump_check_iscsi_targets () {
# also preserve '[node list]' for 2nd kernel /etc/fence_kdump_nodes
kdump_check_fence_kdump () {
local nodes
+ local xnodes
is_fence_kdump || return 1
- # get cluster nodes from cluster cib, get interface and ip address
- nodelist=`pcs cluster cib | xmllint --xpath "/cib/status/node_state/@uname" -`
+ if is_cluster; then
+ # get cluster nodes from cluster cib, get interface and ip address
+ nodelist=`pcs cluster cib | xmllint --xpath "/cib/status/node_state/@uname" -`
- # nodelist is formed as 'uname="node1" uname="node2" ... uname="nodeX"'
- # we need to convert each to node1, node2 ... nodeX in each iteration
- for node in ${nodelist}; do
- # convert $node from 'uname="nodeX"' to 'nodeX'
- eval $node
- nodename=$uname
+ # nodelist is formed as 'uname="node1" uname="node2" ... uname="nodeX"'
+ # we need to convert each to node1, node2 ... nodeX in each iteration
+ for node in ${nodelist}; do
+ # convert $node from 'uname="nodeX"' to 'nodeX'
+ eval $node
+ xnodes="$xnodes $uname"
+ done
+ else
+ # fence_kdump configured manually
+ read xnodes < $FENCE_KDUMP_NODES
+ fi
+
+ # install network for each node
+ for node in ${xnodes}; do
# Skip its own node name
if [ "$nodename" = `hostname` ]; then
continue
fi
- nodes="$nodes $nodename"
-
- kdump_install_net $nodename
+ kdump_install_net $node
+ nodes="$nodes $node"
done
+
echo
- echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES
+ mkdir -p ${initdir}$FENCE_KDUMP_NODES
+ rmdir ${initdir}$FENCE_KDUMP_NODES
+ echo "$nodes" > ${initdir}$FENCE_KDUMP_NODES
+
dracut_install $FENCE_KDUMP_SEND
dracut_install -o $FENCE_KDUMP_CONFIG
}
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 384f7b4..089d40b 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -5,7 +5,7 @@
FENCE_KDUMP_CONFIG="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
-FENCE_KDUMP_NODES="/etc/fence_kdump_nodes"
+FENCE_KDUMP_NODES="/etc/sysconfig/fence_kdump_nodes"
is_ssh_dump_target()
{
@@ -27,15 +27,25 @@ strip_comments()
echo $@ | sed -e 's/\(.*\)#.*/\1/'
}
+# Check if cluster environment is present
+is_cluster()
+{
+ # no pcs executable installed
+ type -P pcs > /dev/null || return 1
+}
+
# Check if fence kdump is configured in cluster
is_fence_kdump()
{
- # no pcs or fence_kdump_send executables installed?
- type -P pcs > /dev/null || return 1
[ -x $FENCE_KDUMP_SEND ] || return 1
- # fence kdump not configured?
- (pcs cluster cib | grep -q 'type="fence_kdump"') &> /dev/null || return 1
+ if is_cluster; then
+ # fence kdump configured in cluster?
+ (pcs cluster cib | grep -q 'type="fence_kdump"') &> /dev/null || return 1
+ else
+ # fence kdump configured manually?
+ [ -f $FENCE_KDUMP_NODES ] || return 1
+ fi
}
get_user_configured_dump_disk()
diff --git a/kdumpctl b/kdumpctl
index 8d5498a..c310904 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -193,6 +193,7 @@ function check_fence_kdump()
local cib_time
is_fence_kdump || return 1
+ is_cluster || return 1
cib_time=`pcs cluster cib | xmllint --xpath 'string(/cib/@cib-last-written)' - | \
xargs -0 date +%s --date`
@@ -253,6 +254,10 @@ function check_rebuild()
files="$files $FENCE_KDUMP_CONFIG"
fi
+ if [ -f $FENCE_KDUMP_NODES ]; then
+ files="$files $FENCE_KDUMP_NODES"
+ fi
+
check_exist "$files" && check_executable "$EXTRA_BINS"
[ $? -ne 0 ] && return 1
--
1.8.3.1
10 years
[PATCH v2] Add a link in kexec-kdump-howto.txt to explain how to configure kdump in cluster
by Arthur Zou
Description:
There is no info in kexec-kdump-howto.txt which explains how to
configure kdump in clustered environment to avoid being fenced off
while saving core.
Resolution:
add a help link in kexec-kdump-howto.txt so that somebody can get to
article easily.
Signed-off-by: Arthur Zou <zzou(a)redhat.com>
---
kexec-kdump-howto.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 7ffeab9..8b6212e 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -98,6 +98,10 @@ parameter, which is expected. You may be able to get by with less than 128M, but
testing with only 64M has proven unreliable of late. On ia64, as much as 512M
may be required.
+If using kdump in cluster environment, please refer to kdump-in-cluster-
+environment.txt or https://access.redhat.com/site/articles/67570 to get more
+information to avoid being fenced off while saving core.
+
Now that you've got that reserved memory region set up, you want to turn on
the kdump init script:
--
1.8.4.2
10 years
[PATCH v2] kdumpctl: Pass disable_cpu_apicid to kexec of capture kernel
by Jerry Hoemann
== Version 2 ==
Addresses Vivek's review comments:
1. Don't force numeric in awk script snipet.
2. Command line processing is moved from load_kernel to new function
"prepare_cmdline." This new function is responsible for
setting up the command line passed to KEXEC.
3. New function "append_cmdline" is added to append {argument,value}
pair to command line if argument is not already present.
== Version 1 ==
A recent patch (https://lkml.org/lkml/2014/1/15/42) enables multiple
processors in the crash kernel.
To do this safely the crash kernel needs to know which CPU was the 1st
kernel BSP (bootstrap processor) so that the crash kernel will NOT send
the BSP an INIT. If the crash kernel sends an INIT to the 1st kernel
BSP, some systems may reset or hang.
The EFI spec doesn't require that any particular processor is chosen
as the BSP and the CPU (and its apic id) can change from one boot to
the next. Hence automating the selection of CPU to disable if the
system would panic is desired.
This patch updates the kdumpctl script to get the "initial apicid"
of CPU 0 in the first kernel and will pass this as the
"disable_cpu_apicid=" arguement to kexec if it wasn't explicitly
set in /etc/sysconfig/kdump KDUMP_COMMANDLINE_APPEND.
CPU 0 is chosen as it is the processor thats execute the OS
initialization
code and hence was the BSP as per x86 SDM (Vol 3a Section 8.4.)
See associated Red Hat Bugzilla(s) for additional background material:
https://bugzilla.redhat.com/show_bug.cgi?id=1059031
https://bugzilla.redhat.com/show_bug.cgi?id=980621
---
kdumpctl | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 54 insertions(+), 7 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 46ae633..0a0bab1 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -41,6 +41,59 @@ function remove_cmdline_param()
echo $cmdline
}
+#
+# This function returns the "initial apicid" of the
+# boot cpu (cpu 0) if present.
+#
+function get_bootcpu_initial_apicid()
+{
+ awk ' \
+ BEGIN { CPU = "-1"; } \
+ $1=="processor" && $2==":" { CPU = $NF; } \
+ CPU=="0" && /initial apicid/ { print $NF; } \
+ ' \
+ /proc/cpuinfo
+}
+
+#
+# This function appends argument "$2=$3" to string ($1) if not already present.
+#
+function append_cmdline()
+{
+ local cmdline=$1
+ local newstr=${cmdline/$2/""}
+
+ # unchanged str implies argument wasn't there
+ if [ "$cmdline" == "$newstr" ]; then
+ cmdline="${cmdline} ${2}=${3}"
+ fi
+
+ echo $cmdline
+}
+
+# This function performs a series of edits on the command line
+function prepare_cmdline()
+{
+ local cmdline;
+ if [ -z "$KDUMP_COMMANDLINE" ]; then
+ cmdline=`cat /proc/cmdline`
+ else
+ cmdline=${KDUMP_COMMANDLINE}
+ fi
+ cmdline=`remove_cmdline_param "$cmdline" crashkernel hugepages hugepagesz`
+
+
+ cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
+
+ local id=`get_bootcpu_initial_apicid`
+ if [ ! -z ${id} ] ; then
+ cmdline=`append_cmdline "${cmdline}" disable_cpu_apicid ${id}`
+ fi
+
+ echo $cmdline
+}
+
+
function save_core()
{
coredir="/var/crash/`date +"%Y-%m-%d-%H:%M"`"
@@ -244,13 +297,7 @@ function load_kdump()
fi
fi
- if [ -z "$KDUMP_COMMANDLINE" ]
- then
- KDUMP_COMMANDLINE=`cat /proc/cmdline`
- fi
- KDUMP_COMMANDLINE=`remove_cmdline_param "$KDUMP_COMMANDLINE" crashkernel hugepages hugepagesz`
-
- KDUMP_COMMANDLINE="${KDUMP_COMMANDLINE} ${KDUMP_COMMANDLINE_APPEND}"
+ KDUMP_COMMANDLINE=`prepare_cmdline`
$KEXEC $KEXEC_ARGS $standard_kexec_args \
--command-line="$KDUMP_COMMANDLINE" \
--
1.8.5.3
10 years
Adding support for manually configured fence_kdump
by mperina@redhat.com
Hi,
we want to integrate support for fence_kdump into oVirt project. Marek Grac pointed me
to kexec-tools-2.0.4-23 which contains automatic configuration of fence_kdump from Pacemaker config.
Unfortunately for us, this support is tightly bound to Pacemaker, so I created attached patch,
which adds support for manual configuration of fence_kdump:
1) Current status without this patch (kexec-tools-2.0.4-23)
- when running 'kdumpctl restart' kdump detects if fence_kdump_send command is installed
and if so, it tries to:
a) Create /etc/sysconfig/fence_kdump file with command line parameters for fence_kdump_send.
These parameters are extracted from cluster configuration using 'pcs cluster' command
b) Create /etc/fence_kdump_nodes file with list of hosts to send fence_kdump notification to.
These hosts are also extracted from cluster configuration using 'pcs cluster' command
c) If these two files are successfully created, kdump tries to configure network to be able
to reach all hosts defined in /etc/fence_kdump_nodes
d) Install these two config files into kdump's kernel initramfs
2) Behavior with this patch
- when running 'kdumpctl restart' kdump detect if fence_kdump_send binary is installed
and if so, it tries to:
a) It tries to detect is cluster is configured ('pcs' command is available). If so, it creates
needed config files as described above in steps 1a) and 1b)
b) If cluster is not configured, it tries to detect if /etc/sysconfig/fence_kdump and
/etc/sysconfig/fence_kdump_nodes exist. If so, fence_kdump is marked as successfully
configured and kdump continues with steps 1c) and 1d)
Is it possible to integrate such patch into kexec-tools RPM?
We would like to integrate fence_kdump support into oVirt 3.5 which should be released in May,
so before this to happen, we need kexec-tools RPM with this patch to be available for RHEL 6 and
Fedora 19/20.
Thanks
Martin Perina
10 years
[PATCH 1/2] pass mount info to dracut when default target is a separate disk
by Baoquan He
When user does not specify dump target explicitly, it's better to
dump to the "path" specified. That means after dump user enter into
1st kernel, can find vmcore in the "path". If that path is in root
fs, vmcore is stored in root fs. If separate disk is mounted on
any tier of "path", we just dump vmcore into the left path on the
left separate disk.
E.g in kdump.conf
path /mnt/nfs
in mount info,
/dev/vdb on /mnt type ext4 (rw,relatime,seclabel,data=ordered)
Then vmcore will be saved in /nfs of /dev/vdb.
In this patch, pass mount info to dracut in this case if separate
disk is mounted on any tier of "path".
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
mkdumprd | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index 241a426..d792b42 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -355,12 +355,12 @@ get_block_dump_target()
[ -b "$_target" ] && echo $(to_dev_name $_target)
}
-# If no dump disk is specified make sure /var/crash is not mounted on a
-# separate disk.
-check_block_dump_target()
+#handle the case user does not specify the dump target explicitly
+handle_default_dump_target()
{
local _target
local _mntpoint
+ local _ret
_target=$(get_user_configured_dump_disk)
[ -n "$_target" ] && return
@@ -368,11 +368,16 @@ check_block_dump_target()
_target=$(get_root_fs_device)
if [ -b "$_target" ]; then
mkdir -p $SAVE_PATH
- _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ perror_exit "mkdir failed on $SAVE_PATH"
+ fi
+ _mntpoint=$(df $SAVE_PATH | tail -1 | awk '{print $NF}')
if [ "$_mntpoint" != "/" ]; then
- perror "No dump target specified. Default dump target is rootfs block device."
- perror "But dump path $SAVE_PATH is not backed by rootfs block device. "
- perror_exit "Either explicitly specify a dump target or specify a dump path backed by rootfs block device"
+ SAVE_PATH=$(echo $SAVE_PATH | sed "s,$_mntpoint,,")
+ _target=$(findmnt -k -f -n -o SOURCE $_mntpoint)
+ add_mount "$_target"
+ check_size fs $_target
fi
fi
}
@@ -500,8 +505,6 @@ check_crypt()
return 1
}
-check_block_dump_target
-
if ! check_resettable; then
exit 1
fi
@@ -521,6 +524,8 @@ if [ "$(uname -m)" = "s390x" ]; then
add_dracut_module "znet"
fi
+handle_default_dump_target
+
while read config_opt config_val;
do
# remove inline comments after the end of a directive.
--
1.8.5.3
10 years