@@ -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");
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@eu.citrix.com> --- ts-logs-capture | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)