From 4e797f1af98a3d137ce4d47d7cc33cf0e09eeee3 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 13 Mar 2019 16:08:13 +0100 Subject: [PATCH] conf: Parse and format 'backingStore' for disk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the block copy operation is started with a reused external file in incremental mode libvirt will need to open and insert the backing chain for that file into qemu (in -blockdev mode). This means that we'll need to track the backing chain and metadata such as node names for the full chain of . This patch invokes the full backing chain formatter and parser for so that the chain can be kept with . Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 5 +++++ tests/qemustatusxml2xmldata/blockjob-mirror-in.xml | 13 +++++++++++++ tests/qemuxml2argvdata/disk-mirror.xml | 6 ++++++ tests/qemuxml2xmloutdata/disk-mirror-active.xml | 6 ++++++ 5 files changed, 31 insertions(+) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 1828e0795b..623ef28719 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5676,6 +5676,7 @@ + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cde19a8a52..c38102a510 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9349,6 +9349,8 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, if (virDomainStorageSourceParse(mirrorNode, ctxt, def->mirror, flags, xmlopt) < 0) return -1; + if (virDomainDiskBackingStoreParse(ctxt, def->mirror, flags, xmlopt) < 0) + return -1; } else { /* For back-compat reasons, we handle a file name encoded as * attributes, even though we prefer modern output in the style of @@ -24031,6 +24033,9 @@ virDomainDiskDefFormatMirror(virBufferPtr buf, if (virDomainDiskSourceFormat(&childBuf, disk->mirror, 0, false, flags, xmlopt) < 0) return -1; + if (virDomainDiskBackingStoreFormat(&childBuf, disk->mirror, xmlopt, flags) < 0) + return -1; + if (virXMLFormatElement(buf, "mirror", &attrBuf, &childBuf) < 0) return -1; diff --git a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml index 32bde1ba66..df23ac00aa 100644 --- a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml @@ -65,6 +65,7 @@ +
@@ -76,6 +77,18 @@ + + + + + + + + + + + +
diff --git a/tests/qemuxml2argvdata/disk-mirror.xml b/tests/qemuxml2argvdata/disk-mirror.xml index e89eee47ed..c1e6e94e33 100644 --- a/tests/qemuxml2argvdata/disk-mirror.xml +++ b/tests/qemuxml2argvdata/disk-mirror.xml @@ -36,6 +36,7 @@ + @@ -45,6 +46,11 @@ + + + + + diff --git a/tests/qemuxml2xmloutdata/disk-mirror-active.xml b/tests/qemuxml2xmloutdata/disk-mirror-active.xml index d689eac6b8..32ffc647be 100644 --- a/tests/qemuxml2xmloutdata/disk-mirror-active.xml +++ b/tests/qemuxml2xmloutdata/disk-mirror-active.xml @@ -40,6 +40,7 @@ +
@@ -51,6 +52,11 @@ + + + + +