From 7a0edfbe7c3703a0bf48f01dd818173a68a8f747 Mon Sep 17 00:00:00 2001 From: Greg Steuck Date: Sun, 2 Dec 2018 05:22:10 -0800 Subject: vm/gce: use openbsd console diagnostic code for both vmm and gce * openbsd: use console diagnostic code for both vmm and gce. * gometalinter wants less indentation and more stuff in scope * Comment no longer applies --- vm/vmimpl/openbsd.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 vm/vmimpl/openbsd.go (limited to 'vm/vmimpl/openbsd.go') diff --git a/vm/vmimpl/openbsd.go b/vm/vmimpl/openbsd.go new file mode 100644 index 000000000..79132ebf8 --- /dev/null +++ b/vm/vmimpl/openbsd.go @@ -0,0 +1,27 @@ +package vmimpl + +import ( + "io" + "time" +) + +// DiagnoseOpenBSD sends the debug commands to the given writer which +// is expected to be connected to a paniced openbsd kernel. If kernel +// just hanged, we've lost connection or detected some non-panic +// error, console still shows normal login prompt. +func DiagnoseOpenBSD(w io.Writer) bool { + commands := []string{ + "", + "set $lines = 0", // disable pagination + "show panic", + "trace", + "show registers", + "show proc", + "ps", + } + for _, c := range commands { + w.Write([]byte(c + "\n")) + time.Sleep(1 * time.Second) + } + return true +} -- cgit mrf-deployment