summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.go3
-rw-r--r--main.go2
-rw-r--r--validate.go16
3 files changed, 14 insertions, 7 deletions
diff --git a/config.go b/config.go
index bbc3579..d0c5c7f 100644
--- a/config.go
+++ b/config.go
@@ -79,6 +79,7 @@ func readConfigFile(filename string) error {
log.Log(EVENT, "config new hypervisors", h.pb.Hostname)
}
+ var total int
// initialize values for each droplet
for _, pbd := range me.cluster.Droplets {
d := findDroplet(pbd.Hostname)
@@ -90,7 +91,9 @@ func readConfigFile(filename string) error {
d.pb = pbd
me.droplets = append(me.droplets, d)
log.Log(EVENT, "config new droplet", d.pb.Hostname, d.pb.StartState, d.pb.PreferredHypervisor)
+ total += 1
}
+ log.Log(EVENT, "Total Droplet count:", total)
return nil
}
diff --git a/main.go b/main.go
index 42b8950..b90ce59 100644
--- a/main.go
+++ b/main.go
@@ -50,7 +50,7 @@ func main() {
cfgfile()
// sanity check the droplets
- checkDroplets()
+ checkDroplets(false)
// ok tracks if all the libvirt xml files imported ok
var ok bool = true
diff --git a/validate.go b/validate.go
index 337422d..12370b8 100644
--- a/validate.go
+++ b/validate.go
@@ -21,7 +21,7 @@ import (
"go.wit.com/log"
)
-func checkDroplets() bool {
+func checkDroplets(dump bool) bool {
// uuid map to check for duplicates
var umap map[string]string
umap = make(map[string]string)
@@ -57,13 +57,17 @@ func checkDroplets() bool {
macs[n.Mac] = d.Uuid
}
}
+ log.Println("validated okay: no duplicate MAC addr")
+ log.Println("validated okay: no duplicate UUID")
- for u, hostname := range umap {
- log.Println("uuid:", u, "hostname:", hostname)
- }
+ if dump {
+ for u, hostname := range umap {
+ log.Println("uuid:", u, "hostname:", hostname)
+ }
- for mac, uuid := range macs {
- log.Println("mac:", mac, "uuid", uuid, "hostname:", umap[uuid])
+ for mac, uuid := range macs {
+ log.Println("mac:", mac, "uuid", uuid, "hostname:", umap[uuid])
+ }
}
return false