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(a)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(a)redhat.com>
Jano