Skip to content

Instantly share code, notes, and snippets.

@kanaka
Created November 12, 2011 21:14
Show Gist options
  • Select an option

  • Save kanaka/1361130 to your computer and use it in GitHub Desktop.

Select an option

Save kanaka/1361130 to your computer and use it in GitHub Desktop.
Clojure+libvirt quick test
(import '(org.libvirt Connect))
(def c (Connect. "test:///default", true))
(def dom (.domainLookupByName c "test"))
(.getName dom)
(.getID dom)
(.getXMLDesc dom 0)
(.getInfo dom)
(defn di [^org.libvirt.DomainInfo x]
{:state (keyword (str (.state x)))
:maxMem (.maxMem x)
:memory (.memory x)
:nrVirtCpu (.nrVirtCpu x)
:cpuTime (.cpuTime x)})
(:maxMem (di (.getInfo dom)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment