make an event for droplet moving hypervisors

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-28 05:07:56 -05:00
parent 8fc2fbd9c9
commit 3f7171fff2
1 changed files with 8 additions and 0 deletions

View File

@ -77,9 +77,17 @@ func (h *HyperT) pollHypervisor() {
continue continue
} }
// if this is blank, the droplet has probably never booted yet
if d.CurrentHypervisor == "" {
d.CurrentHypervisor = h.pb.Hostname
continue
}
// this means the droplet has moved // this means the droplet has moved
if d.CurrentHypervisor != h.pb.Hostname { if d.CurrentHypervisor != h.pb.Hostname {
log.Log(EVENT, "droplet", d.Hostname, "moved to", h.pb.Hostname) log.Log(EVENT, "droplet", d.Hostname, "moved to", h.pb.Hostname)
// record the droplet migrated (or booted somewhere else? recording this is a work in progress)
me.cluster.DropletMoved(d, h.pb)
continue continue
} }
d.CurrentHypervisor = h.pb.Hostname d.CurrentHypervisor = h.pb.Hostname