2 ----------------------------------------------------------------------
4 Copyright (C) 2007 Richard W.M. Jones, Red Hat Inc.
5 http://et.redhat.com/~rjones/ocaml-libvirt/
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 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/)
21 findlib (from http://www.ocaml-programming.de/packages/)
22 Extlib (from http://ocaml-lib.sourceforge.net/)
24 To build the OCaml interface documentation (optional):
26 ocamldoc (part of OCaml itself)
28 To build virt-top (optional):
30 ocaml-curses (from http://www.nongnu.org/ocaml-tmk/)
31 xml-light (from http://tech.motion-twin.com/doc/xml-light/)
32 ocaml CSV library (from http://merjis.com/developers/csv)
34 [Only ocaml-curses is required for building virt-top. The other
35 packages are not required, but you will get reduced functionality].
37 To build mlvirtmanager (optional):
39 GTK2 (from http://gtk.org/)
40 lablgtk2 (from http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgtk.html)
42 To build the manpages (optional):
44 perldoc (part of Perl)
46 OCaml packages are available for Fedora 7 and above (ocaml,
47 ocaml-findlib, ocaml-findlib-devel, ocaml-ocamldoc, ocaml-extlib,
48 ocaml-extlib-devel, ocaml-lablgtk, ocaml-lablgtk-devel, ocaml-curses,
49 ocaml-xml-light, ocaml-csv).
51 http://www.annexia.org/tmp/ocaml/
52 http://fedoraproject.org/wiki/SIGs/OCaml
54 Debian/Ubuntu have all the packages you require.
58 ----------------------------------------------------------------------
60 ./configure # Checks that you have all the required bits.
62 make all # Builds the bytecode version of libs/programs.
63 make opt # Builds the native code version of libs/programs.
65 make install # Install in OCaml directory, and the binaries
68 make doc # Build HTML documentation in html/ subdirectory.
70 Then have a look at the programs 'mlvirsh.opt' and 'mlvirtmanager.opt'.
72 Note: If you want to run the programs without first installing, you
73 may need to set your $LD_LIBRARY_PATH environment variable so it
74 contains the build directory. eg:
76 LD_LIBRARY_PATH=libvirt/ mlvirsh/mlvirsh.opt
80 ----------------------------------------------------------------------
82 'mlvirsh' is an almost complete reimplementation of virsh, which is
83 mostly command compatible (there are a very few commands missing, and
84 some commands have a slightly different syntax, but broadly speaking
85 they are equivalent programs except that one is written in C and the
88 At the time of writing:
99 ----------------------------------------------------------------------
101 'mlvirtmanager' is a demonstration implementation of virt-manager in
102 OCaml. It is not feature-complete by any means, but does allow you to
103 show the running domains and start and stop defined domains. The main
104 functionality _missing_ is the ability to define new virtual machines,
105 change the resources allocated to domains, or show the machine
110 ----------------------------------------------------------------------
112 The interface is described in 'libvirt.mli'. The main modules are
113 Libvirt.Connect, Libvirt.Domain and Libvirt.Network, corresponding
114 respectively to the virConnect*, virDomain*, and virNetwork*
115 functions. For brevity I usually rename these modules like this:
117 module C = Libvirt.Connect
118 module D = Libvirt.Domain
119 module N = Libvirt.Network
121 To get a connection handle, do:
124 let conn = C.connect ~name ()
128 let n = C.num_of_domains conn
129 let ids = C.list_domains conn n
130 let domains = Array.map (D.lookup_by_id conn) ids
134 printf "%5d %s\n" (D.get_id dom) (D.get_name dom)
137 (See also the program list_domains.ml).
139 For documentation on these bindings, read libvirt.mli and/or 'make
140 doc' and browse the HTML documentation in the html/ subdirectory.
142 For documentation on libvirt itself, see http://libvirt.org/html/
146 ----------------------------------------------------------------------
148 libvirt/ The OCaml bindings.
149 examples/ Some example programs using the bindings.
150 mlvirsh/ 'mlvirsh' command line tool.
151 mlvirtmanager/ 'mlvirtmanager' graphical tool.
152 virt-top/ 'virt-top' tool.