Do not output the </backingStore> element in the xml if the backing
chain ends with a volume specification unknown by libvirt.
---
src/conf/domain_conf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 189a4e8..2170607 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15589,6 +15589,7 @@ virDomainDiskSourceFormat(virBufferPtr buf,
static int
virDomainDiskBackingStoreFormat(virBufferPtr buf,
virStorageSourcePtr backingStore,
+ int parentType,
const char *backingStoreRaw,
unsigned int idx)
{
@@ -15596,7 +15597,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
const char *format;
if (!backingStore) {
- if (!backingStoreRaw)
+ if (!backingStoreRaw && parentType != VIR_STORAGE_TYPE_RAW)
virBufferAddLit(buf, "<backingStore/>\n");
return 0;
}
@@ -15626,6 +15627,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, 0, true) < 0 ||
virDomainDiskBackingStoreFormat(buf,
backingStore->backingStore,
+ backingStore->type,
backingStore->backingStoreRaw,
idx + 1) < 0)
return -1;
@@ -15751,6 +15753,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
* persistent storage of backing chains is ready. */
if (!(flags & VIR_DOMAIN_XML_INACTIVE) &&
virDomainDiskBackingStoreFormat(buf, def->src->backingStore,
+ def->src->type,
def->src->backingStoreRaw, 1) < 0)
return -1;
--
2.0.2