everything is working again

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-01 12:48:31 -05:00
parent 301fe567e2
commit 71e0065240
2 changed files with 13 additions and 6 deletions

View File

@ -20,6 +20,7 @@ import (
func importDomain(w http.ResponseWriter, r *http.Request) (string, error) { func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
var result string var result string
domainName := r.URL.Query().Get("domainName") domainName := r.URL.Query().Get("domainName")
force := r.URL.Query().Get("force")
if domainName == "" { if domainName == "" {
result = "importDomain() failed. name is blank " + r.URL.Path result = "importDomain() failed. name is blank " + r.URL.Path
log.Warn(result) log.Warn(result)
@ -30,7 +31,7 @@ func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
// a LocalOnly record should already have been created by hypervisor.Poll() // a LocalOnly record should already have been created by hypervisor.Poll()
d := me.cluster.FindDropletByName(domainName) d := me.cluster.FindDropletByName(domainName)
if d == nil { if d == nil {
result = "libvirt domain " + domainName + " could not be found on any hypervisor" result = "libvirt domain " + domainName + " could not be found on any hypervisor\n"
log.Info(result) log.Info(result)
fmt.Fprintln(w, result) fmt.Fprintln(w, result)
return result, errors.New(result) return result, errors.New(result)
@ -38,10 +39,16 @@ func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
// if it's not local only, don't attempt this for now // if it's not local only, don't attempt this for now
if d.LocalOnly == "" { if d.LocalOnly == "" {
result = "LocalOnly is blank. SKIP. merge not supported yet." if force == "true" {
log.Log(WARN, result) result = "LocalOnly is blank. force=true. PROCEEDING WITH DANGER\n"
fmt.Fprintln(w, result) log.Warn(result)
return result, errors.New(result) fmt.Fprint(w, result)
} else {
result = "LocalOnly is blank. SKIP. merge not supported yet. force=" + force
log.Log(WARN, result)
fmt.Fprintln(w, result)
return result, errors.New(result)
}
} }
/* /*

View File

@ -58,7 +58,7 @@ func (h *HyperT) pollHypervisor() {
d.Current.Hypervisor = h.pb.Hostname d.Current.Hypervisor = h.pb.Hostname
} }
if d.LocalOnly == "" { if d.LocalOnly == "" {
log.Log(WARN, start, "local domain is a duplicate (need to resolve this)") log.Log(WARN, start, "local domain is a duplicate (need to resolve this)", h.pb.Hostname)
continue continue
} }
log.Log(WARN, start, "local domain ready to import from hypervisor") log.Log(WARN, start, "local domain ready to import from hypervisor")