51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
pb "go.wit.com/lib/protobuf/virtbuf"
|
|
"libvirt.org/go/libvirtxml"
|
|
)
|
|
|
|
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 {
|
|
cluster *pb.Cluster
|
|
names []string
|
|
hypers []*HyperT
|
|
droplets []*DropletT
|
|
delay time.Duration // how often to poll the hypervisors
|
|
killcount int
|
|
unstable time.Time // the last time the cluster was incorrect
|
|
changed bool
|
|
}
|
|
|
|
// the stuff that is needed for a hypervisor
|
|
type HyperT struct {
|
|
pb *pb.Hypervisor // the Hypervisor protobuf
|
|
dog *time.Ticker // the watchdog timer itself
|
|
lastpoll time.Time // the last time the hypervisor polled
|
|
killcount int
|
|
}
|
|
|
|
// the stuff that is needed for a hypervisor
|
|
type DropletT struct {
|
|
pb *pb.Droplet // the Droplet protobuf
|
|
xml *libvirtxml.Domain // a xml representation from libvirt
|
|
h *HyperT // the hypervisor it's currently running on
|
|
CurrentState string // what the state of the droplet is ACTUALLY IS
|
|
lastpoll time.Time // the last time the droplet was seen running
|
|
starts int // how many times a start event has been attempted
|
|
}
|