[libvirt] [PATCH 4/9] qemu: blockjob: Register disk->mirror with a job only when required

Eric Blake eblake at redhat.com
Wed Jul 24 22:02:46 UTC 2019


On 7/24/19 4:07 PM, Peter Krempa wrote:
> Commit job for example references existing storage in the <mirror>
> subelement thus tracking it separately could lead into problems.

Grammar is hard to parse, maybe:

The <mirror> subelement is used in two ways: in a commit job to point to
existing storage, and in a block-copy job to point to additional
storage. We need a way to track only the distinct storage.

> 
> This patch introduces qemuBlockJobDiskRegisterMirror which registers the
> mirror chain separately only for job which require it. This also comes

for jobs which

> with remembering that in the status XML.
> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---

> +++ b/src/qemu/qemu_blockjob.c
> @@ -126,6 +126,9 @@ qemuBlockJobDataNew(qemuBlockJobType type,
>   *
>   * This function registers @job with @disk and @vm and records it into the status
>   * xml (if @savestatus is true).
> + *
> + * Note that if @job also references a separate chain e.g. for disk mirroring
> + * qemuBlockJobDiskRegisterMirror should be used.

a separate chain, e.g. for disk mirroring, then qemuBlock...

> +++ b/src/qemu/qemu_domain.c
> @@ -2367,7 +2367,10 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
>      virBufferEscapeString(&childBuf, "<errmsg>%s</errmsg>", job->errmsg);
> 
>      if (job->disk) {
> -        virBufferEscapeString(&childBuf, "<disk dst='%s'/>\n", job->disk->dst);
> +        virBufferEscapeString(&childBuf, "<disk dst='%s'", job->disk->dst);
> +        if (job->mirrorChain)
> +            virBufferAddLit(&childBuf, " mirror='yes'");

Is there any RNG grammar tweak needed to permit this? Or is the private
XML block internal only (if the user can never see it via
virXYZGetXMLDesc, then they have no reason to submit it during
virXYZCreate, so we have no reason to teach the RNG validation to ignore
it).

Wording fixes are minor, so
ACK

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

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


More information about the libvir-list mailing list