parent
cec509ae7f
commit
5d1729f99b
8
event.go
8
event.go
|
@ -26,15 +26,13 @@ func (h *HyperT) RestartVirtigod() {
|
|||
me.unstable = time.Now()
|
||||
}
|
||||
|
||||
var stableTimeout time.Duration = 43 * time.Second
|
||||
|
||||
// checks if the cluster is ready and stable
|
||||
func clusterReady() (bool, string) {
|
||||
last := time.Since(me.unstable)
|
||||
if last > stableTimeout {
|
||||
if last > me.unstableTimeout {
|
||||
// the cluster has not been stable for 133 seconds
|
||||
log.Warn("clusterReady() is stable for ", shell.FormatDuration(stableTimeout), " secs")
|
||||
return true, fmt.Sprintln("clusterReady() is stable ", shell.FormatDuration(stableTimeout), " secs")
|
||||
log.Warn("clusterReady() is stable for ", shell.FormatDuration(me.unstableTimeout), " secs")
|
||||
return true, fmt.Sprintln("clusterReady() is stable ", shell.FormatDuration(me.unstableTimeout), " secs")
|
||||
}
|
||||
log.Warn("clusterReady() is unstable for", shell.FormatDuration(last))
|
||||
return false, "clusterReady() is unstable for " + shell.FormatDuration(last)
|
||||
|
|
3
main.go
3
main.go
|
@ -148,8 +148,11 @@ func main() {
|
|||
// start the watchdog polling for each hypervisor
|
||||
for _, h := range me.hypers {
|
||||
log.Info("starting polling on", h.pb.Hostname)
|
||||
|
||||
// inititialize the search directories on each hypervisor
|
||||
h.sendDirs()
|
||||
|
||||
// start a watchdog on each hypervisor
|
||||
go h.NewWatchdog()
|
||||
}
|
||||
|
||||
|
|
10
structs.go
10
structs.go
|
@ -20,11 +20,11 @@ func (b *virtigoT) Enable() {
|
|||
|
||||
// this app's variables
|
||||
type virtigoT struct {
|
||||
cluster *pb.Cluster // basic cluster settings
|
||||
delay time.Duration // how often to poll the hypervisors
|
||||
hmap map[*pb.Hypervisor]*HyperT // map to the local struct
|
||||
names []string
|
||||
hypers []*HyperT
|
||||
cluster *pb.Cluster // basic cluster settings
|
||||
delay time.Duration // how often to poll the hypervisors
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue