only knows about protobufs
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
170f548a61
commit
9a0ebc0348
19
http.go
19
http.go
|
@ -67,6 +67,25 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if tmp == "/cluster" {
|
||||
log.Info("/cluster jcarr actually doing START")
|
||||
fmt.Fprintln(w, "/cluster jcarr actually doing START")
|
||||
var c *pb.Cluster
|
||||
c = new(pb.Cluster)
|
||||
|
||||
fmt.Fprintln(w, "START len(msg) =", len(msg))
|
||||
err = c.UnmarshalJSON(msg)
|
||||
if err != nil {
|
||||
fmt.Fprintln(w, "START FAILED")
|
||||
fmt.Fprintln(w, "error =", err)
|
||||
}
|
||||
for _, dir := range c.Dirs {
|
||||
log.Info("append dir", dir)
|
||||
fmt.Fprintln(w, "append dir", dir)
|
||||
me.dirs = append(me.dirs, dir)
|
||||
}
|
||||
}
|
||||
|
||||
if tmp == "/start" {
|
||||
log.Info("/start jcarr actually doing START")
|
||||
fmt.Fprintln(w, "/start jcarr actually doing START")
|
||||
|
|
20
main.go
20
main.go
|
@ -23,7 +23,6 @@ import (
|
|||
|
||||
"github.com/digitalocean/go-qemu/hypervisor"
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
pb "go.wit.com/lib/protobuf/virtbuf"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
|
@ -48,25 +47,6 @@ func main() {
|
|||
os.Exit(0)
|
||||
}
|
||||
|
||||
me.cluster = new(pb.Cluster)
|
||||
if err := me.cluster.ConfigLoad(); err != nil {
|
||||
log.Info("config file error:", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
for i, e := range me.cluster.Events {
|
||||
log.Info("Event", i, e)
|
||||
}
|
||||
for i, d := range me.cluster.Droplets {
|
||||
log.Info("Event", i, d.Hostname)
|
||||
}
|
||||
|
||||
if argv.Start != "" {
|
||||
d := me.cluster.FindDroplet(argv.Start)
|
||||
newStart(argv.Start, d)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
log.DaemonMode(true)
|
||||
|
||||
// fmt.Printf("\nConnecting to %s://%s\n", *network, *address)
|
||||
|
|
2
start.go
2
start.go
|
@ -26,7 +26,7 @@ func newStart(start string, d *pb.Droplet) error {
|
|||
newAddXml(domcfg, "spice")
|
||||
newAddXml(domcfg, "qcow")
|
||||
|
||||
return virtigoxml.GenerateDropletXml(me.cluster, d, domcfg, start)
|
||||
return virtigoxml.GenerateDropletXml(me.dirs, d, domcfg, start)
|
||||
}
|
||||
|
||||
func newAddXml(domcfg *libvirtxml.Domain, filename string) error {
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/lib/protobuf/virtbuf"
|
||||
)
|
||||
|
||||
var me Virtigod
|
||||
|
||||
// this app's variables
|
||||
type Virtigod struct {
|
||||
cluster *virtbuf.Cluster
|
||||
// droplets *virtbuf.Droplets
|
||||
// events *virtbuf.Events
|
||||
dirs []string
|
||||
// cluster *virtbuf.Cluster
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue