On Fri, Dec 05, 2014 at 01:52:26PM +0800, WANG Chao wrote:
We can do the checking for fence_kdump_nodes while we scan
kdump.conf.
Rename the checking function to check_config_fence_kdump_nodes() and
move the function to be around check_config()
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
This is a good cleanup. Thanks Chao.
Acked-by: Vivek Goyal <vgoyal(a)redhat.com>
Vivek
---
kdumpctl | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 2bee385..faf2509 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -226,6 +226,21 @@ backup_initrd()
fi
}
+check_config_fence_kdump_nodes()
+{
+ local hostname=`hostname`
+ local nodes="$1"
+
+ for node in $nodes; do
+ if [ "$node" = "$hostname" ]; then
+ echo "Option fence_kdump_nodes cannot contain $hostname"
+ return 1
+ fi
+ done
+
+ return 0
+}
+
check_config_default_action()
{
local config_opt="default"
@@ -259,7 +274,7 @@ 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|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|force_rebuild|dracut_args|fence_kdump_args)
[ -z "$config_val" ] && {
echo "Invalid kdump config value for option $config_opt."
return 1;
@@ -272,6 +287,9 @@ check_config()
default)
check_config_default_action "$config_val" || return 1
;;
+ fence_kdump_nodes)
+ check_config_fence_kdump_nodes "$config_val" || return 1
+ ;;
*)
echo "Invalid kdump config option $config_opt"
return 1;
@@ -279,8 +297,6 @@ check_config()
esac
done < $KDUMP_CONFIG_FILE
- check_fence_kdump_config || return 1
-
return 0
}
@@ -736,21 +752,6 @@ check_kdump_feasibility()
fi
}
-check_fence_kdump_config()
-{
- local hostname=`hostname`
- local nodes=$(get_option_value "fence_kdump_nodes")
-
- for node in $nodes; do
- if [ "$node" = "$hostname" ]; then
- echo "Option fence_kdump_nodes cannot contain $hostname"
- return 1
- fi
- done
-
- return 0
-}
-
check_dump_feasibility()
{
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
--
1.9.3