continuing work on tracking droplet state
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
de5f5c6a85
commit
c12d3a2dbb
2
dump.go
2
dump.go
|
@ -38,7 +38,7 @@ func dumpDroplets(w http.ResponseWriter) {
|
||||||
}
|
}
|
||||||
arp := strings.Join(macs, " ")
|
arp := strings.Join(macs, " ")
|
||||||
if d.CurrentState == pb.DropletState_ON {
|
if d.CurrentState == pb.DropletState_ON {
|
||||||
fmt.Fprintln(w, i, "droplet:", arp, d.Hostname, d.StartState, d.CurrentState)
|
fmt.Fprintln(w, i, "droplet:", arp, d.Hostname, d.StartState, d.CurrentState, d.CurrentHypervisor)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if d.StartState == pb.DropletState_ON {
|
if d.StartState == pb.DropletState_ON {
|
||||||
|
|
29
poll.go
29
poll.go
|
@ -96,16 +96,27 @@ func (h *HyperT) pollHypervisor() {
|
||||||
for name, t := range h.lastDroplets {
|
for name, t := range h.lastDroplets {
|
||||||
dur := time.Since(t)
|
dur := time.Since(t)
|
||||||
if dur > me.hyperPollDelay {
|
if dur > me.hyperPollDelay {
|
||||||
log.Info("droplet has probably powered down", name)
|
|
||||||
d := findDroplet(name)
|
d := findDroplet(name)
|
||||||
if d != nil {
|
if d == nil {
|
||||||
if d.CurrentState != pb.DropletState_UNKNOWN {
|
log.Info("droplet has probably powered down", name, "but findDroplet returned nil")
|
||||||
d.CurrentState = pb.DropletState_UNKNOWN
|
// should delete this from h.lastDroplets
|
||||||
log.Info("set state UNKNOWN here", name)
|
continue
|
||||||
} else {
|
}
|
||||||
if dur > time.Minute {
|
// everthing below here is dumb and needs to be rethought
|
||||||
log.Info("UNKNOWN state for more than one minute remove map entry here?", name)
|
if d.CurrentState != pb.DropletState_UNKNOWN {
|
||||||
}
|
d.CurrentState = pb.DropletState_UNKNOWN
|
||||||
|
log.Info("set state UNKNOWN here", name)
|
||||||
|
}
|
||||||
|
if d.CurrentState == pb.DropletState_UNKNOWN {
|
||||||
|
if dur > time.Minute*2 {
|
||||||
|
// what this means is the droplet probably wasn't migrated or the migrate failed
|
||||||
|
// where should this be checked? the status needs to be changed to OFF
|
||||||
|
log.Info("UNKNOWN state for more than one minute remove map entry here?", name)
|
||||||
|
|
||||||
|
// it might be safe to set the status to OFF here. not really. this poll needs
|
||||||
|
// to be moved somewhere else. there needs to be a new goroutine not tied to the
|
||||||
|
// hypervisor
|
||||||
|
d.CurrentState = pb.DropletState_OFF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue