does spice ports
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
53b18daea6
commit
6934c8a2c4
18
http.go
18
http.go
|
@ -90,12 +90,12 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
if tmp == "/start" {
|
||||
log.Info("/start jcarr actually doing START")
|
||||
fmt.Fprintln(w, "/start jcarr actually doing START")
|
||||
log.Info("/start jcarr actually doing START", me.Hostname)
|
||||
fmt.Fprintln(w, "/start jcarr actually doing START", me.Hostname)
|
||||
start := r.URL.Query().Get("start")
|
||||
xml := "/tmp/" + start + ".xml"
|
||||
if shell.Unlink(xml) {
|
||||
fmt.Fprintln(w, "START FAILED")
|
||||
fmt.Fprintln(w, "START FAILED", me.Hostname)
|
||||
fmt.Fprintln(w, "error =", "could not remove existing xml file", xml)
|
||||
fmt.Fprintln(w, "error =", "file still exists after unlink")
|
||||
return
|
||||
|
@ -108,25 +108,25 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
fmt.Fprintln(w, "msg =", string(msg))
|
||||
fmt.Fprintln(w, "/start ReadAll() END")
|
||||
if err != nil {
|
||||
fmt.Fprintln(w, "START FAILED")
|
||||
fmt.Fprintln(w, "START FAILED", me.Hostname)
|
||||
fmt.Fprintln(w, "error =", err)
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(w, "START len(msg) =", len(msg))
|
||||
err = d.UnmarshalJSON(msg)
|
||||
if d.Hostname == "" {
|
||||
fmt.Fprintln(w, "START hostname is blank")
|
||||
fmt.Fprintln(w, "START hostname is blank", me.Hostname)
|
||||
log.Info("START hostname is blank")
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(w, "START FAILED")
|
||||
fmt.Fprintln(w, "START FAILED", me.Hostname)
|
||||
fmt.Fprintln(w, "error =", err)
|
||||
}
|
||||
|
||||
if err := newStart(start, d); err != nil {
|
||||
fmt.Fprintln(w, "START FAILED")
|
||||
fmt.Fprintln(w, "START FAILED", me.Hostname)
|
||||
fmt.Fprintln(w, "error =", err)
|
||||
return
|
||||
}
|
||||
|
@ -140,10 +140,10 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
err, ok, output := shell.RunCmd("/home/", cmd)
|
||||
shell.Run(cmd)
|
||||
if ok {
|
||||
fmt.Fprintln(w, "START OK")
|
||||
fmt.Fprintln(w, "START OK", me.Hostname)
|
||||
fmt.Fprintln(w, output)
|
||||
} else {
|
||||
fmt.Fprintln(w, "START FAILED")
|
||||
fmt.Fprintln(w, "START FAILED", me.Hostname)
|
||||
fmt.Fprintln(w, "error =", err)
|
||||
fmt.Fprintln(w, "output =", output)
|
||||
}
|
||||
|
|
1
main.go
1
main.go
|
@ -45,6 +45,7 @@ func main() {
|
|||
pp.WriteHelp(os.Stdout)
|
||||
os.Exit(0)
|
||||
}
|
||||
me.Hostname, _ = os.Hostname()
|
||||
|
||||
log.DaemonMode(true)
|
||||
|
||||
|
|
8
start.go
8
start.go
|
@ -20,7 +20,15 @@ func newStart(start string, d *pb.Droplet) error {
|
|||
domcfg := &libvirtxml.Domain{}
|
||||
|
||||
mergeXML(domcfg, "standard.x86")
|
||||
// ignore spice if it's not set
|
||||
if d.SpicePort == 0 {
|
||||
log.Info("spice port was not set. spice disabled")
|
||||
} else {
|
||||
mergeXML(domcfg, "spice")
|
||||
if err := virtigoxml.SetSpicePort(d, domcfg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
mergeXML(domcfg, "qcow")
|
||||
|
||||
return virtigoxml.GenerateDropletXml(me.dirs, d, domcfg, start)
|
||||
|
|
|
@ -4,5 +4,6 @@ var me Virtigod
|
|||
|
||||
// this app's variables
|
||||
type Virtigod struct {
|
||||
Hostname string
|
||||
dirs []string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue