runs again

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-31 14:15:36 -05:00
parent 3c520003ed
commit b4ef8b76b1
3 changed files with 23 additions and 11 deletions

14
http.go
View File

@ -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
}

View File

@ -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
}

View File

@ -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)
}
}