diff --git a/rgmanager/src/resources/named.metadata b/rgmanager/src/resources/named.metadata
index 64442b159..548d03b02 100644
--- a/rgmanager/src/resources/named.metadata
+++ b/rgmanager/src/resources/named.metadata
@@ -1,104 +1,116 @@
1.0
This defines an instance of DNS named server
Defines an instance of named server
Specifies a service name for logging and other purposes
Name
Define absolute path to configuration file
Config File
Simplified Database Backend
Simplified Database Backend
Other command-line options for named
Other command-line options for named
Other command-line options for named
Other command-line options for named
+
+
+
+ Update 'notify-source', 'transfer-source', and 'query-source' to match
+ the cluster ip associated with this service.
+
+
+ Use cluster ip as source.
+
+
+
+
Wait X seconds for correct end of service shutdown
Wait X seconds for correct end of service shutdown
Inherit the service name. We need to know
the service name in order to determine file
systems and IPs for this service.
Inherit the service name.
diff --git a/rgmanager/src/resources/named.sh b/rgmanager/src/resources/named.sh
index 89e7b3575..f73bf8942 100755
--- a/rgmanager/src/resources/named.sh
+++ b/rgmanager/src/resources/named.sh
@@ -1,211 +1,215 @@
#!/bin/bash
#
# Copyright (C) 1997-2003 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
export LC_ALL=C
export LANG=C
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
. $(dirname $0)/ocf-shellfuncs
. $(dirname $0)/utils/config-utils.sh
. $(dirname $0)/utils/messages.sh
. $(dirname $0)/utils/ra-skelet.sh
declare NAMED_NAMED=/usr/sbin/named
declare NAMED_pid_file="`generate_name_for_pid_file`"
declare NAMED_conf_dir="`generate_name_for_conf_dir`"
declare NAMED_gen_config_file="$NAMED_conf_dir/named.conf"
declare NAMED_url_list
declare NAMED_parse_config=$(dirname $0)/utils/named-parse-config.pl
+declare NAMED_update_src="false"
verify_all()
{
clog_service_verify $CLOG_INIT
if [ -z "$OCF_RESKEY_name" ]; then
clog_service_verify $CLOG_FAILED "Invalid Name Of Service"
return $OCF_ERR_ARGS
fi
if [ -z "$OCF_RESKEY_service_name" ]; then
clog_service_verify $CLOG_FAILED_NOT_CHILD
return $OCF_ERR_ARGS
fi
if [ -z "$OCF_RESKEY_config_file" ]; then
clog_check_file_exist $CLOG_FAILED_INVALID "$OCF_RESKEY_config_file"
clog_service_verify $CLOG_FAILED
return $OCF_ERR_ARGS
fi
if [ ! -r "$OCF_RESKEY_config_file" ]; then
clog_check_file_exist $CLOG_FAILED_NOT_READABLE $OCF_RESKEY_config_file
clog_service_verify $CLOG_FAILED
return $OCF_ERR_ARGS
fi
+ if [ -n "$OCF_RESKEY_update_source" ]; then
+ NAMED_update_src=$OCF_RESKEY_update_source
+ fi
clog_service_verify $CLOG_SUCCEED
return 0
}
generate_config_file()
{
declare original_file="$1"
declare generated_file="$2"
declare ip_address="$3"
if [ -f "$generated_file" ]; then
sha1_verify "$generated_file"
if [ $? -ne 0 ]; then
clog_check_sha1 $CLOG_FAILED
return 0
fi
fi
clog_generate_config $CLOG_INIT "$original_file" "$generated_file"
generate_configTemplate "$generated_file" "$1"
cat "$original_file" | grep -v "^[[:space:]]*listen-on" | \
grep -v "^[[:space:]]*pid-file" | \
grep -v "^[[:space:]]*directory" >> "$generated_file"
declare tmp_file=`mktemp -t cluster.XXXXXXXXXX`
mv "$generated_file" "$tmp_file"
- "$NAMED_parse_config" "$OCF_RESKEY_named_working_dir" "$NAMED_pid_file" "$ip_address" \
+ "$NAMED_parse_config" "$OCF_RESKEY_named_working_dir" "$NAMED_pid_file" "$ip_address" "$NAMED_update_src"\
< "$tmp_file" > "$generated_file"
rm "$tmp_file"
sha1_addToFile "$generated_file"
clog_generate_config $CLOG_SUCCEED "$original_file" "$generated_file"
return 0;
}
start()
{
declare ip_list;
clog_service_start $CLOG_INIT
create_pid_directory
create_conf_directory "$NAMED_conf_dir"
check_pid_file "$NAMED_pid_file"
if [ $? -ne 0 ]; then
clog_check_pid $CLOG_FAILED "$NAMED_pid_file"
clog_service_start $CLOG_FAILED
return $OCF_ERR_GENERIC
fi
clog_looking_for $CLOG_INIT "IP Addresses"
get_service_ip_keys "$OCF_RESKEY_service_name"
ip_addresses=`build_ip_list`
if [ -z "$ip_addresses" ]; then
clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
return $OCF_ERR_GENERIC
fi
clog_looking_for $CLOG_SUCCEED "IP Addresses"
ip_list=`echo $ip_addresses | sed 's/ /;/;s/\([[:digit:]]\)$/\1;/' `
if [ -z "$ip_list" ]; then
clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
return $OCF_ERR_GENERIC
fi
generate_config_file "$OCF_RESKEY_config_file" "$NAMED_gen_config_file" "$ip_list"
$NAMED_NAMED -c "$NAMED_gen_config_file" $OCF_RESKEY_named_options
if [ $? -ne 0 ]; then
clog_service_start $CLOG_FAILED
return $OCF_ERR_GENERIC
fi
clog_service_start $CLOG_SUCCEED
return 0;
}
stop()
{
clog_service_stop $CLOG_INIT
stop_generic "$NAMED_pid_file" "$OCF_RESKEY_shutdown_wait"
if [ $? -ne 0 ]; then
clog_service_stop $CLOG_FAILED
return $OCF_ERR_GENERIC
fi
clog_service_stop $CLOG_SUCCEED
return 0;
}
status()
{
clog_service_status $CLOG_INIT
status_check_pid "$NAMED_pid_file"
if [ $? -ne 0 ]; then
clog_service_status $CLOG_FAILED "$NAMED_pid_file"
return $OCF_ERR_GENERIC
fi
clog_service_status $CLOG_SUCCEED
return 0
}
case $1 in
meta-data)
cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
exit 0
;;
validate-all)
verify_all
exit $?
;;
start)
verify_all && start
exit $?
;;
stop)
verify_all && stop
exit $?
;;
status|monitor)
verify_all
status
exit $?
;;
restart)
verify_all
stop
start
exit $?
;;
*)
echo "Usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
exit $OCF_ERR_UNIMPLEMENTED
;;
esac
diff --git a/rgmanager/src/resources/utils/named-parse-config.pl b/rgmanager/src/resources/utils/named-parse-config.pl
index cbcaf0389..a941a60c7 100644
--- a/rgmanager/src/resources/utils/named-parse-config.pl
+++ b/rgmanager/src/resources/utils/named-parse-config.pl
@@ -1,44 +1,49 @@
#!/usr/bin/perl -w
#
# Copyright (C) 1997-2003 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##
## Parse named.conf (from STDIN) and add options from cluster.conf
##
-## ./named-parse-config.pl "directory" "pid-file" "listen-on"
+## ./named-parse-config.pl "directory" "pid-file" "listen-on" "set source "
##
use strict;
-if ($#ARGV < 2) {
+if ($#ARGV < 3) {
die ("Not enough arguments");
}
while (my $line = ) {
chomp($line);
$line =~ s/(.*?)\s*$/$1/;
if ($line =~ /^\s*options\s+\{/) {
print $line, "\n";
print "\tdirectory \"$ARGV[0]\";\n";
print "\tpid-file \"$ARGV[1]\";\n";
print "\tlisten-on { $ARGV[2] };\n";
+ if ($ARGV[3] =~ "1|true|TRUE|yes|YES|on|ON") {
+ print "\tnotify-source $ARGV[2];\n";
+ print "\ttransfer-source $ARGV[2];\n";
+ print "\tquery-source $ARGV[2];\n";
+ }
} else {
print $line, "\n";
}
}