@@ -261,10 +261,40 @@ 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 ||:
+ )
+END
+}
+
+sub extract_logs_guest ($) {
+ my ($gho) = @_;
+ if (!eval {
+ guest_find_lv($gho);
+ target_cmd_root($ho, "umount /mnt ||:");
+ target_cmd_root($ho, "mount -r ".$gho->{Lvdev}." /mnt");
+ try_fetch_logs($ho, \@general_logs, '/mnt', "$gho->{Guest}-");
+ target_cmd_root($ho, "umount /mnt ||:");
+ 1;
+ }) {
+ logm("failure extracting logs out of guest fs: $@");
+ }
+}
+
power_state($ho,1);
find_guests();
fetch_xenctx_guest($_) foreach @guests;
serial_fetch_logs($ho);
fetch_logs_host();
fetch_logs_guest($_) foreach @guests;
+shutdown_guests();
+extract_logs_guest($_) foreach @allguests;
logm("logs captured to $stash");
This involves shutting the guests down. We use this shell rune because xl doesn't provide a good way to ensure there are no guests running. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> --- ts-logs-capture | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)