# HG changeset patch
# User Dag Stenstad <[email protected]>
# Date 1273072891 -7200
# Node ID e3963c807da9552776928d6f248acb7dd01f3e81
# Parent e595bc84f537eed53edec0a908a3c411c5fecc5c
Low: RA: VirtualDomain: Add support for a stopped libvirtd, loop till socket is
available.
diff -r e595bc84f537 -r e3963c807da9 heartbeat/VirtualDomain
--- a/heartbeat/VirtualDomain Wed May 05 17:16:14 2010 +0200
+++ b/heartbeat/VirtualDomain Wed May 05 17:21:31 2010 +0200
@@ -144,7 +144,9 @@ VirtualDomain_Define() {
virsh_output=`virsh ${VIRSH_OPTIONS} define ${OCF_RESKEY_config}`
domain_name=`echo "$virsh_output" | sed -e 's/Domain \(.*\) defined
from .*$/\1/'`
if [ -n $domain_name ]; then
- break;
+ if [ x${domain_name} != "x" ] ; then
+ break;
+ fi
fi
sleep 1
done
@@ -408,7 +410,7 @@ fi
# Define the domain on startup, and re-define whenever someone deleted
# the state file, or touched the config.
-if [ ! -e $STATEFILE ] || [ $OCF_RESKEY_config -nt $STATEFILE ]; then
+if [ ! -s $STATEFILE ] || [ $OCF_RESKEY_config -nt $STATEFILE ]; then
VirtualDomain_Define
fi
# By now, we should definitely be able to read from the state file.
@@ -419,6 +421,14 @@ fi
fi
# Finally, retrieve the domain name from the state file.
DOMAIN_NAME=`cat $STATEFILE 2>/dev/null`
+
+# If statefile has a empty domain name, retry definition.
+if [ x${DOMAIN_NAME} = "x" ]; then
+ VirtualDomain_Define
+fi
+
+DOMAIN_NAME=`cat $STATEFILE 2>/dev/null`
+# If statefile still is empty, explode.
if [ -z $DOMAIN_NAME ]; then
ocf_log err "$STATEFILE is empty. This is unexpected. Cannot determine
domain name."
exit $OCF_ERR_GENERIC
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/