Guest User

Untitled

a guest
Jun 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. (ns pallet.compute.vmfest
  2. "A vmfest provider"
  3. (:require
  4. [pallet.compute :as compute]
  5. [pallet.compute.jvm :as jvm]
  6. [pallet.compute.implementation :as implementation]
  7. [clojure.contrib.condition :as condition]
  8. [clojure.string :as string]
  9. [vmfest.core :as vmfest]))
  10.  
  11.  
  12. (defn supported-providers []
  13. ["virtualbox"])
  14.  
  15. (deftype VirtualBox [connection ^{:unsynchronized-mutable true} virtual-box]
  16. pallet.compute.ComputeService
  17. (nodes [compute-service]
  18. (vmfest/vm-list virtual-box))
  19. (ensure-os-family
  20. [compute-service request]
  21. request)
  22. ;; Not implemented
  23. ;; (build-node-template)
  24. ;; (run-nodes [node-type node-count request init-script])
  25. ;; (reboot "Reboot the specified nodes")
  26. ;; (boot-if-down [compute nodes] nil)
  27. ;; (shutdown-node "Shutdown a node.")
  28. ;; (shutdown "Shutdown specified nodes")
  29. )
  30.  
  31. (defn make-virtualbox [{:keys [host username password]
  32. :or {host "localhost"
  33. username "test"
  34. password "test"}}]
  35. (let [session-manager (vmfest/create-session-manager host)
  36. virtual-box (vmfest/create-vbox session-manager username password)]
  37. (VirtualBox. session-manager virtual-box)))
  38.  
  39.  
  40. ;;;; Compute service
  41. (defmethod implementation/service :vmfest
  42. [_ {:keys [host identity credential] :as options}]
  43. (make-virtualbox options))
Add Comment
Please, Sign In to add comment