aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_save_msgs_gen.pl
Commit message (Collapse)AuthorAgeFilesLines
* libxl: prepare for asynchronous writing of qemu save fileIan Jackson2012-06-281-1/+1
| | | | | | | | | | | | | | | | | | * Combine the various calls to libxl__device_model_savefile into one at the start of libxl__domain_suspend, storing the result in the dss. Consequently a few functions take a dss instead of some or all of their other arguments. * Make libxl__domain_save_device_model's API into an asynchronous style which takes a callback. The function is, however, still synchronous; it will be made actually async in the next patch. * Consequently make libxl__remus_domain_checkpoint_callback into an asynchronous callback. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: wait for qemu to acknowledge logdirty commandIan Jackson2012-06-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | The current migration code in libxl instructs qemu to start or stop logdirty, but it does not wait for an acknowledgement from qemu before continuing. This might lead to memory corruption (!) Fix this by waiting for qemu to acknowledge the command. Unfortunately the necessary ao arrangements for waiting for this command are unique because qemu has a special protocol for this particular operation. Also, this change means that the switch_qemu_logdirty callback implementation in libxl can no longer synchronously produce its return value, as it now needs to wait for xenstore. So we tell the marshalling code generator that it is a message which does not need a reply. This turns the callback function called by the marshaller into one which returns void; the callback function arranges to later explicitly sends the reply to the helper, when the xs watch triggers and the appropriate value is read from xenstore. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: domain save/restore: run in a separate processIan Jackson2012-06-281-0/+397
libxenctrl expects to be able to simply run the save or restore operation synchronously. This won't work well in a process which is trying to handle multiple domains. The options are: - Block such a whole process (eg, the whole of libvirt) while migration completes (or until it fails). - Create a thread to run xc_domain_save and xc_domain_restore on. This is quite unpalatable. Multithreaded programming is error prone enough without generating threads in libraries, particularly if the thread does some very complex operation. - Fork and run the operation in the child without execing. This is no good because we would need to negotiate with the caller about fds we would inherit (and we might be a very large process). - Fork and exec a helper. Of these options the latter is the most palatable. Consequently: * A new helper program libxl-save-helper (which does both save and restore). It will be installed in /usr/lib/xen/bin. It does not link against libxl, only libxc, and its error handling does not need to be very advanced. It does contain a plumbing through of the logging interface into the callback stream. * A small ad-hoc protocol between the helper and libxl which allows log messages and the libxc callbacks to be passed up and down. Protocol doc comment is in libxl_save_helper.c. * To avoid a lot of tedium the marshalling boilerplate (stubs for the helper and the callback decoder for libxl) is generated with a small perl script. * Implement new functionality to spawn the helper, monitor its output, provide responses, and check on its exit status. * The functions libxl__xc_domain_restore_done and libxl__xc_domain_save_done now turn out to want be called in the same place. So make their state argument a void* so that the two functions are type compatible. The domain save path still writes the qemu savefile synchronously. This will need to be fixed in a subsequent patch. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>