Skip to content

Instantly share code, notes, and snippets.

@hugoduncan
Created October 17, 2010 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugoduncan/630534 to your computer and use it in GitHub Desktop.
Save hugoduncan/630534 to your computer and use it in GitHub Desktop.
vmfest provider
(ns pallet.compute.vmfest
"A vmfest provider"
(:require
[pallet.compute :as compute]
[pallet.compute.jvm :as jvm]
[pallet.compute.implementation :as implementation]
[clojure.contrib.condition :as condition]
[clojure.string :as string]
[vmfest.core :as vmfest]))
(defn supported-providers []
["virtualbox"])
(deftype VirtualBox [connection ^{:unsynchronized-mutable true} virtual-box]
pallet.compute.ComputeService
(nodes [compute-service]
(vmfest/vm-list virtual-box))
(ensure-os-family
[compute-service request]
request)
;; Not implemented
;; (build-node-template)
;; (run-nodes [node-type node-count request init-script])
;; (reboot "Reboot the specified nodes")
;; (boot-if-down [compute nodes] nil)
;; (shutdown-node "Shutdown a node.")
;; (shutdown "Shutdown specified nodes")
)
(defn make-virtualbox [{:keys [host username password]
:or {host "localhost"
username "test"
password "test"}}]
(let [session-manager (vmfest/create-session-manager host)
virtual-box (vmfest/create-vbox session-manager username password)]
(VirtualBox. session-manager virtual-box)))
;;;; Compute service
(defmethod implementation/service :vmfest
[_ {:keys [host identity credential] :as options}]
(make-virtualbox options))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment