Skip to content

Commit

Permalink
Medium: RA: VirtualDomain: spin on define until we definitely have a …
Browse files Browse the repository at this point in the history
…domain name

Under some circumstances, we would record an empty domain name to the
state file, prompting us to bail out later on. Now instead, keep
trying until we get an non-empty reply for the domain name.
  • Loading branch information
Florian Haas committed Mar 31, 2010
1 parent 25b82ca commit b3e1cde
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions heartbeat/VirtualDomain
Expand Up @@ -126,8 +126,15 @@ VirtualDomain_Define() {
# in production, instead let the script figure out the domain name
# from the config file. You have been warned.
if [ -z "$DOMAIN_NAME" ]; then
virsh_output=`virsh ${VIRSH_OPTIONS} define ${OCF_RESKEY_config}`
domain_name=`echo "$virsh_output" | sed -e 's/Domain \(.*\) defined from .*$/\1/'`
# Spin until we have a domain name
while true; 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;
fi
sleep 1
done
echo "$domain_name" > $STATEFILE
ocf_log info "Domain name \"$domain_name\" saved to $STATEFILE."
else
Expand Down

0 comments on commit b3e1cde

Please sign in to comment.