[libvirt] [PATCH v3 4/5] blockcommit: track job type in xml

Peter Krempa pkrempa at redhat.com
Thu Jun 12 11:51:21 UTC 2014


On 06/11/14 18:27, Eric Blake wrote:
> A future patch is going to wire up qemu active block commit jobs;
> but as they have similar events and are canceled/pivoted in the
> same way as block copy jobs, it is easiest to track all bookkeeping
> for the commit job by reusing the <mirror> element.  This patch
> adds domain XML to track which job was responsible for creating a
> mirroring situation, and adds a job='copy' attribute to all
> existing uses of <mirror>.  Along the way, it also massages the
> qemu monitor backend to read the new field in order to generate
> the correct type of libvirt job (even though it requires a
> future patch to actually cause a qemu event that can be reported
> as an active commit).
> 
> * docs/schemas/domaincommon.rng: Enhance schema.
> * docs/formatdomain.html.in: Document it.
> * src/conf/domain_conf.h (_virDomainDiskDef): Add a field.
> * src/conf/domain_conf.c (virDomainBlockJobType): String conversion.
> (virDomainDiskDefParseXML): Parse job type.
> (virDomainDiskDefFormat): Output job type.
> * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Distinguish
> active from regular commit.
> * src/qemu/qemu_driver.c (qemuDomainBlockCopy): Set job type.
> (qemuDomainBlockPivot, qemuDomainBlockJobImpl): Clean up job type
> on completion.
> * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml:
> Update tests.
> * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise.
> * tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml: New
> file.
> * tests/qemuxml2xmltest.c (mymain): Drive new test.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  docs/formatdomain.html.in                          | 20 ++++++------
>  docs/schemas/domaincommon.rng                      |  6 ++++
>  src/conf/domain_conf.c                             | 24 ++++++++++++++
>  src/conf/domain_conf.h                             |  1 +
>  src/qemu/qemu_driver.c                             |  3 ++
>  src/qemu/qemu_process.c                            | 18 +++++++----
>  .../qemuxml2argv-disk-active-commit.xml            | 37 ++++++++++++++++++++++
>  .../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml  |  4 +--
>  .../qemuxml2xmlout-disk-mirror-old.xml             |  4 +--
>  tests/qemuxml2xmltest.c                            |  1 +
>  10 files changed, 98 insertions(+), 20 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml
> 

ACK, although this patch pointed me to a problem. If you do a block-copy
of a network disk to a local file (which seems from the code that it's
allowed) and the mirror is being pivoted to the new disk we don't update
the disk type in the code and thus would end up with a very damaged VM.
Fortunately for block-copy this isn't a major problem as the VM has to
be transient, but will be fatal for the active-commit code.

Peter



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140612/0f439407/attachment-0001.sig>


More information about the libvir-list mailing list