Blame SOURCES/bz1083041-virtual-domain-monitor-lxc-fix.patch

c608c9
From 4e2576c0b339537790e253c11d9dfcf99b7b114d Mon Sep 17 00:00:00 2001
c608c9
From: David Vossel <dvossel@redhat.com>
c608c9
Date: Tue, 1 Apr 2014 17:28:39 -0400
c608c9
Subject: [PATCH] Low: VirtualDomain: Allow monitoring of lxc domains without
c608c9
 libvirtd
c608c9
c608c9
---
c608c9
 heartbeat/VirtualDomain | 20 ++++++++++++++------
c608c9
 1 file changed, 14 insertions(+), 6 deletions(-)
c608c9
c608c9
diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain
c608c9
index b0cdd5f..692a2ef 100755
c608c9
--- a/heartbeat/VirtualDomain
c608c9
+++ b/heartbeat/VirtualDomain
c608c9
@@ -249,15 +249,17 @@ pid_status()
c608c9
 
c608c9
 	case "$emulator" in
c608c9
 		qemu-kvm|qemu-system-*)
c608c9
+			rc=$OCF_NOT_RUNNING
c608c9
 			ps awx | grep -E "[q]emu-(kvm|system).*-name $DOMAIN_NAME " > /dev/null 2>&1
c608c9
 			if [ $? -eq 0 ]; then
c608c9
-				# domain exists and is running
c608c9
-				ocf_log debug "Virtual domain $DOMAIN_NAME is currently running."
c608c9
 				rc=$OCF_SUCCESS
c608c9
-			else 
c608c9
-				# domain pid does not exist on local machine
c608c9
-				ocf_log debug "Virtual domain $DOMAIN_NAME is currently not running."
c608c9
-				rc=$OCF_NOT_RUNNING
c608c9
+			fi
c608c9
+			;;
c608c9
+		libvirt_lxc)
c608c9
+			rc=$OCF_NOT_RUNNING
c608c9
+			ps awx | grep -E "[l]ibvirt_lxc.*-name $DOMAIN_NAME " > /dev/null 2>&1
c608c9
+			if [ $? -eq 0 ]; then
c608c9
+				rc=$OCF_SUCCESS
c608c9
 			fi
c608c9
 			;;
c608c9
 		# This can be expanded to check for additional emulators
c608c9
@@ -265,6 +267,12 @@ pid_status()
c608c9
 			;;
c608c9
 	esac
c608c9
 
c608c9
+	if [ $rc -eq $OCF_SUCCESS ]; then
c608c9
+		ocf_log debug "Virtual domain $DOMAIN_NAME is currently running."
c608c9
+	elif [ $rc -eq $OCF_NOT_RUNNING ]; then
c608c9
+		ocf_log debug "Virtual domain $DOMAIN_NAME is currently not running."
c608c9
+	fi
c608c9
+
c608c9
 	return $rc
c608c9
 }
c608c9
 
c608c9
-- 
c608c9
1.8.4.2
c608c9