From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Hu Subject: Re: [OSSTEST PATCH 4/4] sg-run-job: Provide infrastructure for layers of nesting Date: Tue, 28 Jul 2015 14:47:06 +0800 Message-ID: <1438066026.31400.2.camel@localhost> References: <21892.2155.313678.103280@mariner.uk.xensource.com> <1435682181-11151-1-git-send-email-ian.jackson@eu.citrix.com> <1435682181-11151-5-git-send-email-ian.jackson@eu.citrix.com> Reply-To: robert.hu@intel.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZJyei-00039K-Ug for xen-devel@lists.xenproject.org; Tue, 28 Jul 2015 06:46:29 +0000 In-Reply-To: <1435682181-11151-5-git-send-email-ian.jackson@eu.citrix.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 Jackson Cc: xen-devel@lists.xenproject.org, "Ian Campbell@citrix.com" , di.zheng@intel.com List-Id: xen-devel@lists.xenproject.org On Tue, 2015-06-30 at 17:36 +0100, Ian Jackson wrote: > Provides nested-layer-descend, which can be called in an individual > test job at the appropriate point (after the L1 has been set up). > > The inner host is a guest of the outer host; powering it off means > destroying it. Putting the poweroff at this point in the loop, rather > than in per-host-finish, avoids powering off physical servers. The > use of `.' rather than `!.' for iffail means we do not power off > after failures (as we might want to preserve the state for debugging > etc). > > Signed-off-by: Ian Jackson > --- > sg-run-job | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > > diff --git a/sg-run-job b/sg-run-job > index 312b0d7..c0fbc78 100755 > --- a/sg-run-job > +++ b/sg-run-job > @@ -40,6 +40,7 @@ proc per-host-finish {} { > > proc run-job {job} { > global jobinfo builds flight ok need_xen_hosts anyfailed > + global nested_layers_hosts > > set ok 1 > set anyfailed 0 > @@ -53,6 +54,7 @@ proc run-job {job} { > set need_xen_hosts $nh > set need_build_host 0 > } > + set nested_layers_hosts {} > > catching-otherwise blocked check-not-blocked > if {!$ok} return > @@ -71,7 +73,15 @@ proc run-job {job} { > > if {$ok} { catching-otherwise fail run-job/$jobinfo(recipe) } > > - per-host-finish > + while 1 { > + per-host-finish > + > + if {![llength nested_layers_hosts]} break The can-not-return issue roots here, [llength nested_layers_hosts] returns 1, while initially you've set it to blank list. Strange. > + > + per-host-ts . = final-poweroff {ts-host-powercycle --power=0} > + > + set need_xen_hosts [lunappend nested_layers_hosts] > + } > > if {$need_build_host && $anyfailed} { > run-ts !broken capture-logs ts-logs-capture + host > @@ -246,6 +256,15 @@ proc per-host-ts {iffail ident script args} { > } > } > > +proc nested-layer-descend {nested_hosts} { > + # We save need_xen_hosts on a stack in nested_layers_hosts > + # It gets popped again during the cleanup part of run-job > + global nested_layers_hosts need_xen_hosts > + lappend nested_layers_hosts $need_xen_hosts > + set need_xen_hosts $nested_hosts > + per-host-prep > +} > + > #---------- test recipes ---------- > > proc need-hosts/test-debian-nomigr {} { return host }