Blame SOURCES/bz1128933-VirtualDomain-exit-reason-support.patch

c608c9
From 0501ed8086e054d9b076719c5bd131edbc95db5b Mon Sep 17 00:00:00 2001
c608c9
From: David Vossel <dvossel@redhat.com>
c608c9
Date: Fri, 1 Aug 2014 16:06:22 -0400
c608c9
Subject: [PATCH] High: VirtualDomain: exit reason support
c608c9
c608c9
---
c608c9
 heartbeat/VirtualDomain | 19 ++++++++++---------
c608c9
 1 file changed, 10 insertions(+), 9 deletions(-)
c608c9
c608c9
diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain
c608c9
index 3a6b6a9..c44c090 100755
c608c9
--- a/heartbeat/VirtualDomain
c608c9
+++ b/heartbeat/VirtualDomain
c608c9
@@ -356,7 +356,7 @@ VirtualDomain_Start() {
c608c9
 			rm -f $snapshotimage
c608c9
 			return $OCF_SUCCESS
c608c9
 		fi
c608c9
-		ocf_log error "Failed to restore ${DOMAIN_NAME} from state file in ${OCF_RESKEY_snapshot} directory."
c608c9
+		ocf_exit_reason "Failed to restore ${DOMAIN_NAME} from state file in ${OCF_RESKEY_snapshot} directory."
c608c9
 		return $OCF_ERR_GENERIC
c608c9
 	fi
c608c9
 
c608c9
@@ -371,7 +371,7 @@ VirtualDomain_Start() {
c608c9
 	virsh $VIRSH_OPTIONS create ${OCF_RESKEY_config}
c608c9
 	rc=$?
c608c9
 	if [ $rc -ne 0 ]; then
c608c9
-		ocf_log error "Failed to start virtual domain ${DOMAIN_NAME}."
c608c9
+		ocf_exit_reason "Failed to start virtual domain ${DOMAIN_NAME}."
c608c9
 		return $OCF_ERR_GENERIC
c608c9
 	fi
c608c9
 
c608c9
@@ -395,6 +395,7 @@ force_stop()
c608c9
 		*"error:"*"domain is not running"*|*"error:"*"domain not found"*)
c608c9
 			: ;; # unexpected path to the intended outcome, all is well
c608c9
 		[!0]*)
c608c9
+			ocf_exit_reason "forced stop failed"
c608c9
 			return $OCF_ERR_GENERIC ;;
c608c9
 		0*)
c608c9
 			while [ $status != $OCF_NOT_RUNNING ]; do
c608c9
@@ -525,14 +526,14 @@ VirtualDomain_Migrate_To() {
c608c9
 		virsh ${VIRSH_OPTIONS} migrate --live $DOMAIN_NAME ${remoteuri} ${migrateuri}
c608c9
 		rc=$?
c608c9
 		if [ $rc -ne 0 ]; then
c608c9
-			ocf_log err "$DOMAIN_NAME: live migration to ${remoteuri} ${migrateuri} failed: $rc"
c608c9
+			ocf_exit_reason "$DOMAIN_NAME: live migration to ${remoteuri} ${migrateuri} failed: $rc"
c608c9
 			return $OCF_ERR_GENERIC
c608c9
 		else
c608c9
 			ocf_log info "$DOMAIN_NAME: live migration to ${target_node} succeeded."
c608c9
 			return $OCF_SUCCESS
c608c9
 		fi
c608c9
 	else
c608c9
-		ocf_log err "$DOMAIN_NAME: migrate_to: Not active locally!"
c608c9
+		ocf_exit_reason "$DOMAIN_NAME: migrate_to: Not active locally!"
c608c9
 		return $OCF_ERR_GENERIC
c608c9
 	fi
c608c9
 }
c608c9
@@ -560,7 +561,7 @@ VirtualDomain_Monitor() {
c608c9
 				# A monitor script returned a non-success exit
c608c9
 				# code. Stop iterating over the list of scripts, log a
c608c9
 				# warning message, and propagate $OCF_ERR_GENERIC.
c608c9
-				ocf_log warn "Monitor command \"${script}\" for domain ${DOMAIN_NAME} returned ${script_rc} with output: ${script_output}"
c608c9
+				ocf_exit_reason "Monitor command \"${script}\" for domain ${DOMAIN_NAME} returned ${script_rc} with output: ${script_output}"
c608c9
 				rc=$OCF_ERR_GENERIC
c608c9
 				break
c608c9
 			else
c608c9
@@ -582,13 +583,13 @@ VirtualDomain_Validate_All() {
c608c9
 	done
c608c9
 
c608c9
 	if [ -z $OCF_RESKEY_config ]; then
c608c9
-		ocf_log error "Missing configuration parameter \"config\"."
c608c9
+		ocf_exit_reason "Missing configuration parameter \"config\"."
c608c9
 		return $OCF_ERR_CONFIGURED
c608c9
 	fi
c608c9
 
c608c9
 	if ocf_is_true $OCF_RESKEY_force_stop; then
c608c9
 		if [ -n "$OCF_RESKEY_snapshot" ]; then
c608c9
-			ocf_log error "The 'force_stop' and 'snapshot' options can not be used together."
c608c9
+			ocf_exit_reason "The 'force_stop' and 'snapshot' options can not be used together."
c608c9
 			return $OCF_ERR_CONFIGURED
c608c9
 		fi
c608c9
 	fi
c608c9
@@ -601,7 +602,7 @@ VirtualDomain_Validate_All() {
c608c9
 		elif [ "$__OCF_ACTION" = "stop" ]; then
c608c9
 			ocf_log info "Configuration file $OCF_RESKEY_config not readable, resource considered stopped."
c608c9
 		else
c608c9
-			ocf_log error "Configuration file $OCF_RESKEY_config does not exist or is not readable."
c608c9
+			ocf_exit_reason "Configuration file $OCF_RESKEY_config does not exist or is not readable."
c608c9
 			return $OCF_ERR_INSTALLED
c608c9
 		fi
c608c9
 	fi
c608c9
@@ -644,7 +645,7 @@ fi
c608c9
 # Retrieve the domain name from the xml file.
c608c9
 DOMAIN_NAME=`egrep '[[:space:]]*<name>.*</name>[[:space:]]*$' ${OCF_RESKEY_config} | sed -e 's/[[:space:]]*<name>\(.*\)<\/name>[[:space:]]*$/\1/' 2>/dev/null`
c608c9
 if [ -z $DOMAIN_NAME ]; then
c608c9
-	ocf_log err "This is unexpected. Cannot determine domain name."
c608c9
+	ocf_exit_reason "Unable to determine domain name."
c608c9
 	exit $OCF_ERR_GENERIC
c608c9
 fi
c608c9
 
c608c9
-- 
c608c9
1.8.4.2
c608c9