On Mon, Mar 18, 2019 at 04:55:00PM +0100, Peter Krempa wrote:
Move the recursion to format the full backing store into
virDomainDiskSourceFormat controlled by a new argument so that it's
simpler to reuse in other places.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_conf.c | 30 +++++++++++++++---------------
src/conf/domain_conf.h | 1 +
src/conf/snapshot_conf.c | 2 +-
tests/qemublocktest.c | 2 +-
tests/virstoragetest.c | 2 +-
5 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9d738f06cd..b67f9bbd2c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23954,6 +23950,7 @@ virDomainDiskSourceFormat(virBufferPtr buf,
unsigned int flags,
bool seclabels,
bool attrIndex,
+ bool backingStore,
Eww, third bool in a row.
virDomainXMLOptionPtr xmlopt)
{
VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
@@ -23962,10 +23959,18 @@ virDomainDiskSourceFormat(virBufferPtr buf,
virBufferSetChildIndent(&childBuf, buf);
if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags,
- seclabels, attrIndex, policy, xmlopt) < 0)
+ seclabels, attrIndex,
+ policy, xmlopt) < 0)
Unrelated whitespace change.
return -1;
- return virXMLFormatElement(buf, "source", &attrBuf, &childBuf);
+ if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) <
0)
+ return -1;
You changed this just a few commits ago.
+
+ if (backingStore && src->backingStore &&
Will the src->backingStore condition be necessary here?
virDomainDiskBackingStoreFormat currently returns 0 for NULL source.
+ virDomainDiskBackingStoreFormat(buf, src->backingStore,
xmlopt, flags) < 0)
+ return -1;
+
+ return 0;
}
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano