提交 734352d4 编写于 作者: P Peter Krempa

qemu: domain: Allow formatting top source only in qemuDomainObjPrivateXMLFormatBlockjobFormatChain

Rename qemuDomainObjPrivateXMLFormatBlockjobFormatChain to
qemuDomainObjPrivateXMLFormatBlockjobFormatSource and add a 'chain'
parameter which allows controlling whether the backing chain is
formatted.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 60b862cf
...@@ -2315,10 +2315,11 @@ typedef struct qemuDomainPrivateBlockJobFormatData { ...@@ -2315,10 +2315,11 @@ typedef struct qemuDomainPrivateBlockJobFormatData {
static int static int
qemuDomainObjPrivateXMLFormatBlockjobFormatChain(virBufferPtr buf, qemuDomainObjPrivateXMLFormatBlockjobFormatSource(virBufferPtr buf,
const char *chainname, const char *element,
virStorageSourcePtr src, virStorageSourcePtr src,
virDomainXMLOptionPtr xmlopt) virDomainXMLOptionPtr xmlopt,
bool chain)
{ {
VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
...@@ -2333,10 +2334,11 @@ qemuDomainObjPrivateXMLFormatBlockjobFormatChain(virBufferPtr buf, ...@@ -2333,10 +2334,11 @@ qemuDomainObjPrivateXMLFormatBlockjobFormatChain(virBufferPtr buf,
if (virDomainDiskSourceFormat(&childBuf, src, "source", 0, true, xmlflags, xmlopt) < 0) if (virDomainDiskSourceFormat(&childBuf, src, "source", 0, true, xmlflags, xmlopt) < 0)
return -1; return -1;
if (virDomainDiskBackingStoreFormat(&childBuf, src, xmlopt, xmlflags) < 0) if (chain &&
virDomainDiskBackingStoreFormat(&childBuf, src, xmlopt, xmlflags) < 0)
return -1; return -1;
if (virXMLFormatElement(buf, chainname, &attrBuf, &childBuf) < 0) if (virXMLFormatElement(buf, element, &attrBuf, &childBuf) < 0)
return -1; return -1;
return 0; return 0;
...@@ -2375,17 +2377,19 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload, ...@@ -2375,17 +2377,19 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
virBufferAddLit(&childBuf, "/>\n"); virBufferAddLit(&childBuf, "/>\n");
} else { } else {
if (job->chain && if (job->chain &&
qemuDomainObjPrivateXMLFormatBlockjobFormatChain(&chainsBuf, qemuDomainObjPrivateXMLFormatBlockjobFormatSource(&chainsBuf,
"disk", "disk",
job->chain, job->chain,
data->xmlopt) < 0) data->xmlopt,
true) < 0)
return -1; return -1;
if (job->mirrorChain && if (job->mirrorChain &&
qemuDomainObjPrivateXMLFormatBlockjobFormatChain(&chainsBuf, qemuDomainObjPrivateXMLFormatBlockjobFormatSource(&chainsBuf,
"mirror", "mirror",
job->mirrorChain, job->mirrorChain,
data->xmlopt) < 0) data->xmlopt,
true) < 0)
return -1; return -1;
if (virXMLFormatElement(&childBuf, "chains", NULL, &chainsBuf) < 0) if (virXMLFormatElement(&childBuf, "chains", NULL, &chainsBuf) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册