Created
November 12, 2011 21:14
-
-
Save kanaka/1361130 to your computer and use it in GitHub Desktop.
Clojure+libvirt quick test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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