summaryrefslogtreecommitdiff
path: root/dump.go
diff options
context:
space:
mode:
Diffstat (limited to 'dump.go')
-rw-r--r--dump.go26
1 files changed, 25 insertions, 1 deletions
diff --git a/dump.go b/dump.go
index 1e6a596..57a3404 100644
--- a/dump.go
+++ b/dump.go
@@ -3,6 +3,9 @@ package main
import (
"fmt"
"net/http"
+ "strings"
+
+ pb "go.wit.com/lib/protobuf/virtbuf"
)
/*
@@ -11,7 +14,7 @@ import (
*/
func dumpCluster(w http.ResponseWriter) {
- umap, macs := safeValidateDroplets(me.cluster)
+ umap, macs, err := ValidateDroplets(me.cluster)
for u, hostname := range umap {
fmt.Fprintln(w, "uuid:", u, "hostname:", hostname)
}
@@ -19,4 +22,25 @@ func dumpCluster(w http.ResponseWriter) {
for mac, uuid := range macs {
fmt.Fprintln(w, "mac:", mac, "uuid", uuid, "hostname:", umap[uuid])
}
+ if err != nil {
+ fmt.Fprintln(w, "ValidateDroplets() failed:", err)
+ }
+}
+
+// list running droplets and droplets that should be running
+func dumpDroplets(w http.ResponseWriter) {
+ for i, d := range me.cluster.Droplets {
+ var macs []string
+ for _, n := range d.Networks {
+ macs = append(macs, n.Mac)
+ }
+ arp := strings.Join(macs, " ")
+ if d.CurrentState == pb.DropletState_ON {
+ fmt.Fprintln(w, i, "droplet:", arp, d.Hostname, d.StartState, d.CurrentState)
+ continue
+ }
+ if d.StartState == pb.DropletState_ON {
+ fmt.Fprintln(w, i, "droplet:", arp, d.Hostname, d.StartState, d.CurrentState, "(should be on)")
+ }
+ }
}