add droplet() defaults to start state=off
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
efc3032d83
commit
d51c4627f7
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
pb "go.wit.com/lib/protobuf/virtbuf"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,8 +29,20 @@ func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
|
||||||
fmt.Fprintln(w, result)
|
fmt.Fprintln(w, result)
|
||||||
return result, errors.New(result)
|
return result, errors.New(result)
|
||||||
}
|
}
|
||||||
result := "libvirt domain " + name + " found on " + d.Current.Hypervisor
|
start := fmt.Sprintf("%-9s %-20s", d.Current.Hypervisor, name)
|
||||||
log.Info(result)
|
if d.Current.State != pb.DropletState_OFF {
|
||||||
|
result := "libvirt domain " + name + " found on " + d.Current.Hypervisor
|
||||||
|
log.Info(result)
|
||||||
|
fmt.Fprintln(w, result)
|
||||||
|
}
|
||||||
|
if d.LocalOnly == "" {
|
||||||
|
result := start + " local duplicate defined (need to resolve this)"
|
||||||
|
log.Log(WARN, result)
|
||||||
|
fmt.Fprintln(w, result)
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
result := start + " local ready to import from hypervisor"
|
||||||
|
log.Log(WARN, result)
|
||||||
fmt.Fprintln(w, result)
|
fmt.Fprintln(w, result)
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
16
poll.go
16
poll.go
|
@ -35,14 +35,14 @@ func (h *HyperT) pollHypervisor() {
|
||||||
name := fields[1]
|
name := fields[1]
|
||||||
start := fmt.Sprintf("%-9s %-20s", h.pb.Hostname, name)
|
start := fmt.Sprintf("%-9s %-20s", h.pb.Hostname, name)
|
||||||
d := me.cluster.FindDropletByName(name)
|
d := me.cluster.FindDropletByName(name)
|
||||||
if d == nil {
|
if d == nil {
|
||||||
log.Log(WARN, start, "local defined domain")
|
log.Log(WARN, start, "local defined domain")
|
||||||
log.Log(WARN, start, "local Running AddDropletLocal()")
|
log.Log(WARN, start, "local Running AddDropletLocal()")
|
||||||
log.Log(WARN, start, "local Running AddDropletLocal()")
|
log.Log(WARN, start, "local Running AddDropletLocal()")
|
||||||
log.Log(WARN, start, "local Running AddDropletLocal()")
|
log.Log(WARN, start, "local Running AddDropletLocal()")
|
||||||
me.cluster.AddDropletLocal(name, h.pb.Hostname)
|
me.cluster.AddDropletLocal(name, h.pb.Hostname)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h.lastDroplets[name] = time.Now()
|
h.lastDroplets[name] = time.Now()
|
||||||
if state == "OFF" {
|
if state == "OFF" {
|
||||||
if d.LocalOnly == "" {
|
if d.LocalOnly == "" {
|
||||||
|
|
Loading…
Reference in New Issue