On Tue, 2015-11-17 at 02:14 +0000, Hu, Robert wrote:
> > -----Original Message-----
> > From: Ian Jackson [mailto:ian.jack...@eu.citrix.com]
> > Sent: Monday, November 16, 2015 11:21 PM
> > To: xen-de...@lists.xenproject.org
> > Cc: Ian Campbell <ian.campb...@citrix.com>; Ian Jackson
> > <ian.jack...@eu.citrix.com>; Ian Jackson <ian.jack...@eu.citrix.com>;
> > Hu,
> > Robert <robert...@intel.com>
> > 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.jack...@eu.citrix.com>
> > CC: Robert Ho <robert...@intel.com>
> > ---
> >  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?

It can happen through the recursion in the line below. i.e. this is a bit
like the NULL terminator at the end of a linked list.

> 
> > +    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@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to