• E
    blockcopy: add more XML for state tracking · 9a212d67
    Eric Blake 提交于
    Doing a blockcopy operation across a libvirtd restart is not very
    robust at the moment.  In particular, we are clearing the <mirror>
    element prior to telling qemu to finish the job.  Also, thanks to the
    ability to request async completion, the user can easily regain
    control prior to qemu actually finishing the effort, and they should
    be able to poll the domain XML to see if the job is still going.
    
    A future patch will fix things to actually wait until qemu is done
    before modifying the XML to reflect the job completion.  But since
    qemu issues identical BLOCK_JOB_COMPLETE events regardless of whether
    the job was cancelled (kept the original disk) or completed (pivoted
    to the new disk), we have to track which of the two operations were
    used to end the job.  Furthermore, we'd like to avoid attempts to
    end a job where we are already waiting on an earlier request to qemu
    to end the job.  Likewise, if we miss the qemu event (perhaps because
    it arrived during a libvirtd restart), we still need enough state
    recorded to be able to determine how to modify the domain XML once
    we reconnect to qemu and manually learn whether the job still exists.
    
    Although this patch doesn't actually fix the problem, it is a
    preliminary step that makes it possible to track whether a job
    has already begun steps towards completion.
    
    * src/conf/domain_conf.h (virDomainDiskMirrorState): New enum.
    (_virDomainDiskDef): Convert bool mirroring to new enum.
    * src/conf/domain_conf.c (virDomainDiskDefParseXML)
    (virDomainDiskDefFormat): Handle new values.
    * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Adjust
    client.
    * src/qemu/qemu_driver.c (qemuDomainBlockPivot)
    (qemuDomainBlockJobImpl): Likewise.
    * docs/schemas/domaincommon.rng (diskMirror): Expose new values.
    * docs/formatdomain.html.in (elementsDisks): Document it.
    * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Test it.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    9a212d67
domain_conf.h 86.4 KB