Patch in attachment was filtered so I resent it inline:
----- Original Message -----
From: "Martin Perina" <mperina(a)redhat.com>
To: kexec(a)lists.fedoraproject.org
Sent: Thursday, March 13, 2014 7:47:08 AM
Subject: Adding support for manually configured fence_kdump
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
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec
diff -rupN a/dracut-module-setup.sh b/dracut-module-setup.sh
--- a/dracut-module-setup.sh 2014-02-17 06:50:46.000000000 +0100
+++ b/dracut-module-setup.sh 2014-03-12 08:38:03.000000000 +0100
@@ -423,26 +423,38 @@ kdump_check_fence_kdump () {
local nodes
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
- # Skip its own node name
- if [ "$nodename" = `hostname` ]; then
- continue
- fi
- nodes="$nodes $nodename"
+ # 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
+ # Skip its own node name
+ if [ "$nodename" = `hostname` ]; then
+ continue
+ fi
+ nodes="$nodes $nodename"
+ done
+ else
+ # fence_kdump configured manually
+ read nodes < $FENCE_KDUMP_NODES
+ fi
- kdump_install_net $nodename
+ # install network for each node
+ for node in ${nodes}; do
+ kdump_install_net $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 -rupN a/kdumpctl b/kdumpctl
--- a/kdumpctl 2014-02-17 06:50:46.000000000 +0100
+++ b/kdumpctl 2014-03-12 10:36:26.829734090 +0100
@@ -133,7 +133,8 @@ function check_config()
}
# check_fence_kdump <image timestamp>
-# return 0 if fence_kdump is configured and kdump initrd needs to be rebuilt
+# return 0 if fence_kdump is configured in cluster and kdump initrd needs
+# to be rebuilt
function check_fence_kdump()
{
local image_time=$1
@@ -141,6 +142,8 @@ function check_fence_kdump()
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`
@@ -199,6 +202,10 @@ function check_rebuild()
if [ -f $FENCE_KDUMP_CONFIG ]; then
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
diff -rupN a/kdump-lib.sh b/kdump-lib.sh
--- a/kdump-lib.sh 2014-02-17 06:50:46.000000000 +0100
+++ b/kdump-lib.sh 2014-03-12 10:38:29.108892093 +0100
@@ -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,13 +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
+ # no fence_kdump_send executables installed?
[ -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_CONFIG ] || return 1
+ [ -f $FENCE_KDUMP_NODES ] || return 1
+ fi
}