• E
    blockcopy: add qemu implementation of new tunables · eef91f94
    Eric Blake 提交于
    Upstream qemu 1.4 added some drive-mirror tunables not present
    when it was first introduced in 1.3.  Management apps may want
    to set these in some cases (for example, without tuning
    granularity down to sector size, a copy may end up occupying
    more bytes than the original because an entire cluster is
    copied even when only a sector within the cluster is dirty,
    although tuning it down results in more CPU time to do the
    copy).  I haven't personally needed to use the parameters, but
    since they exist, and since the new API supports virTypedParams,
    we might as well expose them.
    
    Since the tuning parameters aren't often used, and omitted from
    the QMP command when unspecified, I think it is safe to rely on
    qemu 1.3 to issue an error about them being unsupported, rather
    than trying to create a new capability bit in libvirt.
    
    Meanwhile, all versions of qemu from 1.4 to 2.1 have a bug where
    a bad granularity (such as non-power-of-2) gives a poor message:
    error: internal error: unable to execute QEMU command 'drive-mirror': Invalid parameter 'drive-virtio-disk0'
    
    because of abuse of QERR_INVALID_PARAMETER (which is supposed to
    name the parameter that was given a bad value, rather than the
    value passed to some other parameter).  I don't see that a
    capability check will help, so we'll just live with it (and it
    has since been improved in upstream qemu).
    
    * src/qemu/qemu_monitor.h (qemuMonitorDriveMirror): Add
    parameters.
    * src/qemu/qemu_monitor.c (qemuMonitorDriveMirror): Likewise.
    * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDriveMirror):
    Likewise.
    * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDriveMirror):
    Likewise.
    * src/qemu/qemu_driver.c (qemuDomainBlockCopyCommon): Likewise.
    (qemuDomainBlockRebase, qemuDomainBlockCopy): Adjust callers.
    * src/qemu/qemu_migration.c (qemuMigrationDriveMirror): Likewise.
    * tests/qemumonitorjsontest.c (qemuMonitorJSONDriveMirror): Likewise.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    eef91f94
qemu_monitor.h 33.6 KB