From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Hu, Robert" Subject: Re: [OSSTEST PATCH 1/2] Nested hosts: Provide hostnamepath and hostnamepath_list Date: Tue, 17 Nov 2015 02:14:30 +0000 Message-ID: <9E79D1C9A97CFD4097BCE431828FDD310238F244@SHSMSX103.ccr.corp.intel.com> References: <22089.62523.390831.567056@mariner.uk.xensource.com> <1447687244-16230-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZyVna-000766-1P for xen-devel@lists.xenproject.org; Tue, 17 Nov 2015 02:15:10 +0000 In-Reply-To: <1447687244-16230-1-git-send-email-ian.jackson@eu.citrix.com> Content-Language: en-US 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 , "xen-devel@lists.xenproject.org" Cc: Ian Campbell List-Id: xen-devel@lists.xenproject.org > -----Original Message----- > From: Ian Jackson [mailto:ian.jackson@eu.citrix.com] > Sent: Monday, November 16, 2015 11:21 PM > To: xen-devel@lists.xenproject.org > Cc: Ian Campbell ; Ian Jackson > ; Ian Jackson ; Hu, > Robert > Subject: [OSSTEST PATCH 1/2] Nested hosts: Provide hostnamepath and > hostnamepath_list > > This can (and often should) be used to replace $ho->{Name}. > > For an L0 host it returns "$ho->{Name}", ie HOST. > > For a plain guest or L1 guest it returns > "$ho->{Host}{Name}_$ho->{Name}", ie HOST_GUEST or HOST_L1. > > For an L2 guest it recurses further, giving HOST_L1_L2. > > Signed-off-by: Ian Jackson > CC: Robert Ho > --- > Osstest/TestSupport.pm | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm > index 6be50e3..47b3e6f 100644 > --- a/Osstest/TestSupport.pm > +++ b/Osstest/TestSupport.pm > @@ -70,6 +70,7 @@ BEGIN { > > selecthost get_hostflags get_host_property > get_target_property > get_host_native_linux_console > + hostnamepath hostnamepath_list > power_state power_cycle power_cycle_sleep > serial_fetch_logs > propname_massage propname_check > @@ -1063,6 +1064,20 @@ sub get_host_method_object ($$$) { > return $mo; > } > > +sub hostnamepath_list ($); > +sub hostnamepath_list ($) { > + # returns list of guest/host names, innermost first > + my ($ho) = @_; > + return () unless $ho && $ho->{Name}; [Hu, Robert] Is the situation $ho or $ho->{Name} undefined normal? Shall we add warning here? > + return ($ho->{Name}, hostnamepath_list($ho->{Host})); > +} > + > +sub hostnamepath ($) { > + my ($ho) = @_; > + my @l = hostnamepath_list($ho); > + join '_', reverse @l; > +} > + > #---------- stashed files ---------- > > sub open_unique_stashfile ($) { > -- > 1.7.10.4