From bd2ddb278c2439cb87c62766a0983bd2e1ff6a74 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 13 Nov 2024 18:53:13 -0600 Subject: [PATCH] better poll hyper output Signed-off-by: Jeff Carr --- dump.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dump.go b/dump.go index f0e1a2d..7bdd6be 100644 --- a/dump.go +++ b/dump.go @@ -6,6 +6,7 @@ import ( "time" pb "go.wit.com/lib/protobuf/virtbuf" + "go.wit.com/log" ) /* @@ -76,21 +77,17 @@ func dumpHypervisors(w http.ResponseWriter) { var totalDroplets int var totalUnknownDroplets int for _, h := range me.hypers { - // lastpoll time.Time // the last time the hypervisor polled dur := time.Since(h.lastpoll) tmp := pb.FormatDuration(dur) fmt.Fprintln(w, h.pb.Hostname, "killcount =", h.killcount, "lastpoll:", tmp) - for name, t := range h.lastDroplets { - dur := time.Since(t) - tmp := pb.FormatDuration(dur) + for name, _ := range h.lastDroplets { totalDroplets += 1 d := me.cluster.FindDropletByName(name) + header := d.SprintDumpHeader() + " " if d == nil { totalUnknownDroplets += 1 - fmt.Fprintln(w, "\t", h.pb.Hostname, "name =", name, "lastpoll:", tmp) - } else { - fmt.Fprintln(w, "\t", h.pb.Hostname, "name =", name, "lastpoll:", tmp, d.Current.State) } + log.Info("\t", header, d.Hostname) } } if totalUnknownDroplets == 0 {