[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [OSSTEST PATCH 1/2] Nested hosts: Provide hostnamepath and hostnamepath_list
> -----Original Message----- > From: Ian Jackson [mailto:ian.jackson@xxxxxxxxxxxxx] > Sent: Monday, November 16, 2015 11:21 PM > To: xen-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>; Ian Jackson > <ian.jackson@xxxxxxxxxxxxx>; Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>; Hu, > Robert <robert.hu@xxxxxxxxx> > 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 <Ian.Jackson@xxxxxxxxxxxxx> > CC: Robert Ho <robert.hu@xxxxxxxxx> > --- > 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |