1 $Id: README,v 1.11 2007/08/23 09:36:04 rjones Exp $
4 ----------------------------------------------------------------------
6 Copyright (C) 2007 Richard W.M. Jones, Red Hat Inc.
7 http://et.redhat.com/~rjones/ocaml-libvirt/
10 This is a complete set of OCaml bindings around libvirt, exposing all
11 known functionality to OCaml programs.
15 ----------------------------------------------------------------------
17 To build the bindings and mlvirsh (required):
20 libvirt >= 0.2.1 (from http://libvirt.org/,
21 get the latest version if you can)
22 ocaml >= 3.08 (from http://caml.inria.fr/)
23 findlib (from http://www.ocaml-programming.de/packages/)
24 Extlib (from http://ocaml-lib.sourceforge.net/)
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 xml-light (from http://tech.motion-twin.com/doc/xml-light/)
34 ocaml CSV library (from http://merjis.com/developers/csv)
36 [Only ocaml-curses is required for building virt-top. The other
37 packages are not required, but you will get reduced functionality].
39 To build mlvirtmanager (optional):
41 GTK2 (from http://gtk.org/)
42 lablgtk2 (from http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgtk.html)
44 To build the manpages (optional):
46 perldoc (part of Perl)
48 OCaml packages are available for Fedora 7 and above (ocaml,
49 ocaml-findlib, ocaml-findlib-devel, ocaml-ocamldoc, ocaml-extlib,
50 ocaml-extlib-devel, ocaml-lablgtk, ocaml-lablgtk-devel, ocaml-curses,
51 ocaml-xml-light, ocaml-csv).
53 http://www.annexia.org/tmp/ocaml/
54 http://fedoraproject.org/wiki/SIGs/OCaml
56 Debian/Ubuntu have all the packages you require.
60 ----------------------------------------------------------------------
62 ./configure # Checks that you have all the required bits.
64 make all # Builds the bytecode version of libs/programs.
65 make opt # Builds the native code version of libs/programs.
67 make install # Install in OCaml directory, and the binaries
70 make doc # Build HTML documentation in html/ subdirectory.
72 Then have a look at the programs 'mlvirsh.opt' and 'mlvirtmanager.opt'.
74 Note: If you want to run the programs without first installing, you
75 may need to set your $LD_LIBRARY_PATH environment variable so it
76 contains the build directory. eg:
78 LD_LIBRARY_PATH=libvirt/ mlvirsh/mlvirsh.opt
82 ----------------------------------------------------------------------
84 'mlvirsh' is an almost complete reimplementation of virsh, which is
85 mostly command compatible (there are a very few commands missing, and
86 some commands have a slightly different syntax, but broadly speaking
87 they are equivalent programs except that one is written in C and the
90 At the time of writing:
101 ----------------------------------------------------------------------
103 'mlvirtmanager' is a demonstration implementation of virt-manager in
104 OCaml. It is not feature-complete by any means, but does allow you to
105 show the running domains and start and stop defined domains. The main
106 functionality _missing_ is the ability to define new virtual machines,
107 change the resources allocated to domains, or show the machine
112 ----------------------------------------------------------------------
114 The interface is described in 'libvirt.mli'. The main modules are
115 Libvirt.Connect, Libvirt.Domain and Libvirt.Network, corresponding
116 respectively to the virConnect*, virDomain*, and virNetwork*
117 functions. For brevity I usually rename these modules like this:
119 module C = Libvirt.Connect
120 module D = Libvirt.Domain
121 module N = Libvirt.Network
123 To get a connection handle, do:
126 let conn = C.connect ~name ()
130 let n = C.num_of_domains conn
131 let ids = C.list_domains conn n
132 let domains = Array.map (D.lookup_by_id conn) ids
136 printf "%5d %s\n" (D.get_id dom) (D.get_name dom)
139 (See also the program list_domains.ml).
141 For documentation on these bindings, read libvirt.mli and/or 'make
142 doc' and browse the HTML documentation in the html/ subdirectory.
144 For documentation on libvirt itself, see http://libvirt.org/html/
148 ----------------------------------------------------------------------
150 libvirt/ The OCaml bindings.
151 examples/ Some example programs using the bindings.
152 mlvirsh/ 'mlvirsh' command line tool.
153 mlvirtmanager/ 'mlvirtmanager' graphical tool.
154 virt-top/ 'virt-top' tool.