show droplet total count
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
8dc0bf6fac
commit
7cc0bd9b2c
|
@ -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
|
||||
}
|
||||
|
|
2
main.go
2
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
|
||||
|
|
16
validate.go
16
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
|
||||
|
|
Loading…
Reference in New Issue