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) {
var result string
domainName := r.URL.Query().Get("domainName")
force := r.URL.Query().Get("force")
if domainName == "" {
result = "importDomain() failed. name is blank " + r.URL.Path
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()
d := me.cluster.FindDropletByName(domainName)
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)
fmt.Fprintln(w, 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 d.LocalOnly == "" {
result = "LocalOnly is blank. SKIP. merge not supported yet."
log.Log(WARN, result)
fmt.Fprintln(w, result)
return result, errors.New(result)
if force == "true" {
result = "LocalOnly is blank. force=true. PROCEEDING WITH DANGER\n"
log.Warn(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
}
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
}
log.Log(WARN, start, "local domain ready to import from hypervisor")