resource-agents: master - vm.sh: Fix migration failure handling

Lon Hohberger lon at fedoraproject.org
Mon Nov 30 22:30:54 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a=commitdiff;h=ba998d71e22a688170c9c30b0b889b92c141e997
Commit:        ba998d71e22a688170c9c30b0b889b92c141e997
Parent:        c2f808b226f1e0a8d5a866a3c1c43bd62a51d0e5
Author:        Lon Hohberger <lhh at redhat.com>
AuthorDate:    Mon Nov 30 17:29:02 2009 -0500
Committer:     Lon Hohberger <lhh at redhat.com>
CommitterDate: Mon Nov 30 17:29:02 2009 -0500

vm.sh: Fix migration failure handling

If a VM fails to migrate, there is a good chance that
the VM is still running locally.  Return a non-fatal
error so that the resource does not enter the failed
state.

Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
 rgmanager/src/resources/vm.sh |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index df56140..9f8647a 100644
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -931,7 +931,23 @@ case $1 in
 	migrate)
 		validate_all || exit $OCF_ERR_ARGS
 		migrate $2 # Send VM to this node
-		exit $?
+		rv=$?
+		if [ $rv -eq $OCF_ERR_GENERIC ]; then
+			# Catch-all: If migration failed with
+			# an unhandled error, do a status check
+			# to see if the VM is really dead.
+			#
+			# If the VM is still in good health, return
+			# a value to rgmanager to indicate the 
+			# non-critical error
+			#
+			# XXX Is OCF_ERR_CONFIGURED the right value?
+			do_status > /dev/null
+			if [ $? -eq 0 ]; then
+				rv=$OCF_ERR_CONFIGURED
+			fi
+		fi
+		exit $rv
 		;;
 	reload)
 		exit 0


More information about the cluster-commits mailing list