summaryrefslogtreecommitdiff
path: root/event.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-31 06:43:14 -0500
committerJeff Carr <[email protected]>2024-10-31 06:43:14 -0500
commit4a58352ec271c2de5cebd2cabc266bccb68ac030 (patch)
tree8879d87d101f65e1ae196290ac911e225f7f8c2a /event.go
parente6ea90f8defd8f26702ed808bcf801f53ce3a327 (diff)
dump more code to virtigoxml
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'event.go')
-rw-r--r--event.go38
1 files changed, 1 insertions, 37 deletions
diff --git a/event.go b/event.go
index d5ea351..8f8f19e 100644
--- a/event.go
+++ b/event.go
@@ -25,37 +25,10 @@ func (h *HyperT) RestartVirtigod() {
me.unstable = time.Now()
}
-// checks if the cluster is ready and stable
-func clusterReady() (bool, string) {
- last := time.Since(me.unstable)
- if last > me.unstableTimeout {
- // the cluster has not been stable for 133 seconds
- 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)
-}
-
-func dropletReady(d *pb.Droplet) (bool, string) {
- if d.Current.State == pb.DropletState_ON {
- return false, "EVENT start droplet is already ON"
- }
- if d.Current.StartAttempts > 2 {
- // reason := "EVENT start droplet has already been started " + d.starts + " times"
- return false, fmt.Sprintln("EVENT start droplet has already been started ", d.Current.StartAttempts, " times")
- }
- return true, ""
-}
-
// this must be bool in string because accumulated output is sometimes
// written to STDOUT, sometimes to http
func (h *HyperT) start(d *pb.Droplet) (bool, string) {
- ready, result := clusterReady()
- if !ready {
- return false, result
- }
- ready, result = dropletReady(d)
+ ready, result := me.cluster.DropletReady(d)
if !ready {
return false, result
}
@@ -83,12 +56,3 @@ func (h *HyperT) start(d *pb.Droplet) (bool, string) {
return true, result
}
-
-func findDropletByName(name string) *pb.Droplet {
- for _, d := range me.cluster.Droplets {
- if d.Hostname == name {
- return d
- }
- }
- return nil
-}