From: Ian Murray Subject: Re: [PATCH] [RFC] Fix RegEx Issues with xendomains for both SXP and JSON outputs of lx list -l Date: Tue, 25 Jun 2013 11:56:25 +0100 (BST) Message-ID: <1372157785.23828.YahooMailNeo@web171306.mail.ir2.yahoo.com> References: <51C22E81.1010902@yahoo.co.uk> <1371717529.84197.YahooMailNeo@web171304.mail.ir2.yahoo.com> <1371726771.98221.YahooMailNeo@web171306.mail.ir2.yahoo.com> <1371729629.55562.YahooMailNeo@web171306.mail.ir2.yahoo.com> <1372153217.22783.201.camel@zakaz.uk.xensource.com> Reply-To: Ian Murray Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1372153217.22783.201.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: George Dunlap , Joshua Tuttle , Ian Jackson , David Sutton , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org ----- Original Message ----- > From: Ian Campbell > To: Ian Murray > Cc: "xen-devel@lists.xen.org" ; David Sutton ; Joshua Tuttle ; George Dunlap ; Ian Jackson > Sent: Tuesday, 25 June 2013, 10:40 > Subject: Re: [PATCH] [RFC] Fix RegEx Issues with xendomains for both SXP = and JSON outputs of lx list -l > = > On Thu, 2013-06-20 at 13:00 +0100, Ian Murray wrote: >> (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) > = > How very unhelpful of them! FWIW This seems to be the first one which > made it into the list archives as well as my INBOX. > = > I'm working through my post-vacation backlog this morning but I hope to > have a chance to look at this vs. 4.3-rc soon since I think it is a > worthwhile bugfix for 4.3. George, what does your release manager's hat > think? There are white space issues with this patch on this thread as it is, so I = re-issued it more recently directly from git, as is the preferred method I = think. As was suggested by David Sutton, there are probably more issues with this = script than has been covered so far, but this change makes suspension and r= estoration work for me, at least. He suggests there are problems with zombi= es, etc. > = >> 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 '=A0 =A0 {' 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 ) > = > Would you be able to submit that backport as a patch against the 4.2 > staging branch and CC myself and Ian Jackson > ? > = > This isn't a straight forward backport, since the majority of the commit > is not a suitable candidate, but if you reference in the commit message > the original commit id/subject and point out that only the one hunk is a > useful bug fix which is why it's been split out then I think it would be > fine to have in the next 4.2 release. I'll give this a go, but it will be a learning experience. I don't recall s= eeing any backporting info in the patch submission notes but I will take an= other look. Who signs a (partial) backport off? Can't be me, because I didn= 't write it. Or can it? or is it copied from the original submission? > = > Thanks, > Ian. > = >> = >> Thanks to David Sutton for tracking through the issues with me and Ian C >> for guidance and assistance. >> = >> = >> Signed-off-by: Ian Murray >> = >> = >> 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() >> =A0 =A0 =A0 done >> =A0 } >> = >> = > -LIST_GREP=3D'((domain\|(domid\|(name\|^{$\|"name":\|"domid":' >> +LIST_GREP=3D'(domain\|(domid\|(name\|^=A0 =A0 = > {$\|"name":\|"domid":' >> =A0 parseln() >> =A0 { >> =A0 =A0 =A0 if [[ "$1" =3D~ '(domain' ]] || [[ "$1" =3D = > "{" ]]; then >> @@ -237,7 +237,7 @@ is_running() >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 RC=3D0 >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; >> =A0 =A0 =A0 =A0 esac >> -=A0 =A0 done < <($CMD list -l | grep $LIST_GREP) >> +=A0 =A0 done < <($CMD list -l | grep "$LIST_GREP") >> =A0 =A0 =A0 return $RC >> =A0 } >> = >> @@ -319,7 +319,7 @@ all_zombies() >> =A0 =A0 =A0 =A0 if test "$state" !=3D "-b---d" -a = > "$state" !=3D "-----d"; then >> =A0 =A0 =A0 =A0 =A0 =A0 return 1; >> =A0 =A0 =A0 =A0 fi >> -=A0 =A0 done < <($CMD list -l | grep $LIST_GREP) >> +=A0 =A0 done < <($CMD list -l | grep "$LIST_GREP") >> =A0 =A0 =A0 return 0 >> =A0 } >> = >> @@ -450,7 +450,7 @@ stop() >> =A0 =A0 =A0 =A0 =A0 =A0 fi >> =A0 =A0 =A0 =A0 =A0 =A0 kill $WDOG_PID >/dev/null 2>&1 >> =A0 =A0 =A0 =A0 fi >> -=A0 =A0 done < <($CMD list -l | grep $LIST_GREP) >> +=A0 =A0 done < <($CMD list -l | grep "$LIST_GREP") >> = >> =A0 =A0 =A0 # NB. this shuts down ALL Xen domains (politely), not just = the ones = > in >> =A0 =A0 =A0 # AUTODIR/* >> @@ -487,7 +487,7 @@ check_domain_up() >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0 >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; >> =A0 =A0 =A0 =A0 esac >> -=A0 =A0 done < <($CMD list -l | grep $LIST_GREP) >> +=A0 =A0 done < <($CMD list -l | grep "$LIST_GREP") >> =A0 =A0 =A0 return 1 >> =A0 } > =