Hello community, here is the log from the commit of package resource-agents for openSUSE:Factory checked in at 2014-07-10 14:55:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/resource-agents (Old) and /work/SRC/openSUSE:Factory/.resource-agents.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "resource-agents" Changes: -------- --- /work/SRC/openSUSE:Factory/resource-agents/resource-agents.changes 2014-06-26 07:58:00.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.resource-agents.new/resource-agents.changes 2014-07-10 14:55:03.000000000 +0200 @@ -1,0 +2,43 @@ +Tue Jul 8 09:49:22 UTC 2014 - [email protected] + +- Medium: VirtualDomain: Try xen-list if no emulator is set (bnc#885292) +- Add 0001-Medium-VirtualDomain-Try-xen-list-if-no-emulator-is-.patch + +------------------------------------------------------------------- +Tue Jul 8 09:15:55 UTC 2014 - [email protected] + +- High: Xen: Enable use of xl instead of xm if available (bnc#882548) +- Add: xen-replace-xm-with-xl.patch + +------------------------------------------------------------------- +Tue Jul 8 09:02:47 UTC 2014 - [email protected] + +- Medium: exportfs: allow multiple exports +- High: nfsserver: Support new NFS Active Passive and Active Active use-cases. +- Low: nginx: Fix incorrect parameter name +- Reintroduce Xen RA (bnc#882548) +- dropped merged patches: + - remove 0001-ctdb-add-ctdb_rundir-parameter-and-create-on-startup.patch + - remove 0001-Medium-VirtualDomain-Add-support-for-qemu-dm-as-emul.patch + - remove apache_conditional_initd_check-bnc884674.patch +- upstream cs: v3.9.5-453-g9eb8c17d467e + +------------------------------------------------------------------- +Fri Jul 4 13:11:21 UTC 2014 - [email protected] + +- Create the CTDB runtime state directory on startup; (bnc#885049). + + added 0001-ctdb-add-ctdb_rundir-parameter-and-create-on-startup.patch + +------------------------------------------------------------------- +Fri Jul 4 08:03:12 UTC 2014 - [email protected] + +- Medium: VirtualDomain: Add support for qemu-dm as emulator (bnc#885292) +- add 0001-Medium-VirtualDomain-Add-support-for-qemu-dm-as-emul.patch + +------------------------------------------------------------------- +Tue Jul 1 11:25:25 UTC 2014 - [email protected] + +- Medium: apache: Check before calling init.d script (bnc#884674) +- add apache_conditional_initd_check-bnc884674.patch + +------------------------------------------------------------------- Old: ---- resource-agents-3.9.5+git432.tar.xz New: ---- 0001-Medium-VirtualDomain-Try-xen-list-if-no-emulator-is-.patch resource-agents-3.9.5+git453.tar.xz xen-replace-xm-with-xl.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ resource-agents.spec ++++++ --- /var/tmp/diff_new_pack.inQCYP/_old 2014-07-10 14:55:04.000000000 +0200 +++ /var/tmp/diff_new_pack.inQCYP/_new 2014-07-10 14:55:04.000000000 +0200 @@ -44,7 +44,7 @@ Summary: Open Source HA Reusable Cluster Resource Scripts License: GPL-2.0 and LGPL-2.1+ Group: Productivity/Clustering/HA -Version: 3.9.5+git432 +Version: 3.9.5+git453 Release: 0 Url: http://linux-ha.org/ Source: resource-agents-%{version}.tar.xz @@ -73,6 +73,10 @@ Patch19: fix-sg_persist-devs-required-and-not-defined.patch # sg_persist: change sg_persist ocft not configure isci and let user prepare it manually Patch20: sg_persist-ocft-not-configure-iscsi.patch +# PATCH-FIX-UPSTREAM: Allow Xen RA to use xl if available (bnc#882548) +Patch21: xen-replace-xm-with-xl.patch +# PATCH-FIX-OPENSUSE: VirtualDomain: Try xen-list if no emulator is set (bnc#885292) +Patch22: 0001-Medium-VirtualDomain-Try-xen-list-if-no-emulator-is-.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Obsoletes: heartbeat-resources @@ -156,6 +160,8 @@ %patch18 -p1 %patch19 -p1 %patch20 -p1 +%patch21 -p1 +%patch22 -p1 ########################################################### %build @@ -221,9 +227,6 @@ ln -s /usr/lib/ocf/lib/heartbeat/$f done ) -# remove Xen agent (bnc#882548) -rm -f $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/heartbeat/Xen -rm -f $RPM_BUILD_ROOT%{_mandir}/man7/ocf_heartbeat_Xen.7* ########################################################### ++++++ 0001-Medium-VirtualDomain-Try-xen-list-if-no-emulator-is-.patch ++++++ >From 5ab3ad1d6bba86bd9094655461bdb41ec1a99684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <[email protected]> Date: Tue, 8 Jul 2014 11:46:48 +0200 Subject: [PATCH] Medium: VirtualDomain: Try xen-list if no emulator is set (bnc#885292) --- heartbeat/VirtualDomain | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain index ff29f923d8ef..12a823124943 100755 --- a/heartbeat/VirtualDomain +++ b/heartbeat/VirtualDomain @@ -264,6 +264,14 @@ pid_status() ;; # This can be expanded to check for additional emulators *) + # We may be running xen with PV domains, they don't + # have an emulator set. try xen-list in this case + if have_binary xen-list; then + xen-list $DOMAIN_NAME 2>/dev/null | grep -qs "State.*[-r][-b][-p]--" 2>/dev/null + if [ $? -eq 0 ]; then + rc=$OCF_SUCCESS + fi + fi ;; esac -- 1.8.4.5 ++++++ resource-agents-3.9.5+git432.tar.xz -> resource-agents-3.9.5+git453.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/configure.ac new/resource-agents-3.9.5+git453/configure.ac --- old/resource-agents-3.9.5+git432/configure.ac 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/configure.ac 2014-07-07 17:52:51.000000000 +0200 @@ -900,7 +900,7 @@ AC_MSG_RESULT([]) AC_MSG_RESULT([$PACKAGE configuration:]) AC_MSG_RESULT([ Version = ${VERSION}]) -AC_MSG_RESULT([ Build Version = 07aeed7c9035d8881ee2ec035054f6cb0b53e9f4]) +AC_MSG_RESULT([ Build Version = 9eb8c17d467e97cd9f40a36a1f15152f5ae986ad]) AC_MSG_RESULT([ Features =${PKG_FEATURES}]) AC_MSG_RESULT([]) AC_MSG_RESULT([ Prefix = ${prefix}]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/doc/man/Makefile.am new/resource-agents-3.9.5+git453/doc/man/Makefile.am --- old/resource-agents-3.9.5+git432/doc/man/Makefile.am 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/doc/man/Makefile.am 2014-07-07 17:52:51.000000000 +0200 @@ -114,6 +114,7 @@ ocf_heartbeat_mysql.7 \ ocf_heartbeat_mysql-proxy.7 \ ocf_heartbeat_named.7 \ + ocf_heartbeat_nfsnotify.7 \ ocf_heartbeat_nfsserver.7 \ ocf_heartbeat_nginx.7 \ ocf_heartbeat_oracle.7 \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/CTDB new/resource-agents-3.9.5+git453/heartbeat/CTDB --- old/resource-agents-3.9.5+git432/heartbeat/CTDB 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/heartbeat/CTDB 2014-07-07 17:52:51.000000000 +0200 @@ -80,6 +80,11 @@ var_prefix="/var/ctdb" fi +run_prefix="/run" +if [ ! -d "$var_prefix" ] && [ -d "/var/run" ]; then + var_prefix="/var/run" +fi + : ${OCF_RESKEY_ctdb_manages_samba:=no} : ${OCF_RESKEY_ctdb_manages_winbind:=no} : ${OCF_RESKEY_ctdb_service_smb:=""} @@ -95,6 +100,7 @@ : ${OCF_RESKEY_ctdb_socket:=${var_prefix}/ctdb.socket} : ${OCF_RESKEY_ctdb_dbdir:=${var_prefix}} : ${OCF_RESKEY_ctdb_logfile:=/var/log/ctdb/log.ctdb} +: ${OCF_RESKEY_ctdb_rundir:=${run_prefix}/ctdb} : ${OCF_RESKEY_ctdb_debuglevel:=2} : ${OCF_RESKEY_smb_conf:=/etc/samba/smb.conf} @@ -265,6 +271,15 @@ <content type="string" default="/var/log/ctdb/log.ctdb" /> </parameter> +<parameter name="ctdb_rundir" unique="0" required="0"> +<longdesc lang="en"> +Full path to ctdb runtime directory, used for storage of socket +lock state. +</longdesc> +<shortdesc lang="en">CTDB runtime directory location</shortdesc> +<content type="string" default="${OCF_RESKEY_ctdb_rundir}" /> +</parameter> + <parameter name="ctdb_debuglevel" unique="0" required="0"> <longdesc lang="en"> What debug level to run at (0-10). Higher means more verbose. @@ -554,6 +569,9 @@ mkdir -p $(dirname $OCF_RESKEY_ctdb_logfile) fi + # ensure ctdb's rundir exists, otherwise it will fail to start + mkdir -p $OCF_RESKEY_ctdb_rundir 2>/dev/null + # public addresses file (should not be present, but need to set for correctness if it is) local pub_addr_option="" [ -f "${OCF_RESKEY_ctdb_config_dir}/public_addresses" ] && \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/Makefile.am new/resource-agents-3.9.5+git453/heartbeat/Makefile.am --- old/resource-agents-3.9.5+git432/heartbeat/Makefile.am 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/heartbeat/Makefile.am 2014-07-07 17:52:51.000000000 +0200 @@ -93,6 +93,7 @@ mysql \ mysql-proxy \ named \ + nfsnotify \ nfsserver \ oracle \ oralsnr \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/VirtualDomain new/resource-agents-3.9.5+git453/heartbeat/VirtualDomain --- old/resource-agents-3.9.5+git432/heartbeat/VirtualDomain 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/heartbeat/VirtualDomain 2014-07-07 17:52:51.000000000 +0200 @@ -248,9 +248,9 @@ local emulator=$(get_emulator) case "$emulator" in - qemu-kvm|qemu-system-*) + qemu-kvm|qemu-dm|qemu-system-*) rc=$OCF_NOT_RUNNING - ps awx | grep -E "[q]emu-(kvm|system).*-name $DOMAIN_NAME " > /dev/null 2>&1 + ps awx | grep -E "[q]emu-(kvm|dm|system).*-name $DOMAIN_NAME " > /dev/null 2>&1 if [ $? -eq 0 ]; then rc=$OCF_SUCCESS fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/apache new/resource-agents-3.9.5+git453/heartbeat/apache --- old/resource-agents-3.9.5+git432/heartbeat/apache 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/heartbeat/apache 2014-07-07 17:52:51.000000000 +0200 @@ -86,7 +86,7 @@ # will be either $DEFAULT_RHELCONFIG or $DEFAULT_SUSECONFIG depending # on which is detected. usage() { -cat <<-! +cat <<-END usage: $0 action action: @@ -104,7 +104,7 @@ meta-data show meta data message validate-all validate the instance parameters - ! +END } get_pid() { @@ -157,12 +157,13 @@ # that include, we run "/etc/init.d/apache2 configtest" to ensure # the relevant config is generated and valid. We're also taking # this opportunity to enable mod_status if it's not present. +# Note: no longer necessary with systemd validate_default_suse_config() { if [ "$CONFIGFILE" = "$DEFAULT_SUSECONFIG" ] && \ grep -Eq '^Include[[:space:]]+/etc/apache2/sysconfig.d/include.conf' "$CONFIGFILE" then [ -x "/usr/sbin/a2enmod" ] && ocf_run -q /usr/sbin/a2enmod status - ocf_run -q /etc/init.d/apache2 configtest + [ -e "/etc/init.d/apache2" ] && ocf_run -q /etc/init.d/apache2 configtest return else return 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/exportfs new/resource-agents-3.9.5+git453/heartbeat/exportfs --- old/resource-agents-3.9.5+git432/heartbeat/exportfs 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/heartbeat/exportfs 2014-07-07 17:52:51.000000000 +0200 @@ -46,7 +46,7 @@ <parameter name="clientspec" unique="0" required="1"> <longdesc lang="en"> The client specification allowing remote machines to mount the directory -over NFS. +(or directories) over NFS. </longdesc> <shortdesc lang="en"> Client ACL. @@ -56,7 +56,8 @@ <parameter name="options" unique="0" required="0"> <longdesc lang="en"> -The options to pass to exportfs for the exported directory. +The options to pass to exportfs for the exported directory +or directories. </longdesc> <shortdesc lang="en"> Export options. @@ -66,10 +67,11 @@ <parameter name="directory" unique="0" required="1"> <longdesc lang="en"> -The directory which you wish to export using NFS. +The directory or directories to be exported using NFS. Multiple +directories are separated by white space. </longdesc> <shortdesc lang="en"> -The directory to export. +The directory or directories to export. </shortdesc> <content type="string" /> </parameter> @@ -79,13 +81,17 @@ The fsid option to pass to exportfs. This can be a unique positive integer, a UUID, or the special string "root" which is functionally identical to numeric fsid of 0. +If multiple directories are being exported, then they are +assigned ids sequentially starting with this fsid (fsid, fsid+1, +fsid+2, ...). Obviously, in that case the fsid must be an +integer. 0 (root) identifies the export as the root of an NFSv4 pseudofilesystem -- avoid this setting unless you understand its special status. This value will override any fsid provided via the options parameter. </longdesc> <shortdesc lang="en"> -Unique fsid within cluster. +Unique fsid within cluster or starting fsid for multiple exports. </shortdesc> <content type="string" /> </parameter> @@ -171,18 +177,48 @@ ! } +reset_fsid() { + CURRENT_FSID=$OCF_RESKEY_fsid +} +bump_fsid() { + let $((CURRENT_FSID++)) +} +get_fsid() { + echo $CURRENT_FSID +} + +# run a function on all directories +forall() { + local func=$1 + shift 1 + local fast_exit="" + local dir rc=0 + if [ "$2" = fast_exit ]; then + fast_exit=1 + shift 1 + fi + reset_fsid + for dir in $OCF_RESKEY_directory; do + $func $dir "$@" + rc=$(($rc | $?)) + bump_fsid + [ "$fast_exit" ] && continue + [ $rc -ne 0 ] && return $rc + done + return $rc +} + backup_rmtab() { + local dir=$1 local rmtab_backup - if [ ${OCF_RESKEY_rmtab_backup} != "none" ]; then - rmtab_backup="${OCF_RESKEY_directory}/${OCF_RESKEY_rmtab_backup}" - grep ":${OCF_RESKEY_directory}:" /var/lib/nfs/rmtab > ${rmtab_backup} - fi + rmtab_backup="$dir/${OCF_RESKEY_rmtab_backup}" + grep ":$dir:" /var/lib/nfs/rmtab > ${rmtab_backup} } restore_rmtab() { + local dir=$1 local rmtab_backup - if [ ${OCF_RESKEY_rmtab_backup} != "none" ]; then - rmtab_backup="${OCF_RESKEY_directory}/${OCF_RESKEY_rmtab_backup}" + rmtab_backup="$dir/${OCF_RESKEY_rmtab_backup}" if [ -r ${rmtab_backup} ]; then local tmpf=`mktemp` sort -u ${rmtab_backup} /var/lib/nfs/rmtab > $tmpf && @@ -192,7 +228,6 @@ else ocf_log warn "rmtab backup ${rmtab_backup} not found or not readable." fi - fi } exportfs_usage() { @@ -201,88 +236,95 @@ END } +format_exports() { + # exportfs output wraps lines for long export directory names. + # We unwrap here with sed. + # We then do a literal match on the full line (grep -x -F) + exportfs | + sed -e '$! N; s/\n[[:space:]]\+/ /; t; s/[[:space:]]\+\([^[:space:]]\+\)\(\n\|$\)/ \1\2/g; P;D;' +} is_exported() { local dir=$1 local spec=$2 - exportfs | - sed -e '$! N; s/\n[[:space:]]\+/ /; t; s/[[:space:]]\+\([^[:space:]]\+\)\(\n\|$\)/ \1\2/g; P;D;' | - grep -q -x -F "$dir $spec" -} - -exportfs_monitor () -{ local rc - # exportfs output wraps lines for long export directory names. - # We unwrap here with sed. - # We then do a literal match on the full line (grep -x -F) - is_exported "${OCF_RESKEY_directory}" "${OCF_RESKEY_clientspec}" + format_exports | grep -q -x -F "$dir $spec" rc=$? - - # on some platforms, exportfs may print "<world>" instead of - # "*" - if [ $rc -eq 1 -a "${OCF_RESKEY_clientspec}" = "*" ]; then - is_exported "${OCF_RESKEY_directory}" "<world>" + if [ $rc -ne 0 -a "$spec" = "*" ]; then + # on some platforms, exportfs may print + # "<world>" instead of "*" + format_exports | grep -q -x -F "$dir <world>" rc=$? fi - -#Adapt grep status code to OCF return code - case $rc in - 0) - if [ "$__OCF_ACTION" = "start" ]; then - ocf_log info "Directory ${OCF_RESKEY_directory} is exported to ${OCF_RESKEY_clientspec} (started)." - fi - # Backup the rmtab to ensure smooth NFS-over-TCP failover - backup_rmtab - return $OCF_SUCCESS - ;; - 1) - ocf_log info "Directory ${OCF_RESKEY_directory} is not exported to ${OCF_RESKEY_clientspec} (stopped)." - return $OCF_NOT_RUNNING;; - *) - ocf_log err "Unable to determine export status for ${OCF_RESKEY_directory}." - return $OCF_ERR_GENERIC;; - esac + # log something only for monitors + if [ $rc -ne 0 -a "$__OCF_ACTION" = "monitor" ]; then + local sev="info" + ocf_is_probe || sev="err" + ocf_log $sev "$dir not exported to $spec (stopped)." + fi + return $rc } -exportfs_start () +exportfs_monitor () { - if exportfs_monitor; then - ocf_log debug "${OCF_RESKEY_directory} already exported" + if forall is_exported "${OCF_RESKEY_clientspec}"; then + if [ ${OCF_RESKEY_rmtab_backup} != "none" ]; then + forall backup_rmtab + fi return $OCF_SUCCESS + else + return $OCF_NOT_RUNNING fi - - ocf_log info "Exporting file system ..." +} - if [ ${OCF_RESKEY_options} ]; then - OPTIONS="${OCF_RESKEY_options}" - OPTPREFIX=',' - fi - if [ `echo ${OPTIONS} | grep fsid` ]; then - #replace fsid provided in options list with one provided in fsid param. - OPTIONS=`echo ${OPTIONS} | sed "s/fsid=[0-9]\+/fsid=${OCF_RESKEY_fsid}/g"` +export_one() { + local dir=$1 + local opts sep + sep="" + if [ -n "$OCF_RESKEY_options" ]; then + opts="$OCF_RESKEY_options" + sep="," + fi + if echo "$opts" | grep fsid >/dev/null; then + #replace fsid in options list + opts=`echo "$opts" | sed "s/fsid=[0-9]\+/fsid=$(get_fsid)/g"` else #tack the fsid option onto our options list. - OPTIONS="${OPTIONS}${OPTPREFIX}fsid=${OCF_RESKEY_fsid}" + opts="${opts}${sep}fsid=$(get_fsid)" fi - OPTIONS="-o ${OPTIONS}" - - ocf_run exportfs -v ${OPTIONS} ${OCF_RESKEY_clientspec}:${OCF_RESKEY_directory} || exit $OCF_ERR_GENERIC + opts="-o $opts" - # Restore the rmtab to ensure smooth NFS-over-TCP failover - restore_rmtab + # if any of directories fails to export we can exit + # immediately + ocf_run exportfs -v $opts "${OCF_RESKEY_clientspec}:$dir" || + exit $OCF_ERR_GENERIC - ocf_log info "File system exported" + ocf_log info "directory $dir exported" return $OCF_SUCCESS } +exportfs_start () +{ + if exportfs_monitor; then + ocf_log debug "already exported" + return $OCF_SUCCESS + fi + ocf_log info "Exporting file system(s) ..." + forall export_one + + # Restore the rmtab to ensure smooth NFS-over-TCP failover + if [ ${OCF_RESKEY_rmtab_backup} != "none" ]; then + forall restore_rmtab + fi +} unlock_fs() { + local dir=$1 local unlockfile unlockfile=/proc/fs/nfsd/unlock_filesystem if [ -w ${unlockfile} ]; then - echo "${OCF_RESKEY_directory}" > ${unlockfile} - ocf_log info "Unlocked NFS export ${OCF_RESKEY_directory}" + echo "$dir" > ${unlockfile} + ocf_log info "Unlocked NFS export $dir" else - ocf_log warn "Unable to unlock NFS export ${OCF_RESKEY_directory}, ${unlockfile} not found or not writable" + ocf_log warn "Unable to unlock NFS export $dir, ${unlockfile} not found or not writable" fi } wait_for_leasetime() { @@ -300,10 +342,11 @@ cleanup_export_cache() { # see if the cache is blocking unexport local contentfile=/proc/net/rpc/nfsd.export/content - local fsid_re="fsid=$OCF_RESKEY_fsid," + local fsid_re local i=1 + fsid_re="fsid=(echo `forall get_fsid`|sed 's/ /|/g')," while :; do - fgrep -q "$fsid_re" $contentfile || + grep -E -q "$fsid_re" $contentfile || break ocf_log info "Cleanup export cache ... (try $i)" ocf_run exportfs -f @@ -311,24 +354,32 @@ let i=$i+1 done } +unexport_one() { + local dir=$1 + ocf_run exportfs -v -u ${OCF_RESKEY_clientspec}:$dir +} exportfs_stop () { + local rc + exportfs_monitor if [ $? -eq $OCF_NOT_RUNNING ]; then - ocf_log debug "${OCF_RESKEY_directory} not exported" + ocf_log debug "not exported" return $OCF_SUCCESS fi ocf_log info "Un-exporting file system ..." # Backup the rmtab to ensure smooth NFS-over-TCP failover - backup_rmtab + if [ ${OCF_RESKEY_rmtab_backup} != "none" ]; then + forall backup_rmtab + fi - ocf_run exportfs -v -u ${OCF_RESKEY_clientspec}:${OCF_RESKEY_directory} + forall unexport_one rc=$? if ocf_is_true ${OCF_RESKEY_unlock_on_stop}; then - unlock_fs + forall unlock_fs fi if ocf_is_true ${OCF_RESKEY_wait_for_leasetime_on_stop}; then @@ -337,18 +388,30 @@ if [ $rc -eq 0 ]; then cleanup_export_cache - ocf_log info "Un-exported file system" + ocf_log info "Un-exported file system(s)" return $OCF_SUCCESS else - ocf_log err "Failed to un-export file system" - exit $OCF_ERR_GENERIC + ocf_log err "Failed to un-export file system(s)" + return $OCF_ERR_GENERIC fi } +testdir() { + if [ ! -d $1 ]; then + ocf_is_probe || + ocf_log err "$1 does not exist or is not a directory" + return 1 + fi + return 0 +} exportfs_validate_all () { - if [ ! -d $OCF_RESKEY_directory ]; then - ocf_log err "$OCF_RESKEY_directory does not exist or is not a directory" + if [ `echo "$OCF_RESKEY_directory" | wc -w` -gt 1 ] && + ! ocf_is_decimal "$OCF_RESKEY_fsid"; then + ocf_log err "use integer fsid when exporting multiple directories" + return $OCF_ERR_CONFIGURED + fi + if ! forall testdir; then return $OCF_ERR_INSTALLED fi } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/nfsnotify new/resource-agents-3.9.5+git453/heartbeat/nfsnotify --- old/resource-agents-3.9.5+git432/heartbeat/nfsnotify 1970-01-01 01:00:00.000000000 +0100 +++ new/resource-agents-3.9.5+git453/heartbeat/nfsnotify 2014-07-07 17:52:51.000000000 +0200 @@ -0,0 +1,315 @@ +#!/bin/bash +# +# Copyright (c) 2014 David Vossel <[email protected]> +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. +# + +####################################################################### +# Initialization: + +: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} +. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs +. ${OCF_FUNCTIONS_DIR}/ocf-directories + +####################################################################### + +sbindir=$HA_SBIN_DIR +if [ -z "$sbindir" ]; then + sbindir=/usr/sbin +fi + +SELINUX_ENABLED=-1 + +NFSNOTIFY_TMP_DIR="${HA_RSCTMP}/nfsnotify_${OCF_RESOURCE_INSTANCE}/" +HA_STATD_PIDFILE="$NFSNOTIFY_TMP_DIR/rpc.statd_${OCF_RESOURCE_INSTANCE}.pid" +HA_STATD_PIDFILE_PREV="$NFSNOTIFY_TMP_DIR/rpc.statd_${OCF_RESOURCE_INSTANCE}.pid.prev" +STATD_PATH="/var/lib/nfs/statd" +SM_NOTIFY_BINARY="${sbindir}/sm-notify" +IS_RENOTIFY=0 + +meta_data() { + cat <<END +<?xml version="1.0"?> +<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd"> +<resource-agent name="nfsnotify" version="0.9"> +<version>1.0</version> + +<longdesc lang="en"> +This agent sends NFSv3 reboot notifications to clients which informs clients to reclaim locks. +</longdesc> +<shortdesc lang="en">sm-notify reboot notifications</shortdesc> + +<parameters> + +<parameter name="source_host" unique="0" required="0"> +<longdesc lang="en"> +Comma separated list of floating IP addresses or host names that clients use +to access the nfs service. This will be used to set the source address and +mon_name of the SN_NOTIFY reboot notifications. +</longdesc> +<shortdesc lang="en">source IP addresses</shortdesc> +<content type="string" default="" /> +</parameter> + +<parameter name="notify_args" unique="0" required="0"> +<longdesc lang="en"> +Additional arguments to send to the sm-notify command. By default +this agent will always set sm-notify's '-f' option. When the +source_host option is set, the '-v' option will be used automatically +to set the proper source address. Any additional sm-notify arguments +set with this option will be used in addition to the previous default +arguments. +</longdesc> +<shortdesc lang="en">sm-notify arguments</shortdesc> +<content type="string" default="false" /> +</parameter> + +</parameters> + +<actions> +<action name="start" timeout="90" /> +<action name="stop" timeout="90" /> +<action name="monitor" timeout="90" interval="30" depth="0" /> +<action name="reload" timeout="90" /> +<action name="meta-data" timeout="10" /> +<action name="validate-all" timeout="20" /> +</actions> +</resource-agent> +END +} + +v3notify_usage() +{ + cat <<END +usage: $0 {start|stop|monitor|validate-all|meta-data} + +Expects to have a fully populated OCF RA-compliant environment set. +END +} + +v3notify_validate() +{ + # check_binary will exit with OCF_ERR_INSTALLED when binary is missing + check_binary "$SM_NOTIFY_BINARY" + check_binary "pgrep" + check_binary "killall" + + return $OCF_SUCCESS +} + +killall_smnotify() +{ + # killall sm-notify + killall -TERM $SM_NOTIFY_BINARY > /dev/null 2>&1 + if [ $? -eq 0 ]; then + # it is useful to know if sm-notify processes were actually left around + # or not during the stop/start operation. Whether this condition is true + # or false does not indicate a failure. It does indicate that + # there are probably some unresponsive nfs clients out there that are keeping + # the sm-notify processes retrying. + ocf_log info "previous sm-notify processes terminated before $__OCF_ACTION action." + fi +} + +v3notify_stop() +{ + killall_smnotify + + rm -f $HA_STATD_PIDFILE_PREV > /dev/null 2>&1 + mv $HA_STATD_PIDFILE $HA_STATD_PIDFILE_PREV > /dev/null 2>&1 + + return $OCF_SUCCESS +} + +check_statd_pidfile() +{ + local binary="rpc.statd" + local pidfile="$HA_STATD_PIDFILE" + + ocf_log debug "Checking status for ${binary}." + if [ -e "$pidfile" ]; then + cat /proc/$(cat $pidfile)/cmdline 2>/dev/null | grep -a "${binary}" > /dev/null 2>&1 + if [ $? -eq 0 ]; then + return $OCF_SUCCESS + fi + + ocf_log err "$(cat $pidfile) for $binary is no longer running, sm-notify needs to re-notify clients" + return $OCF_ERR_GENERIC + fi + + # if we don't have a pid file for rpc.statd, we have not yet sent the notifications + return $OCF_NOT_RUNNING +} + +write_statd_pid() +{ + local binary="rpc.statd" + local pidfile="$HA_STATD_PIDFILE" + local pid + + pid=$(pgrep ${binary}) + case $? in + 0) + ocf_log info "PID file (pid:${pid} at $pidfile) created for ${binary}." + mkdir -p $(dirname $pidfile) + echo "$pid" > $pidfile + return $OCF_SUCCESS;; + 1) + rm -f "$pidfile" > /dev/null 2>&1 + ocf_log info "$binary is not running" + return $OCF_NOT_RUNNING;; + *) + rm -f "$pidfile" > /dev/null 2>&1 + ocf_log err "Error encountered detecting pid status of $binary" + return $OCF_ERR_GENERIC;; + esac +} + +copy_statd() +{ + local src=$1 + local dest=$2 + + if ! [ -d "$dest" ]; then + mkdir -p "$dest" + fi + + cp -rpfn $src/sm $src/sm.bak $src/state $dest > /dev/null 2>&1 + + # make sure folder ownership and selinux lables stay consistent + [ -n "`id -u rpcuser`" -a "`id -g rpcuser`" ] && chown rpcuser.rpcuser "$dest" + [ $SELINUX_ENABLED -eq 0 ] && chcon -R "$SELINUX_LABEL" "$dest" +} + +v3notify_start() +{ + local rc=$OCF_SUCCESS + local cur_statd + local statd_backup + local is_renotify=0 + + # monitor, see if we need to notify or not + v3notify_monitor + if [ $? -eq 0 ]; then + return $OCF_SUCCESS + fi + + # kill off any other sm-notify processes that might already be running. + killall_smnotify + + # record the pid of rpc.statd. if this pid ever changes, we have to re-notify + write_statd_pid + rc=$? + if [ $rc -ne 0 ]; then + return $rc + fi + + # if the last time we ran nfs-notify, it was with the same statd process, + # consider this a re-notification. During re-notifications we do not let the + # sm-notify binary have access to the real statd directory. + if [ "$(cat $HA_STATD_PIDFILE)" = "$(cat $HA_STATD_PIDFILE_PREV 2>/dev/null)" ]; then + ocf_log info "Renotifying clients" + is_renotify=1 + fi + + statd_backup="$STATD_PATH/nfsnotify.bu" + copy_statd "$STATD_PATH" "$statd_backup" + + if [ -z "$OCF_RESKEY_source_host" ]; then + if [ "$is_renotify" -eq 0 ]; then + cur_statd="$STATD_PATH" + else + cur_statd="$statd_backup" + fi + ocf_log info "sending notifications on default source address." + $SM_NOTIFY_BINARY -f $OCF_RESKEY_notify_args -P $cur_statd + if [ $? -ne 0 ]; then + ocf_log err "sm-notify failed, view syslog for more information." + return $OCF_ERR_GENERIC + fi + + return $OCF_SUCCESS + fi + + # do sm-notify for each ip + for ip in `echo ${OCF_RESKEY_source_host} | sed 's/,/ /g'`; do + + # have the first sm-notify use the actual statd directory so the + # notify list can be managed properly. + if [ "$is_renotify" -eq 0 ]; then + cur_statd="$STATD_PATH" + # everything after the first notify we are considering a renotification + # which means we don't use the real statd directory. + is_renotify=1 + else + # use our copied statd directory for the remaining ip addresses + cur_statd="$STATD_PATH/nfsnotify_${OCF_RESOURCE_INSTANCE}_${ip}" + copy_statd "$statd_backup" "$cur_statd" + fi + + ocf_log info "sending notifications with source address $ip" + $SM_NOTIFY_BINARY -f $OCF_RESKEY_notify_args -v $ip -P "$cur_statd" + if [ $? -ne 0 ]; then + ocf_log err "sm-notify with source host set to, $source_host, failed. view syslog for more information" + return $OCF_ERR_GENERIC + fi + done + + return $OCF_SUCCESS +} + +v3notify_monitor() +{ + # verify rpc.statd is up, and that the rpc.statd pid is the same one we + # found during the start. otherwise rpc.statd recovered and we need to notify + # again. + check_statd_pidfile +} + +case $__OCF_ACTION in + meta-data) meta_data + exit $OCF_SUCCESS;; + usage|help) v3notify_usage + exit $OCF_SUCCESS;; + *) + ;; +esac + +which restorecon > /dev/null 2>&1 && selinuxenabled +SELINUX_ENABLED=$? +if [ $SELINUX_ENABLED -eq 0 ]; then + export SELINUX_LABEL="$(ls -ldZ $STATD_PATH | cut -f4 -d' ')" +fi + +case $__OCF_ACTION in + start) v3notify_start;; + stop) v3notify_stop;; + monitor) v3notify_monitor;; + validate-all) v3notify_validate;; + *) v3notify_usage + exit $OCF_ERR_UNIMPLEMENTED;; +esac + +rc=$? +ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" +exit $rc + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/nfsserver new/resource-agents-3.9.5+git453/heartbeat/nfsserver --- old/resource-agents-3.9.5+git432/heartbeat/nfsserver 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/heartbeat/nfsserver 2014-07-07 17:52:51.000000000 +0200 @@ -26,6 +26,9 @@ SELINUX_ENABLED=-1 STATD_PATH="/var/lib/nfs" STATD_DIR="" +NFS_SYSCONFIG="/etc/sysconfig/nfs" +NFS_SYSCONFIG_LOCAL_BACKUP="/etc/sysconfig/nfs.ha.bu" +NFS_SYSCONFIG_AUTOGEN_TAG="AUTOGENERATED by $0 high availability resource-agent" nfsserver_meta_data() { cat <<END @@ -59,6 +62,16 @@ <content type="string" default="auto detected" /> </parameter> +<parameter name="nfs_no_notify" unique="0" required="0"> +<longdesc lang="en"> +Do not send reboot notifications to NFSv3 clients during server startup. +</longdesc> +<shortdesc lang="en"> +Disable NFSv3 server reboot notifications +</shortdesc> +<content type="boolean" default="false" /> +</parameter> + <parameter name="nfs_notify_foreground" unique="0" required="0"> <longdesc lang="en"> Keeps the sm-notify attached to its controlling terminal and running in the foreground. @@ -69,6 +82,18 @@ <content type="boolean" default="$DEFAULT_NOTIFY_FOREGROUND" /> </parameter> +<parameter name="nfs_smnotify_retry_time" unique="0" required="0"> +<longdesc lang="en"> +Specifies the length of sm-notify retry time, in minutes, to continue retrying notifications to unresponsive hosts. +If this option is not specified, sm-notify attempts to send notifications for 15 minutes. Specifying a value of 0 +causes sm-notify to continue sending notifications to unresponsive peers until it is manually killed. +</longdesc> +<shortdesc lang="en"> +Specifies the length of sm-notify retry time (minutes). +</shortdesc> +<content type="integer" default="" /> +</parameter> + <parameter name="nfs_ip" unique="0" required="0"> <longdesc lang="en"> Comma separated list of floating IP addresses used to access the nfs service @@ -79,19 +104,84 @@ <content type="string"/> </parameter> -<parameter name="nfs_smnotify_retry_time" unique="0" required="0"> +<parameter name="nfsd_args" unique="0" required="0"> <longdesc lang="en"> -Specifies the length of sm-notify retry time, in minutes, to continue retrying notifications to unresponsive hosts. -If this option is not specified, sm-notify attempts to send notifications for 15 minutes. Specifying a value of 0 -causes sm-notify to continue sending notifications to unresponsive peers until it is manually killed. +Specifies what arguments to pass to the nfs daemon on startup. View the rpc.nfsd man page for information on what arguments are available. +Note that setting this value will override all settings placed in the local /etc/sysconfig/nfs file. </longdesc> <shortdesc lang="en"> -Specifies the length of sm-notify retry time (minutes). +rpc.nfsd options </shortdesc> -<content type="integer" default="" /> +<content type="string" /> +</parameter> + +<parameter name="lockd_udp_port" unique="0" required="0"> +<longdesc lang="en"> +The udp port lockd should listen on. +Note that setting this value will override all settings placed in the local /etc/sysconfig/nfs file. +</longdesc> +<shortdesc lang="en"> +lockd udp port +</shortdesc> +<content type="integer" /> +</parameter> + +<parameter name="lockd_tcp_port" unique="0" required="0"> +<longdesc lang="en"> +The tcp port lockd should listen on. +Note that setting this value will override all settings placed in the local /etc/sysconfig/nfs file. +</longdesc> +<shortdesc lang="en"> +lockd tcp port +</shortdesc> +<content type="integer" /> +</parameter> + +<parameter name="statd_outgoing_port" unique="0" required="0"> +<longdesc lang="en"> +The source port number sm-notify uses when sending reboot notifications. +Note that setting this value will override all settings placed in the local /etc/sysconfig/nfs file. +</longdesc> +<shortdesc lang="en"> +sm-notify source port +</shortdesc> +<content type="integer" /> </parameter> -<parameter name="nfs_shared_infodir" unique="0" required="1"> +<parameter name="statd_port" unique="0" required="0"> +<longdesc lang="en"> +The port number used for RPC listener sockets. +Note that setting this value will override all settings placed in the local /etc/sysconfig/nfs file. +</longdesc> +<shortdesc lang="en"> +rpc.statd listener port +</shortdesc> +<content type="integer" /> +</parameter> + +<parameter name="mountd_port" unique="0" required="0"> +<longdesc lang="en"> +The port number used for rpc.mountd listener sockets. +Note that setting this value will override all settings placed in the local /etc/sysconfig/nfs file. +</longdesc> +<shortdesc lang="en"> +rpc.mountd listener port +</shortdesc> +<content type="integer" /> +</parameter> + +<parameter name="rquotad_port" unique="0" required="0"> +<longdesc lang="en"> +The port number used for rpc.rquotad. +Note that setting this value will override all settings placed in the local /etc/sysconfig/nfs file. +</longdesc> +<shortdesc lang="en"> +rpc.rquotad port +</shortdesc> +<content type="integer" /> +</parameter> + +<parameter name="nfs_shared_infodir" unique="0" required="0"> <longdesc lang="en"> The nfsserver resource agent will save nfs related information in this specific directory. And this directory must be able to fail-over before nfsserver itself. @@ -287,8 +377,71 @@ fi } +set_arg() +{ + local key="$1" + local value="$2" + local file="$3" + + if [ -z "$value" ]; then + return + fi + + echo "${key}=\"${value}\"" >> $file + export ${key}="${value}" +} + +set_env_args() +{ + local tmpconfig=$(mktemp ${HA_RSCTMP}/nfsserver-tmp-XXXXX) + local statd_args + + # nfsd args + set_arg "RPCNFSDARGS" "$OCF_RESKEY_nfsd_args" "$tmpconfig" + + # mountd args + if [ -n "$OCF_RESKEY_mountd_port" ]; then + set_arg "RPCMOUNTDOPTS" "-p $OCF_RESKEY_mountd_port" "$tmpconfig" + fi + + # statd args. we always want to perform the notify using sm-notify after + # both rpc.statd and the nfsd daemons are initialized + statd_args="--no-notify" + if [ -n "$OCF_RESKEY_statd_outgoing_port" ]; then + statd_args="$statd_args -o $OCF_RESKEY_statd_outgoing_port" + fi + if [ -n "$OCF_RESKEY_statd_port" ]; then + statd_args="$statd_args -p $OCF_RESKEY_statd_port" + fi + set_arg "STATDARG" "$statd_args" "$tmpconfig" + + # lockd ports + set_arg "LOCKD_UDPPORT" "$OCF_RESKEY_lockd_udp_port" "$tmpconfig" + set_arg "LOCKD_TCPPORT" "$OCF_RESKEY_lockd_tcp_port" "$tmpconfig" + + # rquotad_port + set_arg "RPCRQUOTADOPTS" "$OCF_RESKEY_rquotad_port" "$tmpconfig" + + # override local nfs config. preserve previous local config though. + if [ -s $tmpconfig ]; then + cat $NFS_SYSCONFIG | grep -e "$NFS_SYSCONFIG_AUTOGEN_TAG" + if [ $? -ne 0 ]; then + # backup local nfs config if it doesn't have our HA autogen tag in it. + mv -f $NFS_SYSCONFIG $NFS_SYSCONFIG_LOCAL_BACKUP + fi + echo "# $NFS_SYSCONFIG_AUTOGEN_TAG" > $NFS_SYSCONFIG + echo "# local config backup stored here, '$NFS_SYSCONFIG_LOCAL_BACKUP'" >> $NFS_SYSCONFIG + cat $tmpconfig >> $NFS_SYSCONFIG + fi + rm -f $tmpconfig +} + prepare_directory () { + if [ -z "$fp" ]; then + return + fi + [ -d "$fp" ] || mkdir -p $fp [ -d "$rpcpipefs_make_dir" ] || mkdir -p $rpcpipefs_make_dir [ -d "$fp/v4recovery" ] || mkdir -p $fp/v4recovery @@ -303,6 +456,8 @@ [ -f "$fp/xtab" ] || touch "$fp/xtab" [ -f "$fp/rmtab" ] || touch "$fp/rmtab" + dd if=/dev/urandom of=$fp/$STATD_DIR/state bs=1 count=4 &> /dev/null + [ -n "`id -u rpcuser`" -a "`id -g rpcuser`" ] && chown rpcuser.rpcuser "$fp/$STATD_DIR/state" [ $SELINUX_ENABLED -eq 0 ] && chcon -R "$SELINUX_LABEL" "$fp" } @@ -317,6 +472,10 @@ bind_tree () { + if [ -z "$fp" ]; then + return + fi + if is_bound /var/lib/nfs; then ocf_log debug "$fp is already bound to /var/lib/nfs" return 0 @@ -363,21 +522,7 @@ ocf_log info "Starting rpc.statd." - if [ -n "$OCF_RESKEY_nfs_ip" ]; then - rm -rf $STATD_PATH/sm.ha.save > /dev/null 2>&1 - cp -rpf $STATD_PATH/sm.ha $STATD_PATH/sm.ha.save > /dev/null 2>&1 - for ip in `echo ${OCF_RESKEY_nfs_ip} | sed 's/,/ /g'`; do - rpc.statd -n $ip -P $STATD_PATH/sm.ha - ret=$? - if [ $ret -eq 0 ]; then - break - fi - rm -rf $STATD_PATH/sm.ha > /dev/null 2>&1 - cp -rpf $STATD_PATH/sm.ha.save $STATD_PATH/sm.ha > /dev/null 2>&1 - done - else - rpc.statd -d - fi + rpc.statd $STATDARG ret=$? if [ $ret -ne 0 ]; then @@ -445,20 +590,25 @@ # sm-notify can prevent umount of /var/lib/nfs/statd if # it is still trying to notify unresponsive clients. stop_process sm-notify - if [ $? -ne 0]; then + if [ $? -ne 0 ]; then ret=$OCF_ERR_GENERIC fi stop_process rpc.statd - if [ $? -ne 0]; then + if [ $? -ne 0 ]; then ret=$OCF_ERR_GENERIC fi return $ret } -renotify_locks() +notify_locks() { + if ocf_is_true "$OCF_RESKEY_nfs_no_notify"; then + # we've been asked not to notify clients + return; + fi + # run in foreground, if requested if ocf_is_true "$OCF_RESKEY_nfs_notify_foreground"; then opts="-d" @@ -468,18 +618,18 @@ opts="$opts -m $OCF_RESKEY_nfs_smnotify_retry_time" fi + if [ -n "$OCF_RESKEY_statd_outgoing_port" ]; then + opts="$opts -p $OCF_RESKEY_statd_outgoing_port" + fi + # forces re-notificaiton regardless if notifies have already gone out opts="$opts -f" ocf_log info "executing sm-notify" - if [ -n "$OCF_RESKEY_nfs_ip" ]; then - rm -rf $STATD_PATH/sm.ha.save > /dev/null 2>&1 - cp -rpf $STATD_PATH/sm.ha $STATD_PATH/sm.ha.save > /dev/null 2>&1 for ip in `echo ${OCF_RESKEY_nfs_ip} | sed 's/,/ /g'`; do - sm-notify $opts -v $ip -P $STATD_PATH/sm.ha - rm -rf $STATD_PATH/sm.ha > /dev/null 2>&1 - cp -rpf $STATD_PATH/sm.ha.save $STATD_PATH/sm.ha > /dev/null 2>&1 + cp -rpfn $STATD_PATH/sm.ha/* $STATD_PATH/ > /dev/null 2>&1 + sm-notify $opts -v $ip done else sm-notify $opts @@ -488,7 +638,6 @@ nfsserver_start () { - local notifies_sent=0; local rc; if nfsserver_monitor; then @@ -496,11 +645,16 @@ return $OCF_SUCCESS fi + set_env_args prepare_directory bind_tree # remove the sm-notify pid so sm-notify will be allowed to run again without requiring a reboot. rm -f /var/run/sm-notify.pid + # + # Synchronize these before starting statd + # + cp -rpfn $STATD_PATH/sm.ha/* $STATD_PATH/ > /dev/null 2>&1 rm -rf $STATD_PATH/sm.ha/* > /dev/null 2>&1 cp -rpf $STATD_PATH/sm $STATD_PATH/sm.bak /var/lib/nfs/state $STATD_PATH/sm.ha > /dev/null 2>&1 @@ -515,8 +669,6 @@ ocf_log error "Failed to start NFS server locking daemons" return $rc fi - # rpc.statd sends notifies automatically - notifies_sent=1 else ocf_log info "rpc.statd already up" fi @@ -532,11 +684,7 @@ return $rc fi - # notify peers using sm-notify if rpc.statd was already initialized. - # Otherwise the initalization of rpc.statd started sm-notify for us. - if [ $notifies_sent -eq 0 ]; then - renotify_locks - fi + notify_locks ocf_log info "NFS server started" return $OCF_SUCCESS @@ -546,6 +694,11 @@ { ocf_log info "Stopping NFS server ..." + # backup the current sm state information to the ha folder before stopping. + # the ha folder will be synced after startup, restoring the statd client state + rm -rf $STATD_PATH/sm.ha/* > /dev/null 2>&1 + cp -rpf $STATD_PATH/sm $STATD_PATH/sm.bak /var/lib/nfs/state $STATD_PATH/sm.ha > /dev/null 2>&1 + fn=`mktemp` nfs_exec stop > $fn 2>&1 rc=$? @@ -575,8 +728,9 @@ set_exec_mode check_binary ${OCF_RESKEY_nfs_notify_cmd} - if [ x = "x$OCF_RESKEY_nfs_shared_infodir" ]; then - ocf_log err "nfs_shared_infodir not set" + + if [ -n "$OCF_RESKEY_CRM_meta_clone" ] && [ -n "$OCF_RESKEY_nfs_shared_infodir" ]; then + ocf_log err "This RA does not support clone mode when a shared info directory is in use." exit $OCF_ERR_CONFIGURED fi @@ -598,11 +752,6 @@ return $OCF_SUCCESS } -if [ -n "$OCF_RESKEY_CRM_meta_clone" ]; then - ocf_log err "THIS RA DOES NOT SUPPORT CLONE MODE!" - exit $OCF_ERR_CONFIGURED -fi - nfsserver_validate case $__OCF_ACTION in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/nginx new/resource-agents-3.9.5+git453/heartbeat/nginx --- old/resource-agents-3.9.5+git432/heartbeat/nginx 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/heartbeat/nginx 2014-07-07 17:52:51.000000000 +0200 @@ -745,7 +745,7 @@ <content type="string" /> </parameter> -<parameter name="testconffile"> +<parameter name="test20conffile"> <longdesc lang="en"> A file which contains a more complex test configuration. Could be useful if you have to check more than one web application or in case sensitive diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/heartbeat/ocf-shellfuncs.in new/resource-agents-3.9.5+git453/heartbeat/ocf-shellfuncs.in --- old/resource-agents-3.9.5+git432/heartbeat/ocf-shellfuncs.in 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/heartbeat/ocf-shellfuncs.in 2014-07-07 17:52:51.000000000 +0200 @@ -22,7 +22,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Build version: 07aeed7c9035d8881ee2ec035054f6cb0b53e9f4 +# Build version: 9eb8c17d467e97cd9f40a36a1f15152f5ae986ad # TODO: Some of this should probably split out into a generic OCF # library for shell scripts, but for the time being, we'll just use it diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/tools/ocft/Makefile.am new/resource-agents-3.9.5+git453/tools/ocft/Makefile.am --- old/resource-agents-3.9.5+git432/tools/ocft/Makefile.am 2014-06-19 21:56:51.000000000 +0200 +++ new/resource-agents-3.9.5+git453/tools/ocft/Makefile.am 2014-07-07 17:52:51.000000000 +0200 @@ -40,6 +40,7 @@ oracle \ drbd.linbit \ exportfs \ + exportfs-multidir \ nfsserver \ portblock \ iscsi \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resource-agents-3.9.5+git432/tools/ocft/exportfs-multidir new/resource-agents-3.9.5+git453/tools/ocft/exportfs-multidir --- old/resource-agents-3.9.5+git432/tools/ocft/exportfs-multidir 1970-01-01 01:00:00.000000000 +0100 +++ new/resource-agents-3.9.5+git453/tools/ocft/exportfs-multidir 2014-07-07 17:52:51.000000000 +0200 @@ -0,0 +1,79 @@ +# exportfs +# +# + +CONFIG + Agent exportfs + AgentRoot /usr/lib/ocf/resource.d/heartbeat + HangTimeout 40 + +SETUP-AGENT + # nothing + +CASE-BLOCK set_testenv + Env OCF_RESKEY_directory="/usr /var" + Env OCF_RESKEY_fsid=105 + Env OCF_RESKEY_clientspec="*" + Env OCF_RESKEY_CRM_meta_timeout=30000 + +CASE-BLOCK default_status + AgentRun stop + +CASE-BLOCK prepare + Include set_testenv + Include default_status + +CASE "check base env" + Include prepare + AgentRun start OCF_SUCCESS + +CASE "check base env: no 'OCF_RESKEY_fsid'" + Include prepare + Env OCF_RESKEY_fsid= + AgentRun start OCF_ERR_CONFIGURED + +CASE "check base env: invalid 'OCF_RESKEY_directory'" + Include prepare + Env OCF_RESKEY_directory=/no_such + AgentRun start OCF_ERR_INSTALLED + +CASE "check base env: invalid 'OCF_RESKEY_fsid'" + Include prepare + Env OCF_RESKEY_fsid=root + AgentRun start OCF_ERR_CONFIGURED + +CASE "unimplemented command" + Include prepare + AgentRun no_cmd OCF_ERR_UNIMPLEMENTED + +CASE "normal start" + Include prepare + AgentRun start OCF_SUCCESS + +CASE "normal stop" + Include prepare + AgentRun start + AgentRun stop OCF_SUCCESS + +CASE "double start" + Include prepare + AgentRun start + AgentRun start OCF_SUCCESS + +CASE "double stop" + Include prepare + AgentRun stop OCF_SUCCESS + +CASE "stop with no env" + Include prepare + Env OCF_RESKEY_directory="/usr /no_such" + AgentRun stop OCF_SUCCESS + +CASE "started: monitor" + Include prepare + AgentRun start + AgentRun monitor OCF_SUCCESS + +CASE "not started: monitor" + Include prepare + AgentRun monitor OCF_NOT_RUNNING ++++++ xen-replace-xm-with-xl.patch ++++++ diff --git a/heartbeat/Xen b/heartbeat/Xen index cbc7c373bfa2..c673faa54844 100755 --- a/heartbeat/Xen +++ b/heartbeat/Xen @@ -6,7 +6,7 @@ # # Resource Agent for the Xen Hypervisor. # Manages Xen virtual machine instances by -# mapping cluster resource start and stop, +# mapping cluster resource start and stop, # to Xen create and shutdown, respectively. # # usage: $0 {start|stop|status|monitor|meta-data} @@ -32,11 +32,10 @@ ####################################################################### - usage() { - cat <<-! + cat <<-END usage: $0 {start|stop|status|monitor|meta-data|validate-all} - ! + END } @@ -45,6 +44,9 @@ usage() { : ${OCF_RESKEY_allow_mem_management=0} : ${OCF_RESKEY_reserved_Dom0_memory=512} +# prefer xl +xentool=$(which xl 2> /dev/null || which xm) + meta_data() { cat <<END <?xml version="1.0"?> @@ -95,9 +97,9 @@ Name of the virtual machine. </parameter> <parameter name="shutdown_timeout"> <longdesc lang="en"> -The Xen agent will first try an orderly shutdown using xm shutdown. +The Xen agent will first try an orderly shutdown using xl shutdown. Should this not succeed within this timeout, the agent will escalate to -xm destroy, forcibly killing the node. +xl destroy, forcibly killing the node. If this is not set, it will default to two-third of the stop action timeout. @@ -119,7 +121,7 @@ without installed PV drivers. </parameter> <parameter name="allow_mem_management" unique="0" required="0"> <longdesc lang="en"> -This parameter enables dynamic adjustment of memory for start +This parameter enables dynamic adjustment of memory for start and stop actions used for Dom0 and the DomUs. The default is to not adjust memory dynamically. </longdesc> @@ -187,30 +189,30 @@ Xen_Status() { return $OCF_SUCCESS fi fi - STATUS=`xm list --long $1 2>/dev/null | grep status 2>/dev/null` + STATUS=`$xentool list --long $1 2>/dev/null | grep status 2>/dev/null` if [ "X${STATUS}" != "X" ]; then # we have Xen 3.0.4 or higher STATUS_NOSPACES=`echo "$STATUS" | awk '{ print $1,$2}'` if [ "$STATUS_NOSPACES" = "(status 2)" -o "$STATUS_NOSPACES" = "(status 1)" ]; then return $OCF_SUCCESS - else + else return $OCF_NOT_RUNNING fi else # we have Xen 3.0.3 or lower - STATUS=`xm list --long $1 2>/dev/null | grep state 2>/dev/null` + STATUS=`$xentool list --long $1 2>/dev/null | grep state 2>/dev/null` echo "${STATUS}" | grep -qs "[-r][-b][-p]---" if [ $? -ne 0 ]; then return $OCF_NOT_RUNNING else return $OCF_SUCCESS fi - + fi } # If the guest is rebooting, it may completely disappear from the -# list of defined guests, thus xm/xen-list would return with not +# list of defined guests, thus xl/xen-list would return with not # running; apparently, this period lasts only for a second or # two # If a status returns not running, then test status @@ -251,16 +253,16 @@ Xen_Adjust_Memory() { #NEWMEM=`echo "(${MAXMEM}-${OCF_RESKEY_reserved_Dom0_memory})/(${RUNCNT}+${CNTNEW})"|bc` NEWMEM=$(( (${MAXMEM} - ${OCF_RESKEY_reserved_Dom0_memory}) / (${RUNCNT} + ${CNTNEW} ) )) # do not rely on ballooning add dom0_mem=512 instead to force memory for dom0 - #xm mem-set Domain-0 ${OCF_RESKEY_reserved_Dom0_memory} + #$xentool mem-set Domain-0 ${OCF_RESKEY_reserved_Dom0_memory} for DOM in ${RUNNING}; do - xm mem-set ${DOM} ${NEWMEM} + $xentool mem-set ${DOM} ${NEWMEM} done ocf_log info "Adjusted memory to: $NEWMEM, for the following $RUNCNT domains: $RUNNING" fi } Xen_List_all() { - xm list | grep -v -e "Name" -e "Domain-0" | awk '{print $1}' + $xentool list | grep -v -e "Name" -e "Domain-0" | awk '{print $1}' } Xen_List_running() { ALL_DOMS=`Xen_List_all` @@ -298,7 +300,7 @@ Xen_Monitor() { } Xen_Total_Memory() { - xm info | grep "^total_memory" | awk '{print $3}' + $xentool info | grep "^total_memory" | awk '{print $3}' } Xen_Start() { @@ -316,16 +318,16 @@ Xen_Start() { Xen_Adjust_Memory 1 ocf_log info "New memory for virtual domains: ${NEWMEM}" sed -i -e "/^memory=/ s/^memory=.*/memory=${NEWMEM}/" ${OCF_RESKEY_xmfile} - xm mem-set ${DOMAIN_NAME} ${NEWMEM} + $xentool mem-set ${DOMAIN_NAME} ${NEWMEM} fi - xm create ${OCF_RESKEY_xmfile} name=$DOMAIN_NAME + $xentool create ${OCF_RESKEY_xmfile} name=$DOMAIN_NAME rc=$? if [ $rc -ne 0 ]; then return $OCF_ERR_GENERIC - else + else if ocf_is_true "${OCF_RESKEY_allow_mem_management}"; then - xm mem-set ${DOMAIN_NAME} ${NEWMEM} + $xentool mem-set ${DOMAIN_NAME} ${NEWMEM} fi fi while sleep 1; do @@ -350,18 +352,18 @@ xen_domain_stop() { if [ "$timeout" -gt 0 ]; then ocf_log info "Xen domain $dom will be stopped (timeout: ${timeout}s)" if ocf_is_true "${OCF_RESKEY_shutdown_acpi}"; then - xm trigger $dom power + $xentool trigger $dom power else - xm shutdown $dom + $xentool shutdown $dom fi - + while Xen_Status $dom && [ "$timeout" -gt 0 ]; do ocf_log debug "$dom still not stopped. Waiting..." timeout=$((timeout-1)) sleep 1 done fi - + if [ "$timeout" -eq 0 ]; then while Xen_Status $dom; do ocf_log warn "Xen domain $dom will be destroyed!" @@ -369,7 +371,7 @@ xen_domain_stop() { sleep 1 done # Note: This does not give up. stop isn't allowed to to fail. - # If xm destroy fails, stop will eventually timeout. + # If $xentool destroy fails, stop will eventually timeout. # This is the correct behaviour. fi @@ -381,18 +383,18 @@ Xen_Stop() { if Xen_Status_with_Retry ${DOMAIN_NAME}; then vm=${DOMAIN_NAME} elif Xen_Status migrating-${DOMAIN_NAME}; then - ocf_log info "Xen domain $DOMAIN_NAME is migrating" + ocf_log info "Xen domain $DOMAIN_NAME is migrating" vm="migrating-${DOMAIN_NAME}" else - ocf_log info "Xen domain $DOMAIN_NAME already stopped." + ocf_log info "Xen domain $DOMAIN_NAME already stopped." fi if [ "$vm" ]; then xen_domain_stop $vm else - # It is supposed to be gone, but there have been situations where xm - # list / xen-list showed it as stopped but it was still instantiated. - # Nuke it once more to make sure: + # It is supposed to be gone, but there have been situations where + # $xentool list / xen-list showed it as stopped but it was still + # instantiated. Nuke it once more to make sure: $xenkill ${DOMAIN_NAME} fi @@ -404,10 +406,10 @@ Xen_Migrate_To() { target_node="$OCF_RESKEY_CRM_meta_migrate_target" target_attr="$OCF_RESKEY_node_ip_attribute" target_addr="$target_node" - + if Xen_Status ${DOMAIN_NAME}; then - ocf_log info "$DOMAIN_NAME: Starting xm migrate to $target_node" - + ocf_log info "$DOMAIN_NAME: Starting $xentool migrate to $target_node" + if [ -n "$target_attr" ]; then nodevalue=`crm_attribute --type nodes --node-uname $target_node --attr-name $target_attr --get-value -q` if [ -n "${nodevalue}" -a "${nodevalue}" != "(null)" ]; then @@ -416,15 +418,18 @@ Xen_Migrate_To() { fi fi - xm migrate --live $DOMAIN_NAME $target_addr - + if [[ "$xentool" == *xm ]]; then + $xentool migrate --live $DOMAIN_NAME $target_addr + else + $xentool migrate $DOMAIN_NAME $target_addr + fi rc=$? if [ $rc -ne 0 ]; then - ocf_log err "$DOMAIN_NAME: xm migrate to $target_node failed: $rc" + ocf_log err "$DOMAIN_NAME: $xentool migrate to $target_node failed: $rc" return $OCF_ERR_GENERIC - else + else Xen_Adjust_Memory 0 - ocf_log info "$DOMAIN_NAME: xm migrate to $target_node succeeded." + ocf_log info "$DOMAIN_NAME: $xentool migrate to $target_node succeeded." return $OCF_SUCCESS fi else @@ -495,19 +500,19 @@ else DOMAIN_NAME=${DOMAIN_NAME:-${OCF_RESOURCE_INSTANCE}} fi -for binary in xm sed awk; do +for binary in sed awk; do check_binary $binary done if have_binary xen-destroy ; then xenkill="xen-destroy" else - xenkill="xm destroy" + xenkill="$xentool destroy" fi if [ -n "$OCF_RESKEY_shutdown_timeout" ]; then ocf_is_decimal "$OCF_RESKEY_shutdown_timeout" || { - ocf_log err "shutdown_timeout must be a number" + ocf_log err "shutdown_timeout must be a number" exit $OCF_ERR_CONFIGURED } fi -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
