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

[OSSTEST PATCH 2/2] ts-logs-capture: Cope better with unbootable host (2)



shutdown_guests might conceivably fail due to a flaky host.  In that
case we want not to declare the job broken so ts-logs-capture most not
fail.  But in that case we should skip fishing in-guest logs out of
guest fs's.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 ts-logs-capture | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/ts-logs-capture b/ts-logs-capture
index 7940aece..0320a5a5 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -264,17 +264,23 @@ sub fetch_logs_guest ($) {
 }
 
 sub shutdown_guests () {
-    target_cmd_root($ho, <<'END', 180);
-        set -x
-        (
-            ( exec 2>/dev/null; sleep 30 ; echo y ) &
-            ( xl shutdown -a -F -w ; echo y ) &
-        ) | (
-            read x
-            xl list | awk '!/^Domain-0 |^Name / {print $2}' \
-            | xargs -t -r -n1 xl destroy ||:
-        )
+    if (!eval {
+       target_cmd_root($ho, <<'END', 180);
+           set -x
+           (
+               ( exec 2>/dev/null; sleep 30 ; echo y ) &
+               ( xl shutdown -a -F -w ; echo y ) &
+           ) | (
+               read x
+               xl list | awk '!/^Domain-0 |^Name / {print $2}' \
+               | xargs -t -r -n1 xl destroy ||:
+           )
 END
+    }) {
+       logm("cannot ensure no guests running, cannot fish their logs");
+       return 0;
+    }
+    return 1;
 }
 
 sub extract_logs_guest ($) {
@@ -297,7 +303,8 @@ fetch_xenctx_guest($_) foreach @guests;
 serial_fetch_logs($ho);
 if (fetch_logs_host()) {
     fetch_logs_guest($_) foreach @guests;
-    shutdown_guests();
-    extract_logs_guest($_) foreach @allguests;
+    if (shutdown_guests()) {
+       extract_logs_guest($_) foreach @allguests;
+    }
 }
 logm("logs captured to $stash");
-- 
2.11.0




 


Rackspace

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