Skip to content

Instantly share code, notes, and snippets.

@tbatchelli
Created November 9, 2010 20:40
Show Gist options
  • Save tbatchelli/669762 to your computer and use it in GitHub Desktop.
Save tbatchelli/669762 to your computer and use it in GitHub Desktop.
(comment
(use 'vmfest.virtualbox.virtualbox)
(use 'vmfest.virtualbox.machine)
(use 'vmfest.virtualbox.guest-os-type)
;; find by name or UUID
(def my-machine (find-machine "http://localhost:18083" "" "" "CentOS Minimal"))
;; -> #:vmfest.virtualbox.model.machine{
;; :id "197c694b-fb56-43ed-88f5-f62769134442",
;; :server #:vmfest.virtualbox.model.server{
;; :url "http://localhost:18083",
;; :username "",
;; :password ""},
;; :location nil}
;; operate the machine
(start my-machine)
(pause my-machine)
(resume my-machine)
(stop my-machine)
;; all the statements in the body are run within a direct session
;; with the machine
(with-direct-session my-machine [session machine]
(.setMemorySize machine (long 1024))
(.saveSettings machine))
;; as-map gives you a map with all the object's attributes
(pprint (as-map my-machine))
;; -> {:id "197c694b-fb56-43ed-88f5-f62769134442",
;; :server {:url "http://localhost:18083", :username "", :password ""},
;; :location nil,
;; :current-snapshot nil,
;; :cpu-hot-plug-enabled? false,
;; :settings-file-path
;; "/Users/tbatchelli/Library/VirtualBox/Machines/CentOS Minimal/CentOS Minimal.xml",
;; :hpet-enabled false,
;; :teleporter-port 0,
;; :cpu-count 1,
;; :snapshot-folder
;; "/Users/tbatchelli/Library/VirtualBox/Machines/CentOS
;; Minimal/Snapshots",
;; etc.... }
;; soak gets you the actual virtualbox object, without a session, so
;; you can use the usual java methods with it
(.getMemorySize (soak my-machine)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment