• E
    blockjob: add qemu capabilities related to block jobs · 6d264c91
    Eric Blake 提交于
    Upstream qemu 1.3 is adding two new monitor commands, 'drive-mirror'
    and 'block-job-complete'[1], which can drive live block copy and
    storage migration.  [Additionally, RHEL 6.3 had backported an earlier
    version of most of the same functionality, but under the names
    '__com.redhat_drive-mirror' and '__com.redhat_drive-reopen' and with
    slightly different JSON arguments, and has been using patches similar
    to these upstream patches for several months now.]
    
    The libvirt API virDomainBlockRebase as already committed for 0.9.12
    is flexible enough to expose the basics of block copy, but some
    additional features in the 'drive-mirror' qemu command, such as
    setting error policy, setting granularity, or using a persistent
    bitmap, may later require a new libvirt API virDomainBlockCopy.  I
    will wait to add that API until we know more about what qemu 1.3
    will finally provide.
    
    This patch caters only to the upstream qemu 1.3 interface, although
    I have proven that the changes for RHEL 6.3 can be isolated to
    just qemu_monitor_json.c, and the rest of this series will
    gracefully handle either interface once the JSON differences are
    papered over in a downstream patch.
    
    For consistency with other block job commands, libvirt must handle
    the bandwidth argument as MiB/sec from the user, even though qemu
    exposes the speed argument as bytes/sec; then again, qemu rounds
    up to cluster size internally, so using MiB hides the worst effects
    of that rounding if you pass small numbers.
    
    [1]https://lists.gnu.org/archive/html/qemu-devel/2012-10/msg04123.html
    
    * src/qemu/qemu_capabilities.h (QEMU_CAPS_DRIVE_MIRROR)
    (QEMU_CAPS_DRIVE_REOPEN): New bits.
    * src/qemu/qemu_capabilities.c (qemuCaps): Name them.
    * src/qemu/qemu_monitor_json.c (qemuMonitorJSONCheckCommands): Set
    them.
    (qemuMonitorJSONDriveMirror, qemuMonitorDrivePivot): New functions.
    * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDriveMirror)
    (qemuMonitorDrivePivot): Declare them.
    * src/qemu/qemu_monitor.c (qemuMonitorDriveMirror)
    (qemuMonitorDrivePivot): New passthroughs.
    * src/qemu/qemu_monitor.h (qemuMonitorDriveMirror)
    (qemuMonitorDrivePivot): Declare them.
    6d264c91
qemu_capabilities.h 11.9 KB