 
 (timbre/refer-timbre)
 
-(defn connection [{:keys [host user port]}] 
-  (connect (<< "qemu+ssh://~{user}@~{host}:~{port}/system")))
+(defn connection [{:keys [host username port]}] 
+  (connect (<< "qemu+ssh://~{username}@~{host}:~{port}/system")))
 
 (defmacro with-connection [& body]
   `(let [~'connection (connection ~'node)] (do ~@body)))

    [kvm.validations :refer (provider-validation)]
    [clojure.core.strint :refer (<<)] 
    [kvm.clone :refer (clone-domain)]
    [kvm.common :refer (connect)]
    [supernal.sshj :refer (ssh-up?)]
    [celestial.core :refer (Vm)] 
    [taoensso.timbre :as timbre]

   (-> machine
     (mappings {:os :image :hostname :name})
     (transform (machine-ts machine))
     (selections [[:name :user :image :cpu :ram]])))

(defmethod vconstruct :kvm [{:keys [kvm machine system-id] :as spec}]
   (let [[domain] (translate spec) {:keys [node]} kvm]
     (provider-validation domain)
     (->Domain system-id (hypervisor* :kvm :nodes node) domain)))

