2 ----------------------------------------------------------------------
4 Copyright (C) 2007 Richard W.M. Jones, Red Hat Inc.
5 http://libvirt.org/ocaml/
8 This is a complete set of OCaml bindings around libvirt, exposing all
9 known functionality to OCaml programs.
13 ----------------------------------------------------------------------
15 To build the bindings, examples, and mlvirsh (required):
18 libvirt >= 0.2.1 (from http://libvirt.org/,
19 get the latest version if you can)
20 ocaml >= 3.08 (from http://caml.inria.fr/)
22 Optional, but highly recommended:
24 findlib (from http://www.ocaml-programming.de/packages/)
26 To build the OCaml interface documentation (optional):
28 ocamldoc (part of OCaml itself)
30 To build virt-top (optional):
32 ocaml-curses (from http://www.nongnu.org/ocaml-tmk/)
33 Extlib (from http://ocaml-lib.sourceforge.net/)
34 xml-light (from http://tech.motion-twin.com/doc/xml-light/)
35 ocaml CSV library (from http://merjis.com/developers/csv)
36 ocaml-calendar (http://www.lri.fr/~signoles/prog.en.html)
38 [Only ocaml-curses and Extlib are required for building virt-top.
39 The other packages are not required, but you will get reduced
42 To build mlvirtmanager (optional):
44 GTK2 (from http://gtk.org/)
45 lablgtk2 (from http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgtk.html)
47 To build the manpages (optional):
49 perldoc (part of Perl)
51 To build a Windows installer (optional):
53 NSIS (http://nsis.sf.net)
55 OCaml packages are available for Fedora 7 and above (ocaml,
56 ocaml-findlib, ocaml-findlib-devel, ocaml-ocamldoc, ocaml-extlib,
57 ocaml-extlib-devel, ocaml-lablgtk, ocaml-lablgtk-devel, ocaml-curses,
58 ocaml-xml-light, ocaml-csv).
60 http://www.annexia.org/tmp/ocaml/
61 http://fedoraproject.org/wiki/SIGs/OCaml
63 Debian/Ubuntu have all the packages you require.
67 ----------------------------------------------------------------------
69 ./configure # Checks that you have all the required bits.
71 make all # Builds the bytecode version of libs/programs.
72 make opt # Builds the native code version of libs/programs.
74 make install # Install in OCaml directory, and the binaries
77 make doc # Build HTML documentation in html/ subdirectory.
79 Then have a look at the programs 'mlvirsh.opt' and 'mlvirtmanager.opt'.
81 Note: If you want to run the programs without first installing, you
82 may need to set your $LD_LIBRARY_PATH environment variable so it
83 contains the build directory. eg:
85 LD_LIBRARY_PATH=libvirt/ mlvirsh/mlvirsh.opt
89 ----------------------------------------------------------------------
91 I have built libvirt (the bindings), examples, mlvirsh and
92 mlvirtmanager on Windows using the MinGW port of OCaml. It's quite
93 likely that it will also work under VC++, but I have not tested this.
95 To build the Windows installer, you will need NSIS. Then do:
97 ./configure --with-nsis=/c/Progra~1/NSIS
101 This should build a Windows binary installer called
102 ocaml-libvirt-$VERSION.exe which includes the bindings, all required
103 DLLs and all programs that can be built under Windows.
107 ----------------------------------------------------------------------
109 'mlvirsh' is an almost complete reimplementation of virsh, which is
110 mostly command compatible (there are a very few commands missing, and
111 some commands have a slightly different syntax, but broadly speaking
112 they are equivalent programs except that one is written in C and the
115 At the time of writing:
126 ----------------------------------------------------------------------
128 'mlvirtmanager' is a demonstration implementation of virt-manager in
129 OCaml. It is not feature-complete by any means, but does allow you to
130 show the running domains and start and stop defined domains. The main
131 functionality _missing_ is the ability to define new virtual machines,
132 change the resources allocated to domains, or show the machine
137 ----------------------------------------------------------------------
139 The interface is described in 'libvirt.mli'. The main modules are
140 Libvirt.Connect, Libvirt.Domain and Libvirt.Network, corresponding
141 respectively to the virConnect*, virDomain*, and virNetwork*
142 functions. For brevity I usually rename these modules like this:
144 module C = Libvirt.Connect
145 module D = Libvirt.Domain
146 module N = Libvirt.Network
148 To get a connection handle, do:
151 let conn = C.connect ~name ()
155 let n = C.num_of_domains conn
156 let ids = C.list_domains conn n
157 let domains = Array.map (D.lookup_by_id conn) ids
161 printf "%5d %s\n" (D.get_id dom) (D.get_name dom)
164 (See also the program list_domains.ml).
166 For documentation on these bindings, read libvirt.mli and/or 'make
167 doc' and browse the HTML documentation in the html/ subdirectory.
169 For documentation on libvirt itself, see http://libvirt.org/html/
173 ----------------------------------------------------------------------
175 libvirt/ The OCaml bindings.
176 examples/ Some example programs using the bindings.
177 mlvirsh/ 'mlvirsh' command line tool.
178 mlvirtmanager/ 'mlvirtmanager' graphical tool.
179 virt-top/ 'virt-top' tool.