From 5278c00147b0ac777d5ddd73062d0c6146da4908 Mon Sep 17 00:00:00 2001 Message-Id: <5278c00147b0ac777d5ddd73062d0c6146da4908@dist-git> From: Peter Krempa Date: Tue, 4 Feb 2020 15:08:21 +0100 Subject: [PATCH] qemu: blockjob: Store 'jobflags' with block job data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a variable which will store the contents of the 'flags' variable as passed in by the individual block jobs. Since the flags may influence behaviour of the jobs it's important to preserve them to the finalization steps. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko (cherry picked from commit 9ba804a1d16b12dac2ec2edbd0f384c21d4bc5c8) https://bugzilla.redhat.com/show_bug.cgi?id=1207659 Message-Id: <81db2d5e281716bf385d6d9c634136e36e8bd391.1580824112.git.pkrempa@redhat.com> Reviewed-by: Ján Tomko --- src/qemu/qemu_blockjob.h | 3 +++ src/qemu/qemu_domain.c | 7 +++++++ tests/qemustatusxml2xmldata/backup-pull-in.xml | 2 +- tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml | 8 ++++---- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 7d584a2980..53c495fa8a 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -129,6 +129,9 @@ struct _qemuBlockJobData { virStorageSourcePtr chain; /* Reference to the chain the job operates on. */ virStorageSourcePtr mirrorChain; /* reference to 'mirror' part of the job */ + unsigned int jobflags; /* per job flags */ + bool jobflagsmissing; /* job flags were not stored */ + union { qemuBlockJobPullData pull; qemuBlockJobCommitData commit; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 94efcdf9b1..846d1ecb29 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2582,6 +2582,8 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload, virBufferEscapeString(&attrBuf, " newstate='%s'", newstate); if (job->brokentype != QEMU_BLOCKJOB_TYPE_NONE) virBufferEscapeString(&attrBuf, " brokentype='%s'", qemuBlockjobTypeToString(job->brokentype)); + if (!job->jobflagsmissing) + virBufferAsprintf(&attrBuf, " jobflags='0x%x'", job->jobflags); virBufferEscapeString(&childBuf, "%s", job->errmsg); if (job->disk) { @@ -3294,6 +3296,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm, int newstate = -1; bool invalidData = false; xmlNodePtr tmp; + unsigned long jobflags = 0; ctxt->node = node; @@ -3333,6 +3336,9 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm, STRNEQ(mirror, "yes")) invalidData = true; + if (virXPathULongHex("string(./@jobflags)", ctxt, &jobflags) != 0) + job->jobflagsmissing = true; + if (!disk && !invalidData) { if ((tmp = virXPathNode("./chains/disk", ctxt)) && !(job->chain = qemuDomainObjPrivateXMLParseBlockjobChain(tmp, ctxt, xmlopt))) @@ -3352,6 +3358,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm, job->state = state; job->newstate = newstate; + job->jobflags = jobflags; job->errmsg = virXPathString("string(./errmsg)", ctxt); job->invalidData = invalidData; job->disk = disk; diff --git a/tests/qemustatusxml2xmldata/backup-pull-in.xml b/tests/qemustatusxml2xmldata/backup-pull-in.xml index 3c69c41840..1db978a3ac 100644 --- a/tests/qemustatusxml2xmldata/backup-pull-in.xml +++ b/tests/qemustatusxml2xmldata/backup-pull-in.xml @@ -235,7 +235,7 @@ - + diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml index b5d62fd4ab..ca6d110179 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -261,19 +261,19 @@ - + - + - + - + -- 2.25.0