2024-10-12 10:59:11 -05:00
|
|
|
package main
|
|
|
|
|
2024-10-22 17:27:24 -05:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
pb "go.wit.com/lib/protobuf/virtbuf"
|
|
|
|
)
|
2024-10-12 10:59:11 -05:00
|
|
|
|
|
|
|
var me virtigoT
|
|
|
|
|
|
|
|
// disable the GUI
|
|
|
|
func (b *virtigoT) Disable() {
|
|
|
|
// b.mainbox.Disable()
|
|
|
|
}
|
|
|
|
|
|
|
|
// enable the GUI
|
|
|
|
func (b *virtigoT) Enable() {
|
|
|
|
// b.mainbox.Enable()
|
|
|
|
}
|
|
|
|
|
|
|
|
// this app's variables
|
|
|
|
type virtigoT struct {
|
2024-10-31 13:37:00 -05:00
|
|
|
cluster *pb.NewCluster // basic cluster settings
|
|
|
|
// newc *pb.NewCluster // basic cluster settings
|
2024-10-30 18:09:54 -05:00
|
|
|
e *pb.Events // virtbuf events
|
2024-10-27 02:55:08 -05:00
|
|
|
hmap map[*pb.Hypervisor]*HyperT // map to the local struct
|
|
|
|
names []string
|
|
|
|
hypers []*HyperT
|
|
|
|
killcount int
|
|
|
|
unstable time.Time // the last time the cluster was incorrect
|
|
|
|
changed bool
|
2024-10-27 11:02:50 -05:00
|
|
|
hyperPollDelay time.Duration // how often to poll the hypervisors
|
2024-10-27 07:06:12 -05:00
|
|
|
unstableTimeout time.Duration // how long a droplet can be unstable until it's declared dead
|
2024-10-27 02:29:45 -05:00
|
|
|
clusterStableDuration time.Duration // how long the cluster must be stable before new droplets can be started
|
2024-10-27 07:06:12 -05:00
|
|
|
missingDropletTimeout time.Duration // how long a droplet can be missing for
|
2024-10-12 10:59:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// the stuff that is needed for a hypervisor
|
|
|
|
type HyperT struct {
|
2024-10-27 11:02:50 -05:00
|
|
|
pb *pb.Hypervisor // the Hypervisor protobuf
|
|
|
|
dog *time.Ticker // the watchdog timer itself
|
|
|
|
lastpoll time.Time // the last time the hypervisor polled
|
|
|
|
lastDroplets map[string]time.Time // the vm's in the last poll
|
|
|
|
killcount int // how many times the daemon has been forcably killed
|
2024-10-12 10:59:11 -05:00
|
|
|
}
|