summaryrefslogtreecommitdiff
path: root/event.go
diff options
context:
space:
mode:
Diffstat (limited to 'event.go')
-rw-r--r--event.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/event.go b/event.go
index 3934ca1..a2406b9 100644
--- a/event.go
+++ b/event.go
@@ -2,7 +2,6 @@ package main
import (
"fmt"
- "math/rand"
"time"
"go.wit.com/lib/gui/shell"
@@ -93,62 +92,3 @@ func findDroplet(name string) *pb.Droplet {
}
return nil
}
-
-func Start(name string) (bool, string) {
- var result string
-
- d := findDroplet(name)
- if d == nil {
- result += "can't start unknown droplet: " + name
- return false, result
- }
-
- if d.CurrentState == pb.DropletState_ON {
- return false, "EVENT start droplet " + d.Hostname + " is already ON"
- }
-
- dur := time.Since(me.unstable) // how long has the cluster been stable?
- result = fmt.Sprintln("should start droplet", name, "here. grid stable for:", shell.FormatDuration(dur))
- if dur < me.unstableTimeout {
- tmp := shell.FormatDuration(me.unstableTimeout)
- result += "grid is still too unstable (unstable timeout = " + tmp + ")"
- return false, result
- }
-
- // make the list of hypervisors that are active and can start new droplets
- var pool []*HyperT
- for _, h := range me.hypers {
- result += fmt.Sprintln("could start droplet on", name, "on", h.pb.Hostname, h.pb.Active)
- if d.PreferredHypervisor == h.pb.Hostname {
- // the config file says this droplet should run on this hypervisor
- a, b := h.start(d)
- return a, result + b
- }
-
- if h.pb.Active != true {
- continue
- }
- pool = append(pool, h)
- }
-
- // left here as an example of how to actually do random numbers
- // it's complete mathematical chaos. Randomness is simple when
- // human interaction occurs -- which is exactly what happens most
- // of the time. most random shit is bullshit. all you really need
- // is exactly this to make sure the random functions work as they
- // should. Probably, just use this everywhere in all cases. --jcarr
- rand.Seed(time.Now().UnixNano())
- a := 0
- b := len(pool)
- n := a + rand.Intn(b-a)
- result += fmt.Sprintln("pool has", len(pool), "members", "rand =", n)
- h := pool[n]
-
- // send the search directories to the hypervisor
- result += fmt.Sprintln("h.sendDirs() HERE")
- result += fmt.Sprintln("h.sendDirs() HERE")
- h.sendDirs()
-
- startbool, startresult := h.start(d)
- return startbool, result + startresult
-}