forked from rpms/libvirt
105 lines
4.2 KiB
Diff
105 lines
4.2 KiB
Diff
|
From 4cbdc7ecefe8351e9e354c1906aba46869f220fd Mon Sep 17 00:00:00 2001
|
||
|
Message-Id: <4cbdc7ecefe8351e9e354c1906aba46869f220fd@dist-git>
|
||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||
|
Date: Mon, 16 Mar 2020 22:12:21 +0100
|
||
|
Subject: [PATCH] qemu: domain: Extract parsing of 'commit' blockjob data into
|
||
|
a function
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
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@redhat.com>
|
||
|
Reviewed-by: Pavel Mores <pmores@redhat.com>
|
||
|
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||
|
(cherry picked from commit 38d0dd08d61446455ff54e0a7b97b1a48054b7c5)
|
||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
|
||
|
Message-Id: <9689f027815d6fc799bae46ce9c12c3d55d9c728.1584391727.git.pkrempa@redhat.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
---
|
||
|
src/qemu/qemu_domain.c | 57 ++++++++++++++++++++++++++----------------
|
||
|
1 file changed, 36 insertions(+), 21 deletions(-)
|
||
|
|
||
|
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||
|
index a8ac68af92..0faf042145 100644
|
||
|
--- a/src/qemu/qemu_domain.c
|
||
|
+++ b/src/qemu/qemu_domain.c
|
||
|
@@ -3236,6 +3236,40 @@ qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlockJobDataPtr job,
|
||
|
}
|
||
|
|
||
|
|
||
|
+static int
|
||
|
+qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job,
|
||
|
+ xmlXPathContextPtr ctxt)
|
||
|
+{
|
||
|
+ if (job->type == QEMU_BLOCKJOB_TYPE_COMMIT) {
|
||
|
+ qemuDomainObjPrivateXMLParseBlockjobNodename(job,
|
||
|
+ "string(./topparent/@node)",
|
||
|
+ &job->data.commit.topparent,
|
||
|
+ ctxt);
|
||
|
+
|
||
|
+ if (!job->data.commit.topparent)
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+
|
||
|
+ qemuDomainObjPrivateXMLParseBlockjobNodename(job,
|
||
|
+ "string(./top/@node)",
|
||
|
+ &job->data.commit.top,
|
||
|
+ ctxt);
|
||
|
+ qemuDomainObjPrivateXMLParseBlockjobNodename(job,
|
||
|
+ "string(./base/@node)",
|
||
|
+ &job->data.commit.base,
|
||
|
+ ctxt);
|
||
|
+
|
||
|
+ if (virXPathNode("./deleteCommittedImages", ctxt))
|
||
|
+ job->data.commit.deleteCommittedImages = true;
|
||
|
+
|
||
|
+ if (!job->data.commit.top ||
|
||
|
+ !job->data.commit.base)
|
||
|
+ return -1;
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
static void
|
||
|
qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job,
|
||
|
xmlXPathContextPtr ctxt,
|
||
|
@@ -3255,29 +3289,10 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job,
|
||
|
break;
|
||
|
|
||
|
case QEMU_BLOCKJOB_TYPE_COMMIT:
|
||
|
- qemuDomainObjPrivateXMLParseBlockjobNodename(job,
|
||
|
- "string(./topparent/@node)",
|
||
|
- &job->data.commit.topparent,
|
||
|
- ctxt);
|
||
|
-
|
||
|
- if (!job->data.commit.topparent)
|
||
|
- goto broken;
|
||
|
-
|
||
|
- G_GNUC_FALLTHROUGH;
|
||
|
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
|
||
|
- qemuDomainObjPrivateXMLParseBlockjobNodename(job,
|
||
|
- "string(./top/@node)",
|
||
|
- &job->data.commit.top,
|
||
|
- ctxt);
|
||
|
- qemuDomainObjPrivateXMLParseBlockjobNodename(job,
|
||
|
- "string(./base/@node)",
|
||
|
- &job->data.commit.base,
|
||
|
- ctxt);
|
||
|
- if (virXPathNode("./deleteCommittedImages", ctxt))
|
||
|
- job->data.commit.deleteCommittedImages = true;
|
||
|
- if (!job->data.commit.top ||
|
||
|
- !job->data.commit.base)
|
||
|
+ if (qemuDomainObjPrivateXMLParseBlockjobDataCommit(job, ctxt) < 0)
|
||
|
goto broken;
|
||
|
+
|
||
|
break;
|
||
|
|
||
|
case QEMU_BLOCKJOB_TYPE_CREATE:
|
||
|
--
|
||
|
2.25.1
|
||
|
|