]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
ts-logs-capture: Actually do hard host reboot sometimes
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 1 Oct 2015 10:55:47 +0000 (11:55 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 2 Oct 2015 10:34:15 +0000 (11:34 +0100)
The logic in try_fetch_logs for setting $ok was wrong.  $ok would be
set if we reached the end of any outer (pattern) loop iteration.  If
the host is actually dead all the pattern expansions would fail, but
some of the patterns are literals and do not need expansion.  The
inner (logfile) loop would say `next' if the logfile fetch failed, but
that just goes onto the next logfile.  So this code would always set
$ok.

Instead, set $ok to 1 when we successfuly fetch any logfile or
successfully expanded any pattern (even if it didn't match any files).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
ts-logs-capture

index b99b1dbbd37799ed5c2df5da8e1fb08ad0491339..ab6750d62eb8d0cee2915311934be01f2f26ffb7 100755 (executable)
@@ -78,6 +78,8 @@ END
                 logm("logfile $logfilepat pattern expansion failed: $@");
                 next;
             }
+            logm("at least one pattern expansion succeeded") if !$ok;
+            $ok= 1;
             next if $logfileslist eq $logfilepat;
         }
         foreach my $logfile (split / /, $logfileslist) {
@@ -97,8 +99,9 @@ END
                 logm("logfile $logfile fetch failed: $@");
                 next;
             }
+            logm("at least one logfile fetched") if !$ok;
+            $ok= 1;
         }
-        $ok= 1;
     }
     return $ok;
 }