[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



On Tue, 2015-11-17 at 02:14 +0000, Hu, Robert wrote:
> > -----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?

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.