On Wed, Jul 13, 2011 at 12:41:48PM +0200, Gerd Hoffmann wrote: > On 07/13/11 11:29, Alon Levy wrote: > >On Wed, Jul 13, 2011 at 09:10:19AM +0200, Gerd Hoffmann wrote: > >>On 07/12/11 15:55, Alon Levy wrote: > >>>Later the save will happen asynchronously on surface_updated callback. > >> > >>Hmm. I can see why you are doing that. It makes the file being > >>written *after* the monitor command finishes though, which I think > >>we should avoid. > > > >I think the simplest thing would be to add a specific cond for this - > >ppm_save_filename_cond. ok? > > Not sure. Luiz, do we have async monitor commands meanwhile? > > Background: screendump for qxl vga can take a while as the > spice-server might have to render everything first ...
Another option would be for the screenshot command to allow a pre-opened FD to be passed in. So libvirt would create a pipe(2) pass the write end of the pipe to the 'screenshot' command. The screenshot command can return from the monitor the moment it has validated that it can perform the screenshot. QEMU can then write data to the pipe in the background. libvirt (or equiv app) can likewise safely read data out of the pipe as it becomes available without any race condition. This kind of approach would actually fit better with what libvirt wants from a screenshot command, because we don't really want to have the screenshot saved to disk at all. Our API just provides applications with a stream to data the screenshot data from. Currently we create a temporary file, save the screenshot to it, and then immediately unlink it and stream data back to the app from the deleted file. If we could just use a anonymous pipe it would be much nicer 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 :|