I'll be adding more fields to care about so splitting the code out will
be better long-term.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
Reviewed-by: Pavel Mores <pmores(a)redhat.com>
---
src/qemu/qemu_domain.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 3d3f796d85..369d9b8446 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2530,6 +2530,24 @@ qemuDomainObjPrivateXMLFormatBlockjobFormatSource(virBufferPtr
buf,
}
+static void
+qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job,
+ virBufferPtr buf)
+{
+ if (job->data.commit.base)
+ virBufferAsprintf(buf, "<base node='%s'/>\n",
job->data.commit.base->nodeformat);
+
+ if (job->data.commit.top)
+ virBufferAsprintf(buf, "<top node='%s'/>\n",
job->data.commit.top->nodeformat);
+
+ if (job->data.commit.topparent)
+ virBufferAsprintf(buf, "<topparent node='%s'/>\n",
job->data.commit.topparent->nodeformat);
+
+ if (job->data.commit.deleteCommittedImages)
+ virBufferAddLit(buf, "<deleteCommittedImages/>\n");
+}
+
+
static int
qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
const void *name G_GNUC_UNUSED,
@@ -2589,14 +2607,7 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
case QEMU_BLOCKJOB_TYPE_COMMIT:
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
- if (job->data.commit.base)
- virBufferAsprintf(&childBuf, "<base
node='%s'/>\n", job->data.commit.base->nodeformat);
- if (job->data.commit.top)
- virBufferAsprintf(&childBuf, "<top
node='%s'/>\n", job->data.commit.top->nodeformat);
- if (job->data.commit.topparent)
- virBufferAsprintf(&childBuf, "<topparent
node='%s'/>\n", job->data.commit.topparent->nodeformat);
- if (job->data.commit.deleteCommittedImages)
- virBufferAddLit(&childBuf,
"<deleteCommittedImages/>\n");
+ qemuDomainPrivateBlockJobFormatCommit(job, &childBuf);
break;
case QEMU_BLOCKJOB_TYPE_CREATE:
--
2.24.1