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@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"
Renames FENCE_KDUMP_NODES variable to FENCE_KDUMP_NODES_FILE to distinguish it from values read from fence_kdump_nodes option in kdump.conf (introduced in following patches).
Bug-Url: https://bugzilla.redhat.com/1078134 Signed-off-by: Martin Perina mperina@redhat.com --- dracut-kdump.sh | 4 ++-- dracut-module-setup.sh | 2 +- kdump-lib.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 06e41bc..4bac088 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -291,12 +291,12 @@ fence_kdump_notify() { local nodes
- if [ -f $FENCE_KDUMP_NODES ]; then + if [ -f $FENCE_KDUMP_NODES_FILE ]; then if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then . $FENCE_KDUMP_CONFIG_FILE fi
- read nodes < $FENCE_KDUMP_NODES + read nodes < $FENCE_KDUMP_NODES_FILE $FENCE_KDUMP_SEND $FENCE_KDUMP_OPTS $nodes & fi } diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index cd60cf1..0ce3885 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -442,7 +442,7 @@ kdump_check_fence_kdump () { done echo
- echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES + echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES_FILE dracut_install $FENCE_KDUMP_SEND dracut_install -o $FENCE_KDUMP_CONFIG_FILE } diff --git a/kdump-lib.sh b/kdump-lib.sh index d72e16b..8de86b6 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -5,7 +5,7 @@
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" -FENCE_KDUMP_NODES="/etc/fence_kdump_nodes" +FENCE_KDUMP_NODES_FILE="/etc/fence_kdump_nodes"
is_ssh_dump_target() {
Renames is_fence_kdump to is_pcs_fence_kdump to identify that this method should be used to detect fence_kdump configuration only in Pacemaker clusters.
Bug-Url: https://bugzilla.redhat.com/1078134 Signed-off-by: Martin Perina mperina@redhat.com --- dracut-module-setup.sh | 4 ++-- kdump-lib.sh | 4 ++-- kdumpctl | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 0ce3885..3df71b1 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -20,7 +20,7 @@ depends() { _dep="$_dep drm" fi
- if is_fence_kdump; then + if is_pcs_fence_kdump; then _dep="$_dep network" fi
@@ -421,7 +421,7 @@ kdump_check_iscsi_targets () { # also preserve '[node list]' for 2nd kernel /etc/fence_kdump_nodes kdump_check_fence_kdump () { local nodes - is_fence_kdump || return 1 + is_pcs_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" -` diff --git a/kdump-lib.sh b/kdump-lib.sh index 8de86b6..7103ba9 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -27,8 +27,8 @@ strip_comments() echo $@ | sed -e 's/(.*)#.*/\1/' }
-# Check if fence kdump is configured in cluster -is_fence_kdump() +# Check if fence kdump is configured in Pacemaker cluster +is_pcs_fence_kdump() { # no pcs or fence_kdump_send executables installed? type -P pcs > /dev/null || return 1 diff --git a/kdumpctl b/kdumpctl index 24fb988..eb6bdbc 100755 --- a/kdumpctl +++ b/kdumpctl @@ -192,7 +192,7 @@ function check_fence_kdump() local image_time=$1 local cib_time
- is_fence_kdump || return 1 + is_pcs_fence_kdump || return 1
cib_time=`pcs cluster cib | xmllint --xpath 'string(/cib/@cib-last-written)' - | \ xargs -0 date +%s --date`
Renames kdump_check_fence_kdump kdump_configure_fence_kdump to clearly identify what this function does.
Bug-Url: https://bugzilla.redhat.com/1078134 Signed-off-by: Martin Perina mperina@redhat.com --- dracut-module-setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 3df71b1..e64bc41 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -285,7 +285,7 @@ kdump_install_conf() { esac done < /etc/kdump.conf
- kdump_check_fence_kdump + kdump_configure_fence_kdump inst "/tmp/$$-kdump.conf" "/etc/kdump.conf" rm -f /tmp/$$-kdump.conf } @@ -419,7 +419,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 -kdump_check_fence_kdump () { +kdump_configure_fence_kdump () { local nodes is_pcs_fence_kdump || return 1
Renames check_fence_kdump to check_pcs_fence_kdump to clearly identify that this method checks only Pacemaker configuration of fence_kdump.
Bug-Url: https://bugzilla.redhat.com/1078134 Signed-off-by: Martin Perina mperina@redhat.com --- kdumpctl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kdumpctl b/kdumpctl index eb6bdbc..8aacf4e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -185,9 +185,9 @@ function check_config() return 0 }
-# check_fence_kdump <image timestamp> -# return 0 if fence_kdump is configured and kdump initrd needs to be rebuilt -function check_fence_kdump() +# check_pcs_fence_kdump <image timestamp> +# return 0 if fence_kdump is configured in Pacemaker cluster and kdump initrd needs to be rebuilt +function check_pcs_fence_kdump() { local image_time=$1 local cib_time @@ -239,8 +239,8 @@ function check_rebuild() image_time=0 fi
- #also rebuild when cluster conf is changed and fence kdump is enabled. - check_fence_kdump $image_time && modified_files="cluster-cib" + #also rebuild when Pacemaker cluster conf is changed and fence kdump is enabled. + check_pcs_fence_kdump $image_time && modified_files="cluster-cib"
EXTRA_BINS=`grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\ -f2` CHECK_FILES=`grep ^kdump_pre $KDUMP_CONFIG_FILE | cut -d\ -f2`
Adds two new options to kdump.conf to be able to configure fence_kdump support for generic clusters:
fence_kdump_args <arg(s)> - Command line arguments for fence_kdump_send (it can contain all valid arguments except hosts to send notification to)
fence_kdump_nodes <node(s)> - List of cluster node(s) separated by space to send fence_kdump notification to (this option is mandatory to enable fence_kdump)
Generic clusters fence_kdump configuration take precedence over older method of fence_kdump configuration for Pacemaker clusters. It means that if fence_kdump is configured using above options in kdump.conf, old Pacemaker configuration is not used even if it exists.
Bug-Url: https://bugzilla.redhat.com/1078134 Signed-off-by: Martin Perina mperina@redhat.com --- dracut-kdump.sh | 19 +++++++------ dracut-module-setup.sh | 58 ++++++++++++++++++++++++++++++++-------- kdump-in-cluster-environment.txt | 39 ++++++++++++++++++++++----- kdump-lib.sh | 9 ++++++- kdump.conf | 11 ++++++++ kdump.conf.5 | 15 +++++++++++ kdumpctl | 35 ++++++++++++++++++++++-- 7 files changed, 155 insertions(+), 31 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 4bac088..cb13d92 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -246,6 +246,12 @@ read_kdump_conf() kdump_post) KDUMP_POST="$config_val" ;; + fence_kdump_args) + FENCE_KDUMP_ARGS="$config_val" + ;; + fence_kdump_nodes) + FENCE_KDUMP_NODES="$config_val" + ;; default) case $config_val in shell) @@ -289,20 +295,13 @@ read_kdump_conf()
fence_kdump_notify() { - local nodes - - if [ -f $FENCE_KDUMP_NODES_FILE ]; then - if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then - . $FENCE_KDUMP_CONFIG_FILE - fi - - read nodes < $FENCE_KDUMP_NODES_FILE - $FENCE_KDUMP_SEND $FENCE_KDUMP_OPTS $nodes & + if [ -n "$FENCE_KDUMP_NODES" ]; then + $FENCE_KDUMP_SEND $FENCE_KDUMP_ARGS $FENCE_KDUMP_NODES & fi }
-fence_kdump_notify read_kdump_conf +fence_kdump_notify
if [ -z "$CORE_COLLECTOR" ];then CORE_COLLECTOR=$DEFAULT_CORE_COLLECTOR diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index e64bc41..5541fae 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -20,7 +20,7 @@ depends() { _dep="$_dep drm" fi
- if is_pcs_fence_kdump; then + if [ is_generic_fence_kdump -o is_pcs_fence_kdump ]; then _dep="$_dep network" fi
@@ -282,10 +282,13 @@ kdump_install_conf() { core_collector) dracut_install "${config_val%%[[:blank:]]*}" ;; + fence_kdump_nodes) + FENCE_KDUMP_NODES="$config_val" + ;; esac done < /etc/kdump.conf
- kdump_configure_fence_kdump + kdump_configure_fence_kdump "/tmp/$$-kdump.conf" inst "/tmp/$$-kdump.conf" "/etc/kdump.conf" rm -f /tmp/$$-kdump.conf } @@ -415,11 +418,8 @@ 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 -kdump_configure_fence_kdump () { +# retrieves fence_kdump nodes from Pacemaker cluster configuration +get_pcs_fence_kdump_nodes() { local nodes is_pcs_fence_kdump || return 1
@@ -437,14 +437,50 @@ kdump_configure_fence_kdump () { continue fi nodes="$nodes $nodename" + done + + echo $nodes +} + +# retrieves fence_kdump args from config file +get_pcs_fence_kdump_args() { + if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then + . $FENCE_KDUMP_CONFIG_FILE + echo $FENCE_KDUMP_OPTS + fi +} + +# setup fence_kdump in cluster +# setup proper network and install needed files +kdump_configure_fence_kdump () { + local kdump_cfg_file=$1 + + if is_generic_fence_kdump; then + # fence_kdump nodes already read from kdump.conf + : + + elif is_pcs_fence_kdump; then + FENCE_KDUMP_NODES=$(get_pcs_fence_kdump_nodes) + + # set appropriate options in kdump.conf + echo "fence_kdump_nodes $FENCE_KDUMP_NODES" >> ${kdump_cfg_file} + + FENCE_KDUMP_ARGS=$(get_pcs_fence_kdump_args) + if [ -n "$FENCE_KDUMP_ARGS" ]; then + echo "fence_kdump_args $FENCE_KDUMP_ARGS" >> ${kdump_cfg_file} + fi + + else + # fence_kdump not configured + return 1 + fi
- kdump_install_net $nodename + # setup network for each node + for node in ${FENCE_KDUMP_NODES}; do + kdump_install_net $node done - echo
- echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES_FILE dracut_install $FENCE_KDUMP_SEND - dracut_install -o $FENCE_KDUMP_CONFIG_FILE }
# Install a random seed used to feed /dev/urandom diff --git a/kdump-in-cluster-environment.txt b/kdump-in-cluster-environment.txt index c27a5d7..de1eb5e 100644 --- a/kdump-in-cluster-environment.txt +++ b/kdump-in-cluster-environment.txt @@ -34,11 +34,11 @@ recovery service, fence_kdump_send will periodically send messages to all cluster nodes. When the fence_kdump agent receives a valid message from the failed nodes, fencing is complete.
-How to configure cluster environment: +How to configure Pacemaker cluster environment:
-If we want to use kdump in cluster environment, fence-agents-kdump should be -installed in every nodes in the cluster. You can achieve this via the following -command: +If we want to use kdump in Pacemaker cluster environment, fence-agents-kdump +should be installed in every nodes in the cluster. You can achieve this via +the following command:
# yum install -y fence-agents-kdump
@@ -61,6 +61,31 @@ Then enable stonith
How to configure kdump:
-Actually there is nothing special in configuration between normal kdump and -cluster environment kdump. So please refer to Kexec-Kdump-howto file for more -information. +Actually there are two ways how to configure fence_kdump support: + +1) Pacemaker based clusters + If you have successfully configured fence_kdump in Pacemaker, there is + no need to add some special configuration in kdump. So please refer to + Kexec-Kdump-howto file for more information. + +2) Generic clusters + For other types of clusters there are two configuration options in + kdump.conf which enables fence_kdump support: + + fence_kdump_nodes <node(s)> + Contains list of cluster node(s) separated by space to send + fence_kdump notification to (this option is mandatory to enable + fence_kdump) + + fence_kdump_args <arg(s)> + Command line arguments for fence_kdump_send (it can contain + all valid arguments except hosts to send notification to) + + These options will most probably be configured by your cluster software, + so please refer to your cluster documentation how to enable fence_kdump + support. + +Please be aware that these two ways cannot be combined and 2) has precedence +over 1). It means that if fence_kdump is configured using fence_kdump_nodes +and fence_kdump_args options in kdump.conf, Pacemaker configuration is not +used even if it exists. diff --git a/kdump-lib.sh b/kdump-lib.sh index 7103ba9..659ead3 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -5,7 +5,6 @@
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" -FENCE_KDUMP_NODES_FILE="/etc/fence_kdump_nodes"
is_ssh_dump_target() { @@ -38,6 +37,14 @@ is_pcs_fence_kdump() (pcs cluster cib | grep -q 'type="fence_kdump"') &> /dev/null || return 1 }
+# Check if fence_kdump is configured using kdump options +is_generic_fence_kdump() +{ + [ -x $FENCE_KDUMP_SEND ] || return 1 + + grep -q "^fence_kdump_nodes" /etc/kdump.conf +} + get_user_configured_dump_disk() { local _target diff --git a/kdump.conf b/kdump.conf index a106462..08bbe2a 100644 --- a/kdump.conf +++ b/kdump.conf @@ -123,6 +123,15 @@ # dracut_args <arg(s)> # - Pass extra dracut options when rebuilding kdump # initrd. +# +# fence_kdump_args <arg(s)> +# - Command line arguments for fence_kdump_send (it can contain +# all valid arguments except hosts to send notification to). +# +# fence_kdump_nodes <node(s)> +# - List of cluster node(s) separated by space to send fence_kdump +# notification to (this option is mandatory to enable fence_kdump). +#
#raw /dev/vg/lv_kdump #ext4 /dev/vg/lv_kdump @@ -141,3 +150,5 @@ core_collector makedumpfile -l --message-level 1 -d 31 #default shell #force_rebuild 1 #dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" +#fence_kdump_args -p 7410 -f auto -c 0 -i 10 +#fence_kdump_nodes node1 node2 diff --git a/kdump.conf.5 b/kdump.conf.5 index 7eaf9dd..69628bd 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -177,6 +177,21 @@ Kdump uses dracut to generate initramfs for second kernel. This option allows a user to pass arguments to dracut directly. .RE
+ +.B fence_kdump_args <arg(s)> +.RS +Command line arguments for fence_kdump_send (it can contain all valid +arguments except hosts to send notification to). +.RE + + +.B fence_kdump_nodes <node(s)> +.RS +List of cluster node(s) separated by space to send fence_kdump notification +to (this option is mandatory to enable fence_kdump). +.RE + + .SH DEPRECATED OPTIONS
.B net <nfs mount>|user@server diff --git a/kdumpctl b/kdumpctl index 8aacf4e..7450ee2 100755 --- a/kdumpctl +++ b/kdumpctl @@ -166,7 +166,7 @@ function check_config() case "$config_opt" in #* | "") ;; - raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args) + raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes) [ -z "$config_val" ] && { echo "Invalid kdump config value for option $config_opt." return 1; @@ -249,7 +249,7 @@ function check_rebuild() EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS"
- if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then + if [ !is_generic_fence_kdump -a -f $FENCE_KDUMP_CONFIG_FILE ]; then files="$files $FENCE_KDUMP_CONFIG_FILE" fi
@@ -573,6 +573,31 @@ function check_kdump_feasibility() fi }
+function check_fence_kdump_config() +{ + local hostname=`hostname` + while read config_opt config_val; do + # remove inline comments after the end of a directive. + config_val=$(strip_comments $config_val) + case "$config_opt" in + fence_kdump_nodes) + FENCE_KDUMP_NODES="$config_val" + ;; + *) + ;; + esac + done < $KDUMP_CONFIG_FILE + + for node in $FENCE_KDUMP_NODES; do + if [ "$node" = "$hostname" ]; then + echo "Option fence_kdump_nodes cannot contain $hostname" + return 1 + fi + done + + return 0 +} + function start() { check_config @@ -609,6 +634,12 @@ function start() fi fi
+ check_fence_kdump_config + if [ $? -ne 0 ]; then + echo "Starting kdump: [FAILED]" + return 1 + fi + check_rebuild if [ $? != 0 ]; then echo "Starting kdump: [FAILED]"
On Tue, Apr 01, 2014 at 12:54:26PM +0200, Martin Perina wrote:
Adds two new options to kdump.conf to be able to configure fence_kdump support for generic clusters:
fence_kdump_args <arg(s)> - Command line arguments for fence_kdump_send (it can contain all valid arguments except hosts to send notification to)
fence_kdump_nodes <node(s)> - List of cluster node(s) separated by space to send fence_kdump notification to (this option is mandatory to enable fence_kdump)
Generic clusters fence_kdump configuration take precedence over older method of fence_kdump configuration for Pacemaker clusters. It means that if fence_kdump is configured using above options in kdump.conf, old Pacemaker configuration is not used even if it exists.
Bug-Url: https://bugzilla.redhat.com/1078134 Signed-off-by: Martin Perina mperina@redhat.com
Hi Martin,
This patch series is almost there. Some minor nits below.
[..]
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index e64bc41..5541fae 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -20,7 +20,7 @@ depends() { _dep="$_dep drm" fi
- if is_pcs_fence_kdump; then
- if [ is_generic_fence_kdump -o is_pcs_fence_kdump ]; then _dep="$_dep network" fi
@@ -282,10 +282,13 @@ kdump_install_conf() { core_collector) dracut_install "${config_val%%[[:blank:]]*}" ;;
fence_kdump_nodes)
FENCE_KDUMP_NODES="$config_val"
;;
I would rather like to avoid setting global varibales as much as possible. This install() function is called from dracut context. See more below.
[..]
+# setup fence_kdump in cluster +# setup proper network and install needed files +kdump_configure_fence_kdump () {
- local kdump_cfg_file=$1
- if is_generic_fence_kdump; then
# fence_kdump nodes already read from kdump.conf
:
- elif is_pcs_fence_kdump; then
FENCE_KDUMP_NODES=$(get_pcs_fence_kdump_nodes)
Same here. We can define a "local fence_nodes" and use that in this function instead of trying to set list of nodes in global context.
Also we could define a generic function to get list of cluster nodes.
get_list_of_cluster_nodes() { if generic_clsuter return generic cluster nodes else return pcs_cluster_nodes }
fence_nodes=$(get_list_of_cluster_nodes)
# set appropriate options in kdump.conf
echo "fence_kdump_nodes $FENCE_KDUMP_NODES" >> ${kdump_cfg_file}
FENCE_KDUMP_ARGS=$(get_pcs_fence_kdump_args)
if [ -n "$FENCE_KDUMP_ARGS" ]; then
echo "fence_kdump_args $FENCE_KDUMP_ARGS" >> ${kdump_cfg_file}
KEEP FENCE_KDUMP_ARGS local too. "local fence_kdump_args".
Then we will not have to cehck for generic cluster again in this function and our if loop will simplify to.
fence_nodes=$(get_list_of_cluster_nodes)
if is_pcs_fence_kdump;then local fencing_args fencing_args=$(get_pcs_fence_kdump_args) echo "fence_kdump_args $fencing_args" >> ${kdump_cfg_file} echo "fence_kdump_nodes $fence_nodes" >> ${kdump_cfg_file} fi
f
- else
# fence_kdump not configured
return 1
- fi
kdump_install_net $nodename
- # setup network for each node
- for node in ${FENCE_KDUMP_NODES}; do
donekdump_install_net $node
echo
echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES_FILE dracut_install $FENCE_KDUMP_SEND
dracut_install -o $FENCE_KDUMP_CONFIG_FILE
}
# Install a random seed used to feed /dev/urandom diff --git a/kdump-in-cluster-environment.txt b/kdump-in-cluster-environment.txt index c27a5d7..de1eb5e 100644 --- a/kdump-in-cluster-environment.txt +++ b/kdump-in-cluster-environment.txt @@ -34,11 +34,11 @@ recovery service, fence_kdump_send will periodically send messages to all cluster nodes. When the fence_kdump agent receives a valid message from the failed nodes, fencing is complete.
-How to configure cluster environment: +How to configure Pacemaker cluster environment:
-If we want to use kdump in cluster environment, fence-agents-kdump should be -installed in every nodes in the cluster. You can achieve this via the following -command: +If we want to use kdump in Pacemaker cluster environment, fence-agents-kdump +should be installed in every nodes in the cluster. You can achieve this via +the following command:
# yum install -y fence-agents-kdump
@@ -61,6 +61,31 @@ Then enable stonith
How to configure kdump:
-Actually there is nothing special in configuration between normal kdump and -cluster environment kdump. So please refer to Kexec-Kdump-howto file for more -information. +Actually there are two ways how to configure fence_kdump support:
+1) Pacemaker based clusters
If you have successfully configured fence_kdump in Pacemaker, there is
no need to add some special configuration in kdump. So please refer to
Kexec-Kdump-howto file for more information.
+2) Generic clusters
For other types of clusters there are two configuration options in
kdump.conf which enables fence_kdump support:
fence_kdump_nodes <node(s)>
Contains list of cluster node(s) separated by space to send
fence_kdump notification to (this option is mandatory to enable
fence_kdump)
fence_kdump_args <arg(s)>
Command line arguments for fence_kdump_send (it can contain
all valid arguments except hosts to send notification to)
These options will most probably be configured by your cluster software,
so please refer to your cluster documentation how to enable fence_kdump
support.
+Please be aware that these two ways cannot be combined and 2) has precedence +over 1). It means that if fence_kdump is configured using fence_kdump_nodes +and fence_kdump_args options in kdump.conf, Pacemaker configuration is not +used even if it exists.
[..]
diff --git a/kdump-lib.sh b/kdump-lib.sh index 7103ba9..659ead3 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -5,7 +5,6 @@
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" -FENCE_KDUMP_NODES_FILE="/etc/fence_kdump_nodes"
Why are we removing it? I thought you needed this to maintain backward compatibility with pcs?
[..]
diff --git a/kdumpctl b/kdumpctl index 8aacf4e..7450ee2 100755 --- a/kdumpctl +++ b/kdumpctl @@ -166,7 +166,7 @@ function check_config() case "$config_opt" in #* | "") ;;
raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args)
raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes) [ -z "$config_val" ] && { echo "Invalid kdump config value for option $config_opt." return 1;
@@ -249,7 +249,7 @@ function check_rebuild() EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS"
- if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
- if [ !is_generic_fence_kdump -a -f $FENCE_KDUMP_CONFIG_FILE ]; then files="$files $FENCE_KDUMP_CONFIG_FILE" fi
Ok, these methods for checking changes to fence kdump config is getting confusing. Can we please reorganize it a bit.
Can we create a single function which returns list of modified cluster files. And then all the cluster related checks can go in there.
get_cluster_modified_files() { /* If not pcs cluster return */ /* Check for cib file related changes */ /* Check for changes to FENCE_KDUMP_CONFIG_FILE */ }
modified_files=`get_cluster_modified_files`
This will allow us to consolidate all cluster related rebuild check in one function at one place.
For generic cluster we don't have to do anything as kdump.conf will be checked anyway.
@@ -573,6 +573,31 @@ function check_kdump_feasibility() fi }
+function check_fence_kdump_config() +{
- local hostname=`hostname`
- while read config_opt config_val; do
# remove inline comments after the end of a directive.
config_val=$(strip_comments $config_val)
case "$config_opt" in
fence_kdump_nodes)
FENCE_KDUMP_NODES="$config_val"
;;
*)
;;
If you are not doing anything under *), do we still need to specify it? IOW, does the syntax of "case" mandates that default needs to be specified even if we are not doing anything.
Also this function is just making sure that config is fine. Why not use a local variable fence_kudmp_nodes to store values instead of saving it in global variable FENCE_KDUMP_NODES.
esac
- done < $KDUMP_CONFIG_FILE
- for node in $FENCE_KDUMP_NODES; do
if [ "$node" = "$hostname" ]; then
echo "Option fence_kdump_nodes cannot contain $hostname"
return 1
fi
- done
- return 0
+}
function start() { check_config @@ -609,6 +634,12 @@ function start() fi fi
- check_fence_kdump_config
I think this should be part of check_config(). So that all configuration checks can be in one single function. So please this call inside check_config().
Thanks Vivek
----- Original Message -----
From: "Vivek Goyal" vgoyal@redhat.com To: "Martin Perina" mperina@redhat.com Cc: kexec@lists.fedoraproject.org Sent: Tuesday, April 1, 2014 4:26:37 PM Subject: Re: [PATCH 6/6] fence_kdump for generic clusters v4: Add fence_kdump support for generic clusters
On Tue, Apr 01, 2014 at 12:54:26PM +0200, Martin Perina wrote:
Adds two new options to kdump.conf to be able to configure fence_kdump support for generic clusters:
fence_kdump_args <arg(s)> - Command line arguments for fence_kdump_send (it can contain all valid arguments except hosts to send notification to)
fence_kdump_nodes <node(s)> - List of cluster node(s) separated by space to send fence_kdump notification to (this option is mandatory to enable fence_kdump)
Generic clusters fence_kdump configuration take precedence over older method of fence_kdump configuration for Pacemaker clusters. It means that if fence_kdump is configured using above options in kdump.conf, old Pacemaker configuration is not used even if it exists.
Bug-Url: https://bugzilla.redhat.com/1078134 Signed-off-by: Martin Perina mperina@redhat.com
Hi Martin,
This patch series is almost there. Some minor nits below.
[..]
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index e64bc41..5541fae 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -20,7 +20,7 @@ depends() { _dep="$_dep drm" fi
- if is_pcs_fence_kdump; then
- if [ is_generic_fence_kdump -o is_pcs_fence_kdump ]; then _dep="$_dep network" fi
@@ -282,10 +282,13 @@ kdump_install_conf() { core_collector) dracut_install "${config_val%%[[:blank:]]*}" ;;
fence_kdump_nodes)
FENCE_KDUMP_NODES="$config_val"
;;
I would rather like to avoid setting global varibales as much as possible. This install() function is called from dracut context. See more below.
OK
[..]
+# setup fence_kdump in cluster +# setup proper network and install needed files +kdump_configure_fence_kdump () {
- local kdump_cfg_file=$1
- if is_generic_fence_kdump; then
# fence_kdump nodes already read from kdump.conf
:
- elif is_pcs_fence_kdump; then
FENCE_KDUMP_NODES=$(get_pcs_fence_kdump_nodes)
Same here. We can define a "local fence_nodes" and use that in this function instead of trying to set list of nodes in global context.
Also we could define a generic function to get list of cluster nodes.
get_list_of_cluster_nodes() { if generic_clsuter return generic cluster nodes else return pcs_cluster_nodes }
fence_nodes=$(get_list_of_cluster_nodes)
OK
# set appropriate options in kdump.conf
echo "fence_kdump_nodes $FENCE_KDUMP_NODES" >> ${kdump_cfg_file}
FENCE_KDUMP_ARGS=$(get_pcs_fence_kdump_args)
if [ -n "$FENCE_KDUMP_ARGS" ]; then
echo "fence_kdump_args $FENCE_KDUMP_ARGS" >> ${kdump_cfg_file}
KEEP FENCE_KDUMP_ARGS local too. "local fence_kdump_args".
Then we will not have to cehck for generic cluster again in this function and our if loop will simplify to.
fence_nodes=$(get_list_of_cluster_nodes)
if is_pcs_fence_kdump;then local fencing_args fencing_args=$(get_pcs_fence_kdump_args) echo "fence_kdump_args $fencing_args" >> ${kdump_cfg_file} echo "fence_kdump_nodes $fence_nodes" >> ${kdump_cfg_file} fi
OK
f
- else
# fence_kdump not configured
return 1
- fi
kdump_install_net $nodename
- # setup network for each node
- for node in ${FENCE_KDUMP_NODES}; do
donekdump_install_net $node
echo
echo "$nodes" > ${initdir}/$FENCE_KDUMP_NODES_FILE dracut_install $FENCE_KDUMP_SEND
dracut_install -o $FENCE_KDUMP_CONFIG_FILE
}
# Install a random seed used to feed /dev/urandom diff --git a/kdump-in-cluster-environment.txt b/kdump-in-cluster-environment.txt index c27a5d7..de1eb5e 100644 --- a/kdump-in-cluster-environment.txt +++ b/kdump-in-cluster-environment.txt @@ -34,11 +34,11 @@ recovery service, fence_kdump_send will periodically send messages to all cluster nodes. When the fence_kdump agent receives a valid message from the failed nodes, fencing is complete.
-How to configure cluster environment: +How to configure Pacemaker cluster environment:
-If we want to use kdump in cluster environment, fence-agents-kdump should be -installed in every nodes in the cluster. You can achieve this via the following -command: +If we want to use kdump in Pacemaker cluster environment, fence-agents-kdump +should be installed in every nodes in the cluster. You can achieve this via +the following command:
# yum install -y fence-agents-kdump
@@ -61,6 +61,31 @@ Then enable stonith
How to configure kdump:
-Actually there is nothing special in configuration between normal kdump and -cluster environment kdump. So please refer to Kexec-Kdump-howto file for more -information. +Actually there are two ways how to configure fence_kdump support:
+1) Pacemaker based clusters
If you have successfully configured fence_kdump in Pacemaker, there
is
no need to add some special configuration in kdump. So please refer
to
Kexec-Kdump-howto file for more information.
+2) Generic clusters
For other types of clusters there are two configuration options in
kdump.conf which enables fence_kdump support:
fence_kdump_nodes <node(s)>
Contains list of cluster node(s) separated by space to send
fence_kdump notification to (this option is mandatory to
enable
fence_kdump)
fence_kdump_args <arg(s)>
Command line arguments for fence_kdump_send (it can contain
all valid arguments except hosts to send notification to)
These options will most probably be configured by your cluster
software,
so please refer to your cluster documentation how to enable
fence_kdump
support.
+Please be aware that these two ways cannot be combined and 2) has precedence +over 1). It means that if fence_kdump is configured using fence_kdump_nodes +and fence_kdump_args options in kdump.conf, Pacemaker configuration is not +used even if it exists.
[..]
diff --git a/kdump-lib.sh b/kdump-lib.sh index 7103ba9..659ead3 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -5,7 +5,6 @@
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" -FENCE_KDUMP_NODES_FILE="/etc/fence_kdump_nodes"
Why are we removing it? I thought you needed this to maintain backward compatibility with pcs?
Nodes read from Pacemaker config during setup was written to this file, then the file was stored in initial ramdisk and loaded during kdump. Now only fence_kdump_nodes option is used for storing fence_kdump_nodes. Please see kdump_configure_fence_kdump() in dracut-module-setup.sh
[..]
diff --git a/kdumpctl b/kdumpctl index 8aacf4e..7450ee2 100755 --- a/kdumpctl +++ b/kdumpctl @@ -166,7 +166,7 @@ function check_config() case "$config_opt" in #* | "") ;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args)
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes) [ -z "$config_val" ] && { echo "Invalid kdump config value for option $config_opt." return 1;
@@ -249,7 +249,7 @@ function check_rebuild() EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS"
- if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
- if [ !is_generic_fence_kdump -a -f $FENCE_KDUMP_CONFIG_FILE ]; then files="$files $FENCE_KDUMP_CONFIG_FILE" fi
Ok, these methods for checking changes to fence kdump config is getting confusing. Can we please reorganize it a bit.
Can we create a single function which returns list of modified cluster files. And then all the cluster related checks can go in there.
get_cluster_modified_files() { /* If not pcs cluster return */ /* Check for cib file related changes */ /* Check for changes to FENCE_KDUMP_CONFIG_FILE */ }
modified_files=`get_cluster_modified_files`
This will allow us to consolidate all cluster related rebuild check in one function at one place.
For generic cluster we don't have to do anything as kdump.conf will be checked anyway.
OK
@@ -573,6 +573,31 @@ function check_kdump_feasibility() fi }
+function check_fence_kdump_config() +{
- local hostname=`hostname`
- while read config_opt config_val; do
# remove inline comments after the end of a directive.
config_val=$(strip_comments $config_val)
case "$config_opt" in
fence_kdump_nodes)
FENCE_KDUMP_NODES="$config_val"
;;
*)
;;
If you are not doing anything under *), do we still need to specify it? IOW, does the syntax of "case" mandates that default needs to be specified even if we are not doing anything.
I just verified, that the default is not required, so I will remove the part
Also this function is just making sure that config is fine. Why not use a local variable fence_kudmp_nodes to store values instead of saving it in global variable FENCE_KDUMP_NODES.
OK
esac
- done < $KDUMP_CONFIG_FILE
- for node in $FENCE_KDUMP_NODES; do
if [ "$node" = "$hostname" ]; then
echo "Option fence_kdump_nodes cannot contain $hostname"
return 1
fi
- done
- return 0
+}
function start() { check_config @@ -609,6 +634,12 @@ function start() fi fi
- check_fence_kdump_config
I think this should be part of check_config(). So that all configuration checks can be in one single function. So please this call inside check_config().
OK
Thanks Vivek
On Tue, Apr 01, 2014 at 10:41:58AM -0400, Martin Perina wrote: [..]
diff --git a/kdump-lib.sh b/kdump-lib.sh index 7103ba9..659ead3 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -5,7 +5,6 @@
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" -FENCE_KDUMP_NODES_FILE="/etc/fence_kdump_nodes"
Why are we removing it? I thought you needed this to maintain backward compatibility with pcs?
Nodes read from Pacemaker config during setup was written to this file, then the file was stored in initial ramdisk and loaded during kdump. Now only fence_kdump_nodes option is used for storing fence_kdump_nodes. Please see kdump_configure_fence_kdump() in dracut-module-setup.sh
Ok got it. In case of pcs we get list of nodes from "pcs cluster cib" and not from FENCE_KDUMP_NODES_FILE. So we can remove it as it will be replaced by fence_kdump_nodes option in kdump.conf.
Thanks Vivek