# HG changeset patch
# User Dag Stenstad <[email protected]>
# Date 1272974595 -7200
# Node ID a5d8bc63cb5f1d429d6aa5dc70699582aeeaf6dd
# Parent 0cc47d6fac9755c537ee12eff7e4143ec048940b
Low: RA: VirtualDomain: Add support for a stopped libvirtd, loop till socket is
available.
diff -r 0cc47d6fac97 -r a5d8bc63cb5f heartbeat/VirtualDomain
--- a/heartbeat/VirtualDomain Sat May 01 02:49:34 2010 +0200
+++ b/heartbeat/VirtualDomain Tue May 04 14:03:15 2010 +0200
@@ -141,13 +141,17 @@ VirtualDomain_Define() {
# from the config file. You have been warned.
if [ -z "$DOMAIN_NAME" ]; then
# Spin until we have a domain name
- while true; do
+ COUNTER=0
+ while [ $COUNTER -lt 100Â ]; do
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
+ let COUNTER=COUNTER+1
done
echo "$domain_name" > $STATEFILE
ocf_log info "Domain name \"$domain_name\" saved to $STATEFILE."
@@ -420,6 +424,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/