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

[Xen-devel] [OSSTEST PATCH 6/6] ts-logs-capture: Fish some logs out of guest filesystem



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@xxxxxxxxxxxxx>
---
 ts-logs-capture | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/ts-logs-capture b/ts-logs-capture
index 6be77676..c67856cd 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -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");
-- 
2.11.0




 


Rackspace

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