summaryrefslogtreecommitdiff
path: root/event.go
diff options
context:
space:
mode:
Diffstat (limited to 'event.go')
-rw-r--r--event.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/event.go b/event.go
index 4358ab6..891908a 100644
--- a/event.go
+++ b/event.go
@@ -10,9 +10,11 @@ import (
"go.wit.com/log"
)
-func (d *DropletT) Start() {
+/*
+func (d *pb.Droplet) Start() {
log.Info("a new virtual machine is running")
}
+*/
func (h *HyperT) RestartDaemon() {
url := "http://" + h.pb.Hostname + ":2520/kill"
@@ -43,34 +45,34 @@ func clusterReady() (bool, string) {
return false, "clusterReady() is unstable for " + shell.FormatDuration(last)
}
-func (d *DropletT) dropletReady() (bool, string) {
+func dropletReady(d *pb.Droplet) (bool, string) {
if d.CurrentState == pb.DropletState_ON {
return false, "EVENT start droplet is already ON"
}
- if d.starts > 2 {
+ if d.Starts > 2 {
// reason := "EVENT start droplet has already been started " + d.starts + " times"
- return false, fmt.Sprintln("EVENT start droplet has already been started ", d.starts, " times")
+ return false, fmt.Sprintln("EVENT start droplet has already been started ", d.Starts, " times")
}
return true, ""
}
-func (h *HyperT) Start(d *DropletT) (bool, string) {
+func (h *HyperT) Start(d *pb.Droplet) (bool, string) {
ready, result := clusterReady()
if !ready {
return false, result
}
- ready, result = d.dropletReady()
+ ready, result = dropletReady(d)
if !ready {
return false, result
}
- url := "http://" + h.pb.Hostname + ":2520/start?start=" + d.pb.Hostname
+ url := "http://" + h.pb.Hostname + ":2520/start?start=" + d.Hostname
s := shell.Wget(url)
result = "EVENT start droplet url: " + url + "\n"
result += "EVENT start droplet response: " + s.String()
// increment the counter for a start attempt working
- d.starts += 1
+ d.Starts += 1
// mark the cluster as unstable so droplet starts can be throttled
me.unstable = time.Now()
@@ -102,7 +104,7 @@ func Start(name string) (bool, string) {
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.pb.PreferredHypervisor == h.pb.Hostname {
+ 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