Permalink
Browse files

Medium: VirtualDomain: Properly detect defined lxc domains

Defining a already defined lxc domains prints out a different
error message than kvm domains for some reason. This patch
matchs both.
  • Loading branch information...
1 parent 85960ed commit 63bcc71e3b0d89d08ebc58c62ca587e123314dbc @davidvossel davidvossel committed Feb 20, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 heartbeat/VirtualDomain
View
@@ -205,8 +205,12 @@ VirtualDomain_Define() {
if [ -z "$DOMAIN_NAME" ]; then
# 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/'`
+ virsh_output=$((virsh ${VIRSH_OPTIONS} define ${OCF_RESKEY_config}) 2>&1)
+ domain_name=`echo "$virsh_output" | sed -n -e 's/Domain \(.*\) defined from .*$/\1/p'`
+ if [ -n "$domain_name" ]; then
+ break;
+ fi
+ domain_name=`echo $virsh_output | sed -n -e "s/.* '\(.*\)' already exists .*/\1/p"`
if [ -n "$domain_name" ]; then
break;
fi

0 comments on commit 63bcc71

Please sign in to comment.