From 71e0065240b5bf4a4476e55cc6dcb3648aa82e8f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 1 Nov 2024 12:48:31 -0500 Subject: [PATCH] everything is working again Signed-off-by: Jeff Carr --- importDomain.go | 17 ++++++++++++----- poll.go | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/importDomain.go b/importDomain.go index 50dfd90..71aa42b 100644 --- a/importDomain.go +++ b/importDomain.go @@ -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) + } } /* diff --git a/poll.go b/poll.go index 4051356..fa2c317 100644 --- a/poll.go +++ b/poll.go @@ -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")