[libvirt] [PATCH v2 08/29] qemu: domain: Modify <migrationSource> to look like <disk>

Ján Tomko jtomko at redhat.com
Tue Apr 2 07:10:17 UTC 2019


On Fri, Mar 22, 2019 at 07:00:44PM +0100, Peter Krempa wrote:
>When adding <migrationSource> I've used a slightly unusual approach. To
>allow using the disk source XML parser and formatter convert
><migrationSource> to look like <disk>. This means that <source> will be
>added as a subelement of <migrationSource> rather than being formatted
>inline.
>
>Conversion from the old format in the parser is very simple as it
>involves only moving the XPath context current node slightly if the new
>format is found.
>
>The status XML to XML test shows that the upgrade is done correctly.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_domain.c                        | 23 ++++++------
> .../migration-out-nbd-tls-in.xml              | 18 +++++-----
> .../migration-out-nbd-tls-out.xml             | 36 ++++++++++---------
> 3 files changed, 41 insertions(+), 36 deletions(-)
>
>@@ -2759,6 +2755,9 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
>         goto cleanup;
>     }
>

This deserves a comment. One of these should do:

/* newer libvirt uses the <source> subelement instead of formatting the
 * source directly into <migrationSource> */

/* crazy backcompat stuff */

/* prefer the <source> subelement if present */

/* this is source */

>+    if ((sourceNode = virXPathNode("./source", ctxt)))
>+        ctxt->node = sourceNode;
>+
>     if (virDomainStorageSourceParse(ctxt->node, ctxt, migrSource,
>                                     VIR_DOMAIN_DEF_PARSE_STATUS, NULL) < 0)
>         goto cleanup;

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190402/9eaa9d63/attachment-0001.sig>


More information about the libvir-list mailing list