diff options
| author | Jeff Carr <[email protected]> | 2024-10-26 12:32:17 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-26 12:32:17 -0500 |
| commit | 2e8281d0678d5f201e18aec33aa4e39fa3587230 (patch) | |
| tree | 0ff7b0beb05729050996808ebe741bcc70004f70 /http.go | |
| parent | 6d5c5c607294c39f7af1427e832904f6dc070b75 (diff) | |
virtigod doing xml now
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'http.go')
| -rw-r--r-- | http.go | 49 |
1 files changed, 2 insertions, 47 deletions
@@ -5,7 +5,6 @@ import ( "net/http" "strings" - pb "go.wit.com/lib/protobuf/virtbuf" "go.wit.com/lib/virtigoxml" "go.wit.com/log" ) @@ -23,18 +22,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { // is the cluster running what it should? if tmp == "/droplets" { for _, d := range me.cluster.Droplets { - if d.StartState != pb.DropletState_ON { - continue - } - /* - dur := time.Since(d.Lastpoll) // Calculate the elapsed time - if d.CurrentState != pb.DropletState_ON { - fmt.Fprintln(w, "BAD STATE ", d.Hostname, hname, "(", d.StartState, "vs", d.CurrentState, ")", shell.FormatDuration(dur)) - } else { - dur := time.Since(d.lastpoll) // Calculate the elapsed time - fmt.Fprintln(w, "GOOD STATE ON", d.Hostname, hname, shell.FormatDuration(dur)) - } - */ + fmt.Fprintln(w, "", d.Hostname, "(", d.StartState, "vs", d.CurrentState, ")") } return } @@ -52,15 +40,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } - /* - if tmp == "/writeconfig" { - writeConfigFile() - writeConfigFileDroplets() - fmt.Fprintln(w, "OK") - return - } - */ - if tmp == "/dumplibvirtxml" { virtigoxml.DumpLibvirtxmlDomainNames() return @@ -75,28 +54,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { log.Info("Handling URL:", tmp, "cluster is not right yet", s) fmt.Fprintln(w, s) } - /* - for _, h := range me.hypers { - url := "http://" + h.pb.Hostname + ":2520/kill" - dur := time.Since(h.lastpoll) // Calculate the elapsed time - if dur > 90*time.Second { - h.RestartDaemon() - continue - } - if h.killcount != 0 { - log.Info("KILL count =", h.killcount, "FOR", h.pb.Hostname, dur, "curl", url) - } - if h.killcount > 10 { - log.Info("KILL count is greater than 10 for host", h.pb.Hostname, dur, "curl", url) - } - // l := shell.FormatDuration(dur) - // log.Warn("HOST =", h.pb.Hostname, "Last poll =", l) - //if d.pb.StartState != "ON" { - // continue - //} - // dur := time.Since(d.lastpoll) // Calculate the elapsed time - } - */ return } @@ -112,12 +69,10 @@ func okHandler(w http.ResponseWriter, r *http.Request) { log.Warn("BAD URL =", tmp) fmt.Fprintln(w, "BAD URL", tmp) - // badurl(w, r.URL.String()) - // fmt.Fprintln(w, "BAD", tmp) } +// write a file out to the http socket func writeFile(w http.ResponseWriter, filename string) { - // fmt.Fprintln(w, "GOT TEST?") fullname := "resources/" + filename pfile, err := resources.ReadFile(fullname) if err != nil { |
