|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] [RFC] Fix RegEx Issues with xendomains for both SXP and JSON outputs of lx list -l
(Resent, as Yahoo seems to silently drop sentemail with the subject starting
with a square open bracket. Space inserted - apologies if received more than
once)
Modifications to xendomains so that it correctly identifies a new domain
entry when parsing the output of xl list -l. For both SXP and JSON
outputs, it was failing to spot a new domain entry and was saving the
second domain under a filename generated from the first domain's name.
I have listed this as RFC because although it is a patch against 4.3RC5,
I have not had a chance to test against RC5, only 4.2.2. I won't get an
opportunity until the weekend, so I invite comment and anybody to give
it a test against RC5. Ian C has already commented elsewhere that the xl
list -l JSON output has been altered between 4.2.x and 4.3RC5, so this
might affect the indentation (the 4 spaces in the middle of the
LIST_GREP variable) - the trigger for new domain data is ' {' in JSON
version (in at least 4.2.2) and '(domain' in SXP version. Not tested
against xm.
It seems there is a problem in 4.2.2's implementation of SXP output of
xl list -l in that all domain ID's are outputted as -1. Ian C suggested
applying a change that originally went into 4.3 to resolve this issue.
This seemed to do the trick (see thread [Xen-users] DomU
suspension/hibernation )
Thanks to David Sutton for tracking through the issues with me and Ian C
for guidance and assistance.
Signed-off-by: Ian Murray <murrayie@xxxxxxxxxxx>
diff --git a/tools/hotplug/Linux/init.d/xendomains
b/tools/hotplug/Linux/init.d/xendomains
index 730541e..38371af 100644
--- a/tools/hotplug/Linux/init.d/xendomains
+++ b/tools/hotplug/Linux/init.d/xendomains
@@ -206,7 +206,7 @@ rdnames()
done
}
-LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'
+LIST_GREP='(domain\|(domid\|(name\|^ {$\|"name":\|"domid":'
parseln()
{
if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
@@ -237,7 +237,7 @@ is_running()
RC=0
;;
esac
- done < <($CMD list -l | grep $LIST_GREP)
+ done < <($CMD list -l | grep "$LIST_GREP")
return $RC
}
@@ -319,7 +319,7 @@ all_zombies()
if test "$state" != "-b---d" -a "$state" != "-----d"; then
return 1;
fi
- done < <($CMD list -l | grep $LIST_GREP)
+ done < <($CMD list -l | grep "$LIST_GREP")
return 0
}
@@ -450,7 +450,7 @@ stop()
fi
kill $WDOG_PID >/dev/null 2>&1
fi
- done < <($CMD list -l | grep $LIST_GREP)
+ done < <($CMD list -l | grep "$LIST_GREP")
# NB. this shuts down ALL Xen domains (politely), not just the ones in
# AUTODIR/*
@@ -487,7 +487,7 @@ check_domain_up()
return 0
;;
esac
- done < <($CMD list -l | grep $LIST_GREP)
+ done < <($CMD list -l | grep "$LIST_GREP")
return 1
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |