On 06/15/2012 09:05 AM, Paolo Bonzini wrote: > While streaming can be dropped as soon as it progressed through the whole > image, mirroring needs to be completed manually for two reasons: 1) so that > management knows exactly when the VM switches to the target; 2) because > for other use cases such as replication, we may leave the operation running > for the whole life of the virtual machine. > > Add a new block job command that manually completes background operations. > > ## > +# @block-job-complete: > +# > +# Manually trigger completion of an active background block operation. This > +# is supported for drive mirroring, where it also switches the device to > +# write to the target path only. > +# > +# This command completes an active background block operation synchronously. > +# The ordering of this command's return with the BLOCK_JOB_COMPLETED event > +# is not defined. Note that if an I/O error occurs during the processing of > +# this command: 1) the command itself will fail; 2) the error will be processed > +# according to the rerror/werror arguments that were specified when starting > +# the operation. > +# > +# A cancelled or paused job cannot be completed. US vs. UK spelling. So 'block-job-complete' ends by pivoting or errors because it is not ready, 'block-job-cancel' without force ends with a clean mirror without pivoting or errors because it is not ready, and 'block-job-cancel' with force ends no matter what, even if it means a non-clean mirror. I think that was all the cases I asked for regarding a single disk. And hopefully we still have time to add additional patches to also support 'transaction' of combinations of these block actions across multiple disks. > +# > +# @device: the device name > +# > +# Returns: Nothing on success > +# If no background operation is active on this device, BlockJobNotActive > +# If the operation cannot be completed manually (either in general, or > +# not at the time the command is invoked), BlockJobNotReady > +# > +# Since: 1.1 1.2 -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org