summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poll.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/poll.go b/poll.go
index 3fb7f5d..b575889 100644
--- a/poll.go
+++ b/poll.go
@@ -108,26 +108,35 @@ func (h *HyperT) pollHypervisor() {
d.Current.Hypervisor = h.pb.Hostname
}
}
+
+ // these are the droplets that don't exist anymore on this hypervisor
+ // this should mean you ran shutdown within domU
for name, t := range h.lastDroplets {
dur := time.Since(t)
if dur > me.hyperPollDelay {
d := me.cluster.FindDropletByName(name)
+ header := d.SprintHeader()
if d == nil {
- log.Info("droplet has probably powered down", name, "but findDroplet returned nil")
+ log.Info(header, "droplet has probably powered down", name, "but findDroplet returned nil")
// should delete this from h.lastDroplets
continue
}
+ if d.Current.State == pb.DropletState_OFF {
+ log.Info(header, "droplet timed out and is off. remove from h.lastDroplets[] slice")
+ continue
+ }
+
// everthing below here is dumb and needs to be rethought
if d.Current.State != pb.DropletState_UNKNOWN {
d.SetState(pb.DropletState_UNKNOWN)
- log.Info("set state UNKNOWN here", name)
+ log.Info(header, "set state UNKNOWN here", name)
}
if d.Current.State == 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
s := pb.FormatDuration(dur)
- log.Info("UNKNOWN state for more than 2 minutes (clearing out ?)", name, s)
+ log.Info(header, "UNKNOWN state for more than 2 minutes (clearing out ?)", name, s)
// 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