diff --git a/http.go b/http.go index 2f4c688..fb697ff 100644 --- a/http.go +++ b/http.go @@ -57,19 +57,19 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } - if route == "/create" { - log.Info("virtigo create starts here") - fmt.Fprintln(w, "virtigo create starts here") + if route == "/import" { + log.Info("virtigo import starts here") + fmt.Fprintln(w, "virtigo import starts here") result, err := create(w, r) if err != nil { - log.Info("virtigo create failed") + log.Info("virtigo import failed") log.Info(result) - fmt.Fprintln(w, "virtigo create failed") + fmt.Fprintln(w, "virtigo import failed") fmt.Fprintln(w, result) return } - log.Info("virtigo create ends here") - fmt.Fprintln(w, "virtigo create ends here") + log.Info("virtigo import ends here") + fmt.Fprintln(w, "virtigo import ends here") return } diff --git a/poll.go b/poll.go index dc5235f..8a0727c 100644 --- a/poll.go +++ b/poll.go @@ -28,13 +28,18 @@ func (h *HyperT) pollHypervisor() { } fields := strings.Fields(line) if len(fields) < 2 { - log.Log(WARN, "locally defined:", h.pb.Hostname, fields) + log.Log(WARN, "unknown:", h.pb.Hostname, fields) continue } state := fields[0] name := fields[1] if state == "OFF" { - log.Log(WARN, "locally defined:", h.pb.Hostname, fields) + d := me.cluster.FindDropletByName(name) + if d == nil { + log.Log(WARN, "locally defined:", h.pb.Hostname, fields, "not imported") + } else { + log.Log(WARN, "locally defined:", h.pb.Hostname, fields, d.Hostname) + } // skip locally defined libvirt vms continue } diff --git a/validate.go b/validate.go index ac2712d..a822dd0 100644 --- a/validate.go +++ b/validate.go @@ -223,7 +223,14 @@ func ValidateDroplets() (map[string]string, map[string]string, error) { // UUID already exists log.Info("duplicate UUID", d.Uuid, umap[d.Uuid]) log.Info("duplicate UUID", d.Uuid, d.Hostname) - return umap, macs, errors.New("duplicate UUID: " + d.Uuid) + if d.Archive == nil { + d.Archive = new(pb.Archive) + log.Info("d.Archive was nil for", d.Hostname) + // os.Exit(-1) + } + d.Archive.Reason = pb.DropletArchive_DUP + continue + // return umap, macs, errors.New("duplicate UUID: " + d.Uuid) } umap[d.Uuid] = d.Hostname @@ -288,7 +295,7 @@ func ValidateDroplet(check *pb.Droplet) error { os.Exit(-1) } d.Archive.Reason = pb.DropletArchive_DUP - return errors.New("duplicate UUID: " + d.Uuid) + // return errors.New("duplicate UUID: " + d.Uuid) } }