mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
As a previous, incorrect attempt to fix RHBZ#576879 we tried to
prevent the daemon from sending an error reply if the daemon had
cancelled the transfer. This is wrong: the daemon should send an
error reply in these cases.
A simple test case is this:
guestfish -N fs -m /dev/sda1 upload big-file /
(This fails because the target "/" is a directory, not a file.)
Prior to this commit, libguestfs would hang instead of printing an
error. With this commit, libguestfs prints an error.
What is happening is:
(1) Library is uploading
a file (2) In the middle of the long
upload, daemon detects an error.
Daemon cancels.
(3) Library detects cancel,
sends cancel chunk, then waits
for the error reply from the
daemon. (4) Daemon is supposed to send
an error reply message.
Because step (4) wasn't happening, uploads that failed like this would
hang in the library (waiting for the error message, while the daemon
was waiting for the next request).
This also adds a regression test.
This temporarily breaks the "both ends cancel" case (RHBZ#576879c5).
Therefore the test for that is disabled, and this is fixed in the next
patch in the series.
This partially reverts commit dc706a639e.
This program generates a large amount of code and documentation for all the daemon actions. To add a new action there are only two files you need to change, 'generator_actions.ml' to describe the interface, and daemon/<somefile>.c to write the implementation. After editing these files, build it (make -C generator) to regenerate all the output files. 'make' will rerun this automatically when necessary. IMPORTANT: This program should NOT print any warnings at compile time or run time. If it prints warnings, you should treat them as errors. OCaml tips: (1) In emacs, install tuareg-mode to display and format OCaml code correctly. 'vim' comes with a good OCaml editing mode by default. (2) Read the resources at http://ocaml-tutorial.org/ (3) A module called 'Generator_foo' is defined in one or two files called 'generator_foo.mli' and 'generator_foo.ml' (NB: lowercase first letter). The *.mli file, if present, defines the public interface for the module. The *.ml file is the implementation. If the *.mli file is missing then everything is exported. Some notable files in this directory: generator_actions.ml The libguestfs API. generator_structs.ml Structures returned by the API. generator_c.ml Generate C API. generator_<lang>.ml Generate bindings for <lang>. generator_main.ml The main generator program.