summaryrefslogtreecommitdiffstats
path: root/ocaml/t
Commit message (Collapse)AuthorAgeFilesLines
* New APIs: Model libvirt authentication events through the API.Richard W.M. Jones2012-10-131-1/+2
| | | | | | | | | | | | | | | | | | | | | This commit models libvirt authentication events through the API, adding one new event (GUESTFS_EVENT_LIBVIRT_AUTH) and several new APIs: guestfs_set_libvirt_supported_credentials guestfs_get_libvirt_requested_credentials guestfs_get_libvirt_requested_credential_prompt guestfs_get_libvirt_requested_credential_challenge guestfs_get_libvirt_requested_credential_defresult guestfs_set_libvirt_requested_credential See the documentation and example which shows how to use the new API. This commit also changes existing calls to virConnectOpen* within the library so that the new API is used. Also included is an example (but not a test, because it's hard to see how to automatically test the libvirt API).
* Replace mount-options with mount where appropriate.Richard W.M. Jones2012-08-182-2/+2
| | | | | | Since our minimum supported version is now 1.16 and mount was fixed in 1.13.16, it is now safe to replace mount-options + empty options with mount wherever it occurs.
* ocaml: Skip mount-local test if /dev/fuse is not writable.Richard W.M. Jones2012-07-201-0/+8
|
* build: Return 77 from skipped tests.Richard W.M. Jones2012-07-191-1/+1
|
* ocaml: Test mount-local, without parallel test.Richard W.M. Jones2012-07-182-96/+15
| | | | | | | | | Unfortunately the parallel test keeps hitting this bug: https://bugzilla.redhat.com/show_bug.cgi?id=838081 which could be a bug in the OCaml runtime. Just test simple mount-local. We will write a parallel test in C to replace this.
* Revert "ocaml: Calling Gc.compact before g#mount_local works around ↵Richard W.M. Jones2012-07-161-1/+0
| | | | | | | | RHBZ#838081." This reverts commit ad7c4498f66f37c4219242c6df04d28e9ee7877f. Reverted because we still see core dumps.
* generator: Rename 'add_drive_opts' API to 'add_drive'.Richard W.M. Jones2012-07-142-6/+5
| | | | | | By using the once_had_no_optargs flag, this change is backwards compatible for callers (except Haskell, PHP and GObject as discussed in earlier commit).
* ocaml: Calling Gc.compact before g#mount_local works around RHBZ#838081.Richard W.M. Jones2012-07-061-0/+1
|
* New API: guestfs_shutdown: Cleanly shutdown the backend.Richard W.M. Jones2012-07-033-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The new API splits orderly close into a two-step process: if (guestfs_shutdown (g) == -1) { /* handle the error, eg. qemu error */ } guestfs_close (g); Note that the explicit shutdown step is only necessary in the case where you have made changes to the disk image and want to handle write errors. Read the documentation for further information. This change also: - deprecates guestfs_kill_subprocess - turns guestfs_kill_subprocess into the same as guestfs_shutdown - changes guestfish and other tools to call shutdown + close where necessary (not for read-only tools) - updates documentation - updates examples
* ocaml: Allow parallel mount-local test to be skipped.Richard W.M. Jones2012-06-261-0/+13
| | | | FUSE is not very reliable on RHEL 5.
* extra-tests: ocaml: Use a short delay instead of Thread.yield.Richard W.M. Jones2012-04-121-1/+2
| | | | | | On the new faster computer, Thread.yield wasn't yielding, so the second thread would block the main test from proceeding (only when run under valgrind however).
* parallel mount-local test: Don't run more than 12 threads.Richard W.M. Jones2012-04-031-1/+5
| | | | | On the Koji builder that has lots of memory, this was trying to run something like 20 threads.
* Add test of parallel mount-local calls.Richard W.M. Jones2012-03-292-0/+241
|
* Tempus fugit.Richard W.M. Jones2012-01-183-3/+3
| | | | Update all copyright dates to 2012.
* ocaml: Load test should call Gc.compact to flag memory errors.Richard W.M. Jones2011-11-291-0/+2
|
* ocaml: Catch EVENT_ENTER case in test.Richard W.M. Jones2011-11-091-1/+2
| | | | | | | For some reason we are not compiling the tests with -warn-error so this problem was not noticed before. This fixes commit 9420eaf44ec4067c3740b91b0be0fede08a0c515.
* Update FSF address.Matthew Booth2011-11-086-6/+6
|
* New event API - OCaml bindings (RHBZ#664558).Richard W.M. Jones2011-03-152-5/+76
| | | | | | The functions set_progress_callback and clear_progress_callback have been removed, and replaced with a complete mechanism for setting and deleting general-purpose events.
* ocaml: Combine tests together to reduce number of launches.Richard W.M. Jones2010-11-303-85/+24
| | | | | | Combine launch, lvcreate and readdir tests together into a single 'basic' test, so that we don't launch the appliance so often when testing in this subdirectory.
* generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-221-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This large commit changes the generator so that optional arguments can be supported for functions. The model for arguments (known as the "style") is changed from (ret, args) to (ret, args, optargs) where optargs is a more limited list of arguments. One function has been added which takes optional arguments, it is "add-drive-opts", modelled as: (RErr, [String "filename"], #required [Bool "readonly"; String "format"; String "iface"]) #optional Note that this function is processed in the library (does not go over the RPC protocol to the daemon). This has allowed us to simplify the current implementation by omitting changes related to RPC or the daemon, although we plan to add these at some point in the future. From C this function can be called in 3 different ways as in these examples: guestfs_add_drive_opts (g, filename, GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", -1); (the argument(s) between 'filename' and '-1' are the optional ones). guestfs_add_drive_opts_va (g, filename, args); where 'args' is a va_list. This works like the first version. struct guestfs_add_drive_opts_argv optargs = { .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK, .readonly = 1, } guestfs_add_drive_opts_argv (g, filename, &optargs); This last form lets you construct lists of optional arguments, and is used by guestfish and the language bindings. In guestfish optional arguments are used like this: add-drive-opts filename readonly:true In OCaml these are mapped naturally to OCaml optional arguments, eg: g#add_drive_opts ~readonly:true filename; In Perl these are mapped to extra arguments, eg: $g->add_drive_opts ($filename, readonly => 1); In Python these are mapped to optional arguments, eg: g.add_drive_opts ("file", readonly = 1, format = "qcow2") In Ruby these are mapped to a final hash argument, eg: g.add_drive_opts("file", {}) g.add_drive_opts("file", :readonly => 1) g.add_drive_opts("file", :readonly => 1, :iface => "virtio") In PHP these are mapped to extra parameters. This is not quite accurate since you cannot omit arbitrary optional parameters, but there's not much than can be done within the limitations of PHP as a language. Unimplemented in: Haskell, C#, Java.
* ocaml: Create the handle when the object is instantiated.Richard W.M. Jones2010-10-041-1/+1
| | | | | Previously we had only one handle shared between all objects .. oops. This fixes commit 67636f721056d2f2250b0ff8acd981a0294536a9.
* ocaml: Add alternate object-oriented programming style.Richard W.M. Jones2010-10-031-1/+6
| | | | | | | | | | | | | | | | | | | | | | In original style: let () = let filename = Sys.argv.(1) in let g = Guestfs.create () in Guestfs.add_drive_ro g filename; Guestfs.launch g; let roots = Guestfs.inspect_os g in print_endline (Guestfs.inspect_get_product_name g roots.(0)) The same code in the new OO style: let () = let filename = Sys.argv.(1) in let g = new Guestfs.guestfs in g#add_drive_ro filename; g#launch (); let roots = g#inspect_os () in print_endline (g#inspect_get_product_name roots.(0))
* ocaml: Add test for progress notification callbacks.Richard Jones2010-09-011-0/+41
|
* Remove old ocaml-inspector code.Richard Jones2010-08-171-42/+0
| | | | | Not used by anyone, didn't work well, and replaced now by the C inspection APIs.
* ocaml: Fix thread safety of strings in bindings (RHBZ#604691).Richard Jones2010-06-161-0/+72
| | | | | | | | | | | | | | | | | | | | | | There's a thread safety issue with the current OCaml bindings which is well explained in the bug report: https://bugzilla.redhat.com/show_bug.cgi?id=604691 This commit fixes the safety issue by copying strings temporarily before releasing the thread lock. Updated code looks like this: char *filename = guestfs_safe_strdup (g, String_val (filenamev)); int r; caml_enter_blocking_section (); r = guestfs_add_drive_ro (g, filename); caml_leave_blocking_section (); free (filename); if (r == -1) ocaml_guestfs_raise_error (g, "add_drive_ro"); Also included is a regression test.
* Generic partition creation interface.Richard Jones2009-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a generic partition creation interface which should be future-proof and extensible, and partially replaces the old sfdisk-based interface. The implementation is based on parted but is hopefully not too dependent on the particulars of parted. The following new calls are introduced: guestfs_part_init: Initialize a disk with a partition table. Unlike the sfdisk- based interface, we also support GPT and other partition types, which is essential to scale to devices larger than 2TB. guestfs_part_add: Add a partition to an existing disk. guestfs_part_disk: Convenience function which combines part_init & part_add, creating a single partition that covers the whole disk. guestfs_part_set_bootable: guestfs_part_set_name: Set various aspects of existing partitions. guestfs_part_list: List partitions on a device. This returns a programming-friendly list of partition structs (in contrast to sfdisk-l which cannot be parsed). guestfs_part_get_parttype: Return the partition table type, eg. "msdos" or "gpt". The following calls are planned, but not added currently: guestfs_part_get_bootable guestfs_part_get_name guestfs_part_set_type guestfs_part_get_type
* inspector: Generate language bindings for OCaml.Richard Jones2009-10-131-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a generic mechanism for deriving language bindings for virt-inspector, and implements one concrete binding, for OCaml. The bindings are generated from the RELAX NG schema (virt-inspector.rng) which is supposed to be a correct and always up to date description of the XML that the virt-inspector program can generate. From the RNG we generate a set of types to describe the output of virt-inspector for the language, plus an XML parser, plus some glue code to actually run an external instance of virt-inspector and parse the resulting XML. At runtime, an external 'virt-inspector --xml <name>' command runs and the XML is parsed into language-specific structures. This has been tested on the four example files (inspector/example?.xml) The only particular difficulty about the OCaml binding is the use of Obj.magic, which is naughty but works because of the isomorphism between the representation of tuples and records in OCaml. This seems to cause no problems in my test program. Apart from this, the OCaml binding is straightforward and could be adapted easily for any other languages that want type-safe virt-inspector bindings. It's important to keep virt-inspector.rng up to date with changes to virt-inspector's XML output format.
* Remove guestfs_wait_ready (turn it into a no-op).Richard Jones2009-09-213-3/+0
| | | | | | | | | | | | | | This commit changes guestfs_launch so that it both launches the appliance and waits until it is ready (ie. the daemon communicates back to us). Since we removed the pretence that we could implement a low-level asynchronous API, the need to call launch() followed by wait_ready() has looked a bit silly. Now guestfs_wait_ready() is basically a no-op. It is left in the API for backwards compatibility. Any calls to guestfs_wait_ready() can be removed from client code.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-4/+4
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* Add 'readdir' call.Richard W.M. Jones2009-07-021-0/+54
| | | | | | | | | | | | This adds a readdir call (mostly intended for programs). The return value is a list of guestfs_dirent structures. This adds the new types 'struct guestfs_dirent' and 'struct guestfs_dirent_list', along with all the code to return these in the different language bindings. Also includes additional tests for OCaml and Perl bindings to test this.
* Additional test programs for Perl, Python, OCaml bindings.Richard Jones2009-04-133-0/+94