summaryrefslogtreecommitdiff
path: root/importDomain.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-31 22:14:11 -0500
committerJeff Carr <[email protected]>2024-10-31 22:14:11 -0500
commitd51c4627f79f30a234ee7bcab6f21351ec92c88b (patch)
treef1a8d0c334c2b184c75cee4e9e8a3ad80584e1bf /importDomain.go
parentefc3032d8352a05226956eb13011a985f3e7caba (diff)
add droplet() defaults to start state=off
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'importDomain.go')
-rw-r--r--importDomain.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/importDomain.go b/importDomain.go
index 59c6398..ffc0614 100644
--- a/importDomain.go
+++ b/importDomain.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
+ pb "go.wit.com/lib/protobuf/virtbuf"
"go.wit.com/log"
)
@@ -28,8 +29,20 @@ func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
fmt.Fprintln(w, result)
return result, errors.New(result)
}
- result := "libvirt domain " + name + " found on " + d.Current.Hypervisor
- log.Info(result)
+ start := fmt.Sprintf("%-9s %-20s", d.Current.Hypervisor, name)
+ if d.Current.State != pb.DropletState_OFF {
+ result := "libvirt domain " + name + " found on " + d.Current.Hypervisor
+ log.Info(result)
+ fmt.Fprintln(w, result)
+ }
+ if d.LocalOnly == "" {
+ result := start + " local duplicate defined (need to resolve this)"
+ log.Log(WARN, result)
+ fmt.Fprintln(w, result)
+ return result, nil
+ }
+ result := start + " local ready to import from hypervisor"
+ log.Log(WARN, result)
fmt.Fprintln(w, result)
return result, nil
}