On Fri, Jul 08, 2011 at 01:34:09AM +0200, Jiri Denemark wrote: > Query commands are safe to be called during long running jobs (such as > migration). This patch makes them all work without the need to > special-case every single one of them. > > The patch introduces new job.asyncCond condition and associated > job.asyncJob which are dedicated to asynchronous (from qemu monitor > point of view) jobs that can take arbitrarily long time to finish while > qemu monitor is still usable for other commands. > > The existing job.active (and job.cond condition) is used all other > synchronous jobs (including the commands run during async job). > > Locking schema is changed to use these two conditions. While asyncJob is > active, only allowed set of synchronous jobs is allowed (the set can be > different according to a particular asyncJob) so any method that > communicates to qemu monitor needs to check if it is allowed to be > executed during current asyncJob (if any). Once the check passes, the > method needs to normally acquire job.cond to ensure no other command is > running. Since domain object lock is released during that time, asyncJob > could have been started in the meantime so the method needs to recheck > the first condition. Then, normal jobs set job.active and asynchronous > jobs set job.asyncJob and optionally change the list of allowed job > groups. > > Since asynchronous jobs only set job.asyncJob, other allowed commands > can still be run when domain object is unlocked (when communicating to > remote libvirtd or sleeping). To protect its own internal synchronous > commands, the asynchronous job needs to start a special nested job > before entering qemu monitor. The nested job doesn't check asyncJob, it > only acquires job.cond and sets job.active to block other jobs. > --- > src/qemu/qemu_domain.c | 219 +++++++++++++++++++++++++++++++++++++-------- > src/qemu/qemu_domain.h | 82 +++++++++++++---- > src/qemu/qemu_driver.c | 122 +++++++++++++------------- > src/qemu/qemu_hotplug.c | 38 ++++---- > src/qemu/qemu_migration.c | 152 ++++++++++++++++++------------- > src/qemu/qemu_process.c | 42 +++++---- > 6 files changed, 439 insertions(+), 216 deletions(-) ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list