Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > e536fc0c6270ec1d92a0fd41bb1f8360 > files > 6

rgmanager-2.0.52-28.el5_8.2.src.rpm

From 3bcd3e1017cf489c9baa6d6fb7d16a43862f22df Mon Sep 17 00:00:00 2001
From: Lon Hohberger <lhh@redhat.com>
Date: Mon, 30 Nov 2009 17:29:02 -0500
Subject: [PATCH] resource-agents: Fix vm.sh 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.

Resolves: rhbz#499835

Part 2 of 2

Signed-off-by: Lon Hohberger <lhh@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 08c4d28..14978fc 100755
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -928,7 +928,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
-- 
1.6.2.5