[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 4/7] logm: Introduce $logm_prefix, and annotate nested guest messages



This allows code elsewhere to annotate log messages which might
otherwise be confusing.  The variable should be localised, and the
value should always start with a space, if not empty.

Use this to annotate the calls to selecthost and selectguest from
within selecthost-for-an-L1.  Otherwise some of the log messages can
be very confusing.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index d0acdc6..6c08c6d 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -41,7 +41,8 @@ BEGIN {
                       tsreadconfig %r $flight $job $stash
                       ts_get_host_guest
 
-                      fail broken logm $logm_handle get_filecontents
+                      fail broken logm $logm_handle $logm_prefix
+                      get_filecontents
                       report_once
 
                       store_runvar get_runvar get_runvar_maybe
@@ -132,6 +133,7 @@ our %timeout= qw(RebootDown   100
                  HardRebootUp 600);
 
 our $logm_handle= new IO::File ">& STDERR" or die $!;
+our $logm_prefix= '';
 
 #---------- test script startup ----------
 
@@ -194,7 +196,7 @@ sub ts_get_host_guest { # pass this @ARGV
 sub logm ($) {
     my ($m) = @_;
     my @t = gmtime;
-    my $fm = (show_abs_time time)." $m\n";
+    my $fm = (show_abs_time time)."$logm_prefix $m \n";
     foreach my $h ((ref($logm_handle) eq 'ARRAY')
                   ? @$logm_handle : $logm_handle) {
        print $h $fm or die $!;
@@ -866,6 +868,7 @@ sub selecthost ($) {
 
     if ($name =~ s/^(.*)://) {
        my $parentname = $1;
+       local $logm_prefix = $logm_prefix." [host $ident]";
        my $parent = selecthost($parentname);
        my $child = selectguest($name,$parent);
        $child->{Ident} = $ho->{Ident};
-- 
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®.