2019-08-21 Richard W.M. Jones Version 0.6.1.5. Use gitlog-to-changelog to generate Changelog, instead of hg. Package aclocal.m4 and config.h.in. Update MANIFEST. Update dependencies file. 2019-08-20 Pino Toscano Fix shebang in perl scripts Instead of hardcoding the location of perl (assuming it is installed in /usr), use /usr/bin/env to run it, and thus picking it from $PATH. This makes it possible to run these scripts also on installations with perl in a different prefix than /usr. Also, given that we want enable warnings on scripts, turn the -w previously in shebang to explicit "use warnings;" in scripts which didn't have it before. Update config.guess and config.sub Synchronize Virterror with libvirt 5.6.0 2019-05-28 Pino Toscano build: build with CAML_NAME_SPACE This way no non-namespaced OCaml C symbols are used, reducing the risk of clashes with other code. 2019-04-08 Pino Toscano Synchronize Virterror with libvirt 5.2.0 Implement Connect.get_domain_capabilities Wrap the virConnectGetDomainCapabilities C API. build: bump required libvirt to 1.2.8 virConnectGetAllDomainStats, used unconditionally, was introduced in libvirt 1.2.8. 2018-11-16 Pino Toscano example: fix self-dependency The bytecode list_secrets must depend on the .cmo file of its .ml source, instead on itself. Fixes commit be5973f65bfdb51bf409a31af0d046931c6d5789. 2018-11-14 Pino Toscano Cast virError* enums to int for comparisons with 0 The actual type of an enum in C is implementation defined when there are no negative values, and thus it can be int, or uint. This is the case of the virError* enums in libvirt, as they do not have negative values. Hence, to avoid hitting tautological comparison errors when checking their range, temporarly cast the enum values to int when checking they are not negative. The check is there to ensure the value is within the range of the OCaml type used to represent it. Reviewed-by: Andrea Bolognani Reviewed-by: Richard W.M. Jones 2018-10-15 Pino Toscano doc: invoke ocamldoc with -colorize-code This way, the OCaml snippets are colorized. The OCaml version required is higher than the first version shipping ocamldoc with this option, so that can be done unconditionally. build: use pkg-config to find libvirt Rely on pkg-config to detect libvirt, and use its variables to locate it. The version required is taken from the API documentation. build: remove config.h.in It is generated by autoheader, no need to keep it in the sources. build: sync OCaml macros from libguestfs Less old version, and work better with newer versions of autoconf. Adapt configure.ac to it: - use the different variable names set by AC_CHECK_OCAML_PKG - remove the comment about using ocamlfind, as it is what the new macros do already build: move OCaml macros to a m4 subdir This way they will not be overwritten when aclocal.m4 is changed. 2018-10-10 Pino Toscano Reorganize .gitignore - move all the general patterns to the top - tie all the entries specific to the top-level to the current directory - remove old/obsolete entries - add a missing example - sort all the entries build: do not set LIBRARY_PATH & LD_LIBRARY_PATH They do not actually help, and rather get in the way when using them to point to a custom location of libvirt. Various small API doc improvements Synchronize few states/types with libvirt 4.6.0 Add states/types that do not require using enum values in newer libvirt versions. Fix broken libvirt links Split a single broken link into 3 sections that replaced the old page. Switch all the links to https This does not fix broken links. Libvirt_version: fix license comment Do not use the ocamldoc comment for it, since there is no need to put the copyright/license block in the generated API documentation. Expose Secret API Add a new Secret submodule to expose most of the virSecret* APIs, so it is possible to interact with libvirt secrets. Add the needed glue in the generator, in the helper macros/functions, and in the Libvirt module itself. Include a simple example, list_secrets.ml. examples: switch from C.connect_readonly to connect_auth_readonly This way it is possible to connect to URIs that require some kind of authentication. Implement Connect.get_auth_default () Add a function to return the default libvirt authentication handler, in case it is needed. Followup of commit 948dd7af4581493dfc3945f0f1762dc5d6c2bd95. Make Optstring_val return const char * The users just read the result, never changing it. This also fixes the build in case CAML_SAFE_STRING is defined (which makes String_val() return const char *). Update config.guess and config.sub Update config.guess and config.sub from their canonical upstream location, after 12 years. Remove note from the TODO file Authentication was implemented with commit 948dd7af4581493dfc3945f0f1762dc5d6c2bd95. 2018-10-10 Richard W.M. Jones Update MANIFEST 2018-10-10 Pino Toscano Drop the generated libvirt_c.c from the sources Let it be autogenerated from the generator.pl script during build, with no need to keep a copy of it in the sources. This also makes Perl an hard requirement, checking for its presence at configure time. Disable -Wmissing-prototypes for GCC We do not provide prototypes for all the C implementations of OCaml APIs, so just make GCC not warn about that for now. Register a custom exception printer This way all the users of ocaml-libvirt can use Printexc.to_string to print a Virterror exception, even in case they do not catch it explicitly. Avoid VLAs with size depending on user input Do not use var-length arrays with sizes from user input (like parameters), since they may grow the stack too much. Instead, allocate the memory on the heap. Workaround lack of constness in custom_operations::identifier Sadly the custom_operations struct of the OCaml C API uses char* for the 'identifier' member, even though it does not change it. To avoid getting warnings when building with stricter CFLAGS, apply ugly casts. Add an helper CHECK_ERROR_CLEANUP macro Extend the existing CHECK_ERROR macro to allow some code to be executed right before raising Virterror. Rework CHECK_ERROR to use CHECK_ERROR_CLEANUP. Add Domain.get_xml_desc_flags Much like Domain.get_xml_desc with the possibility to specify flags for the XML description. The function is marked with a [`W] phantom because some of the flags (e.g. XmlSecure) require a read/write connection. Synchronize Virterror with libvirt 4.6.0 In particular, add all the various error codes, and error domains. Also, add an older domain that was previously skipped. Connect: add auth/credential handling for connect Add OCaml versions of virConnectCredential & virConnectAuth structs, using them to implement proper connect_auth & connect_auth_readonly. This makes it possible to properly supply credentials when opening a connection. Add Val_opt_const & Val_const_ptr_t Counterparts of Val_opt & Val_ptr_t, but with constness for the pointer. 2018-10-10 Richard W.M. Jones Use -safe-string and fix the library. Note this changes the type of the cpumap from string to bytes, since (by the design of the API) it must be mutated. Change binding of virConnectGetAllDomainStats to return dom UUID. The virDomainPtr object returned by this binding isn't a reliable virDomainPtr object. The only thing we can safely do with it is to get its UUID. Modify the API correspondingly. Updates commit 652f883f365d8caa7b841b7a3b19a4719402a92f. examples: Print more stats in the get_all_domain_stats.ml example. Updates commit 652f883f365d8caa7b841b7a3b19a4719402a92f. Add a binding for virConnectGetAllDomainStats (RHBZ#1390171). Update dependencies. Use -g -warn-error. Use -g for ocamlopt. ocamlopt has supported generating DWARF information for quite a long time. Also use -warn-error with the same set of warnings as is used by libguestfs. Fix a warning in examples/get_cpu_stats.ml found by enabling -warn-error. Remove unused 'not_supported' function. Found by compiling under GCC 6. The warning was: In file included from libvirt_c.c:2058:0: libvirt_c_epilogue.c:89:1: error: 'not_supported' defined but not used [-Werror=unused-function] not_supported (const char *fn) ^~~~~~~~~~~~~ Don't bother checking return from virInitialize. The Perl bindings don't do this, and it seems that the call can never fail, or if it does we don't care. Suppress errors to stderr and use thread-local virErrorPtr This allows us to capture errors that happen during virConnectOpen, without spewing error messages on stderr. The patch is rather large, only because we don't need to pass the virConnectPtr argument to CHECK_ERROR/_raise_virterror any longer. Add a binding for virDomainCreateXML. This is more modern than the ancient virDomainCreateLinux API, and crucially allows you to pass flags such as AUTODESTROY. Use C99 standard int64_t instead of OCaml defined (and soon to go) int64. Kill broken NSIS support. Version 0.6.1.4. Update MANIFEST. Version 0.6.1.3. Update dependencies. 2018-10-10 David Scott Add a simple example to show how to receive event callbacks Add event callback implementation based on virConnectDomainEventRegisterAny A client may register a callback as follows: E.register_default_impl (); let conn = C.connect_readonly ?name () in let id = E.register_any conn (E.Lifecycle (fun dom e -> printd dom "Lifecycle %s" (E.Lifecycle.to_string e) )) in Internally this will: 1. generate a unique int64 used to identify the specific callback 2. add the callback to an OCaml hashtable based on the signature (there is a distinct hashtable per callback signature) 3. call virConnectDomainEventRegisterAny which registers a generic C callback in the stubs (one distinct callback per signature) and supply the int64 as the "opaque" data The client must enter the event loop with: while true do E.run_default_impl () done When an event is triggered, the C callback will upcall into an OCaml function (having re-acquired the heap lock) supplying the int64 value. The OCaml function can then find the right callback in the Hashtbl and call it. The client can deregister the callback with: E.deregister_any conn id; Add binding for virConnectSetKeepAlive This one is a 'one-off' but it ought to be possible to use the generator to create the function (it has signature 'conn, int, int : int') This function first appeared in libvirt version 0.9.8. Remove backwards compatability logic to simplify the bindings Rather than compile against old versions of libvirt and resort to throwing 'not supported' exceptions at runtime, we instead require all symbols and definitions to be available at compile-time i.e. we require a much more recent libvirt. Fix typo in ocaml_libvirt_storage_vol_get_info The info.capacity was being overwritten with the info.allocation. 2018-10-10 Richard W.M. Jones Update dependencies. 2018-10-10 David Scott Functions returning "unit" correspond to C fns which use -1 for failure This affects the following functions: virStoragePoolBuild virStoragePoolDelete virStorageVolDelete Previously a call to virStorageVolDelete would succeed returning 0, which was interpreted as false, causing us to raise an exception with VIR_ERR_NONE. Volume.delete takes a flags parameter This corrects a mismatch between the generated C stubs and the .ml interface. Correct typos in the storage interface's phantom types A connection is either read/write (type rw = [`R|`W]) or read/only (type ro = [`R]). A function which requires the ability to write needs to take a parameter [> `W] rather than [`W] (which would correspond to a write-only connection). We can now use a read/write connection to call: Pool.set_autostart Volume.create_xml Volume.delete 2018-10-10 Richard W.M. Jones Add contrib directory, and non-upstream patch to add Domain.get_cpu_stats_total. This patch needs more thorough review. 2018-10-10 Hu Tao remove parameter nr_pcpus of Libvirt.Domain.get_cpu_stats remove the value because we can get it from the libvirt API 2018-10-10 Richard W.M. Jones Version 0.6.1.2. Domain.get_cpu_stats: get number of params correctly (thanks Eric Blake). See: https://www.redhat.com/archives/libvir-list/2012-March/msg00306.html This fixes commit da9feb9e52c6edb90bf3b6869cff3b3992225757. 2012-03-06 Richard W.M. Jones Version 0.6.1.1. 2012-03-06 Lai Jiangshan ocaml-libvirt: add D.get_cpu_stats() API to ocaml-libvirt Changed from V3: use new virDomainGetCPUStats() libvirt-API. use C code to construct the typed_param list array 2012-03-06 Richard W.M. Jones Remove virConnectListAllDomains. This was never in a released libvirt. Add header to Make.rules.in. Remove obsolete: mlvirsh, gettext support, Windows installer. 2012-03-05 Richard W.M. Jones Remove .hgignore. Remove jobs API. This was never in a released libvirt. 2009-11-16 Richard Jones Add .gitignore file. 2009-03-10 Richard W.M. Jones Correct to-do list. Version 0.6.1.0 for release. Correct mlvirsh for new read-write connection. virDomainBlockPeek and virDomainMemoryPeek need a read/write connection (CVE-2008-5086) (found by David Lutterkort). 2008-09-03 Richard W.M. Jones D.get_id returns -1 for inactive domains instead of throwing an error. Don't duplicate unnecessary call to D.get_info. Implement version 3 of virConnectListAllDomains. 2008-09-01 Richard W.M. Jones Add support for virConnectListAllDomains call. 2008-08-29 Richard W.M. Jones Revert previous change. Use CAMLreturn0 to avoid a warning. 2008-08-14 Richard W.M. Jones Allow destdir options to be passed to 'make install' (Guillaume Rousse). 2008-07-09 Richard W.M. Jones Split peek requests into maximum-sized chunks. Add Domain.max_peek function to determine maximum size of peek requests. Don't pass -destdir parameter to ocamlfind. Version 0.4.4.2. 2008-07-07 Richard W.M. Jones Version 0.4.4.1 for release. Changed INRIA to Red Hat (for Debian) Files missed by 'make distclean' (for Debian) Removed old ChangeLog file. Clarify the license again for Debian. Revert previous commit. Reference the license from LGPL files (for Debian). Clarify the license for Debian. 2008-07-04 Richard W.M. Jones Split 'make install' into separate 'make install-opt' and 'make install-byte' (Sylvain Le Gall, via Debian) 2008-06-10 Richard W.M. Jones Remove some old virt-top stuff. Auto-generate ChangeLog. Deprecate ChangeLog file. Version 0.4.2.4 for release. Missing dependencies. List* functions throw exceptions if maxids = 0, so bypass this case. 2008-06-09 Richard W.M. Jones Version 0.4.2.3. 2008-06-05 Richard W.M. Jones Fix some bugs in the implementation of virDomainMemoryPeek Updated MANIFEST Add domblkpeek, dommempeek commands and add per-argument help. Add support for virDomainBlockPeek, virDomainMemoryPeek and remove the deprecated conn/dom/net fields in virterror. Remove Windows cruft from when it was lacking ocamlfind. 2008-05-27 Richard W.M. Jones Brazilian Portuguese translation by Herli Joaquim de Menezes and revised by Igor Pires Soares. 2008-04-16 Richard W.M. Jones Just the OCaml bindings (C library). Initial import from old virt-top repository.