[PATCH 0/8] Implement user cancellation
This patch series implements user cancellation. What this means is that the "user" (or any library caller) can cancel certain long-running operations. Currently it is only possible to cancel upload and download operations (ie. anything in the generator which uses FileIn and FileOut). The mechanism in the protocol to implement cancellation already exists, and it is already used to cancel transfers where there is an error. For example, if the library gets an error while reading a local file during an upload, it already cancels the transfer. Therefore the only thing left to do is to expose cancellation to library callers. This is done through the new API call: void guestfs_user_cancel (guestfs_h *g); This call is signal safe and thread safe. It is, in fact, designed to be called from a SIGINT signal handler (to handle ^C being pressed by the user during a transfer). You could also wire it up to a cancel button called from another thread, or use it in other ways. There are three main complexities to this patch series: (1) We need to implement process groups (see patch 2/8). This is because otherwise the terminal sends ^C to the qemu process (because it is in the same process group as the parent), killing it. In order to catch ^C in guestfish, we need guestfish and the subprocesses to be in different process groups. (2) The language bindings need to be signal safe. This turns out to be simple for OCaml, Perl and Ruby. However Python doesn't have any clear way to make functions signal safe, and so I did not implement a Python binding for now. (3) There is a multithreaded test program (capitests/test-user-cancel.c) which performs an upload and a download and attempts to cancel it at the same time. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
participants (1)
-
Richard W.M. Jones