ready to trigger importDomain()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-31 17:00:34 -05:00
parent b28ae96cd4
commit 3562fc780e
1 changed files with 23 additions and 17 deletions

40
poll.go
View File

@ -36,15 +36,18 @@ func (h *HyperT) pollHypervisor() {
if state == "OFF" { if state == "OFF" {
d := me.cluster.FindDropletByName(name) d := me.cluster.FindDropletByName(name)
if d == nil { if d == nil {
log.Log(WARN, "locally defined domain:", h.pb.Hostname, fields) log.Log(WARN, "local", h.pb.Hostname, name, "locally defined domain")
log.Log(WARN, "neeed to add a local droplet protobuf") log.Log(WARN, "local", h.pb.Hostname, name, "Running AddDropletLocal()")
log.Log(WARN, "local", h.pb.Hostname, name, "Running AddDropletLocal()")
log.Log(WARN, "local", h.pb.Hostname, name, "Running AddDropletLocal()")
me.cluster.AddDropletLocal(name, h.pb.Hostname) me.cluster.AddDropletLocal(name, h.pb.Hostname)
return return
} }
if d.LocalOnly == "" { if d.LocalOnly == "" {
log.Log(WARN, "ready to import", d.Hostname, "from", h.pb.Hostname) log.Log(WARN, "local", h.pb.Hostname, name, "duplicate defined (need to resolve this)")
continue
} }
log.Log(WARN, "duplicate local droplet", h.pb.Hostname, fields, "need to resolve this") log.Log(WARN, "local", h.pb.Hostname, name, "ready to import from hypervisor")
continue continue
} }
h.lastDroplets[name] = time.Now() h.lastDroplets[name] = time.Now()
@ -156,23 +159,16 @@ func uptimeCheck() (bool, string) {
continue continue
} }
dur := time.Since(d.Current.LastPoll.AsTime()) // Calculate the elapsed time dur := time.Since(d.Current.LastPoll.AsTime()) // Calculate the elapsed time
if d.Current.State == pb.DropletState_UNKNOWN {
// log.Info("SKIP. hostname has not been polled yet", d.Hostname, d.hname)
unknown += 1
unknownList = append(unknownList, d.Hostname)
continue
}
var hname string var hname string
if d.Current.Hypervisor != "" { if d.Current.Hypervisor != "" {
hname = d.Current.Hypervisor hname = d.Current.Hypervisor
} }
if d.Current.State != pb.DropletState_ON { switch d.Current.State {
log.Info("BAD STATE", d.StartState, d.Hostname, hname, "Current.State =", d.Current.State, shell.FormatDuration(dur)) case pb.DropletState_UNKNOWN:
good = false // log.Info("SKIP. hostname has not been polled yet", d.Hostname, d.hname)
failed += 1 unknown += 1
missing = append(missing, d) unknownList = append(unknownList, d.Hostname)
} else { case pb.DropletState_ON:
dur := time.Since(d.Current.LastPoll.AsTime()) // Calculate the elapsed time
if dur > me.missingDropletTimeout { if dur > me.missingDropletTimeout {
log.Info("GOOD STATE MISSING", d.Hostname, hname, shell.FormatDuration(dur)) log.Info("GOOD STATE MISSING", d.Hostname, hname, shell.FormatDuration(dur))
good = false good = false
@ -188,6 +184,16 @@ func uptimeCheck() (bool, string) {
} }
working += 1 working += 1
// log.Info("GOOD STATE ON", d.Hostname, d.hname, "dur =", l) // log.Info("GOOD STATE ON", d.Hostname, d.hname, "dur =", l)
case pb.DropletState_OFF:
log.Info("OFF STATE", d.StartState, d.Hostname, hname, shell.FormatDuration(dur))
good = false
failed += 1
// missing = append(missing, d)
default:
log.Info("WTF STATE", d.StartState, d.Hostname, hname, "Current.State =", d.Current.State, shell.FormatDuration(dur))
good = false
failed += 1
missing = append(missing, d)
} }
} }
var summary string = "(" var summary string = "("