Blame SOURCES/libvirt-qemu-blockjob-Remove-disabledBitmapsBase-field-from-commit-job-private-data.patch

a41c76
From c23ec1c095a13e1279660ea9b27290c9ae0f3849 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <c23ec1c095a13e1279660ea9b27290c9ae0f3849@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 23 Jun 2020 12:24:03 +0200
a41c76
Subject: [PATCH] qemu: blockjob: Remove 'disabledBitmapsBase' field from
a41c76
 commit job private data
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
New semantics of the bitmap handling don't need this. Remove the field
a41c76
and all uses of it including the status XML.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Eric Blake <eblake@redhat.com>
a41c76
(cherry picked from commit 057e4bc591093a333624acb9ed065f8f796cca1e)
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
a41c76
Message-Id: <d003ac3f3f67fba9944e600cdf09f0aa4bb1001a.1592906423.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_blockjob.c                      | 39 -------------------
a41c76
 src/qemu/qemu_blockjob.h                      |  3 --
a41c76
 src/qemu/qemu_domain.c                        | 22 -----------
a41c76
 src/qemu/qemu_driver.c                        |  3 +-
a41c76
 .../blockjob-blockdev-in.xml                  |  4 --
a41c76
 5 files changed, 1 insertion(+), 70 deletions(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
a41c76
index c63a691a0e..d106165175 100644
a41c76
--- a/src/qemu/qemu_blockjob.c
a41c76
+++ b/src/qemu/qemu_blockjob.c
a41c76
@@ -285,7 +285,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
a41c76
                           virStorageSourcePtr topparent,
a41c76
                           virStorageSourcePtr top,
a41c76
                           virStorageSourcePtr base,
a41c76
-                          char ***disabledBitmapsBase,
a41c76
                           bool delete_imgs,
a41c76
                           unsigned int jobflags)
a41c76
 {
a41c76
@@ -311,7 +310,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
a41c76
     job->data.commit.top = top;
a41c76
     job->data.commit.base = base;
a41c76
     job->data.commit.deleteCommittedImages = delete_imgs;
a41c76
-    job->data.commit.disabledBitmapsBase = g_steal_pointer(disabledBitmapsBase);
a41c76
     job->jobflags = jobflags;
a41c76
 
a41c76
     if (qemuBlockJobRegister(job, vm, disk, true) < 0)
a41c76
@@ -1363,40 +1361,6 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver,
a41c76
 }
a41c76
 
a41c76
 
a41c76
-static void
a41c76
-qemuBlockJobProcessEventFailedCommitCommon(virDomainObjPtr vm,
a41c76
-                                           qemuBlockJobDataPtr job,
a41c76
-                                           qemuDomainAsyncJob asyncJob)
a41c76
-{
a41c76
-    qemuDomainObjPrivatePtr priv = vm->privateData;
a41c76
-    g_autoptr(virJSONValue) actions = virJSONValueNewArray();
a41c76
-    char **disabledBitmaps = job->data.commit.disabledBitmapsBase;
a41c76
-
a41c76
-    if (!disabledBitmaps || !*disabledBitmaps)
a41c76
-        return;
a41c76
-
a41c76
-    for (; *disabledBitmaps; disabledBitmaps++) {
a41c76
-        qemuMonitorTransactionBitmapEnable(actions,
a41c76
-                                           job->data.commit.base->nodeformat,
a41c76
-                                           *disabledBitmaps);
a41c76
-    }
a41c76
-
a41c76
-    if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0)
a41c76
-        return;
a41c76
-
a41c76
-    if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
a41c76
-        return;
a41c76
-
a41c76
-    qemuMonitorTransaction(priv->mon, &actions);
a41c76
-
a41c76
-    if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
a41c76
-        return;
a41c76
-
a41c76
-    if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0)
a41c76
-        return;
a41c76
-}
a41c76
-
a41c76
-
a41c76
 static void
a41c76
 qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver,
a41c76
                                         virDomainObjPtr vm,
a41c76
@@ -1504,8 +1468,6 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
a41c76
     case QEMU_BLOCKJOB_TYPE_COMMIT:
a41c76
         if (success)
a41c76
             qemuBlockJobProcessEventCompletedCommit(driver, vm, job, asyncJob);
a41c76
-        else
a41c76
-            qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob);
a41c76
         break;
a41c76
 
a41c76
     case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
a41c76
@@ -1513,7 +1475,6 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
a41c76
             qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job, asyncJob);
a41c76
         } else {
a41c76
             qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job);
a41c76
-            qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob);
a41c76
         }
a41c76
         break;
a41c76
 
a41c76
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
a41c76
index ee83d318f3..4045878568 100644
a41c76
--- a/src/qemu/qemu_blockjob.h
a41c76
+++ b/src/qemu/qemu_blockjob.h
a41c76
@@ -88,8 +88,6 @@ struct _qemuBlockJobCommitData {
a41c76
     virStorageSourcePtr top;
a41c76
     virStorageSourcePtr base;
a41c76
     bool deleteCommittedImages;
a41c76
-    char **disabledBitmapsBase; /* a NULL-terminated list of bitmap names which
a41c76
-                                   were disabled in @base for the commit job */
a41c76
 };
a41c76
 
a41c76
 
a41c76
@@ -187,7 +185,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
a41c76
                           virStorageSourcePtr topparent,
a41c76
                           virStorageSourcePtr top,
a41c76
                           virStorageSourcePtr base,
a41c76
-                          char ***disabledBitmapsBase,
a41c76
                           bool delete_imgs,
a41c76
                           unsigned int jobflags);
a41c76
 
a41c76
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
a41c76
index a92183334f..1e968368ae 100644
a41c76
--- a/src/qemu/qemu_domain.c
a41c76
+++ b/src/qemu/qemu_domain.c
a41c76
@@ -2594,7 +2594,6 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job,
a41c76
                                       virBufferPtr buf)
a41c76
 {
a41c76
     g_auto(virBuffer) disabledBitmapsBuf = VIR_BUFFER_INIT_CHILD(buf);
a41c76
-    char **bitmaps = job->data.commit.disabledBitmapsBase;
a41c76
 
a41c76
     if (job->data.commit.base)
a41c76
         virBufferAsprintf(buf, "<base node='%s'/>\n", job->data.commit.base->nodeformat);
a41c76
@@ -2608,9 +2607,6 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job,
a41c76
     if (job->data.commit.deleteCommittedImages)
a41c76
         virBufferAddLit(buf, "<deleteCommittedImages/>\n");
a41c76
 
a41c76
-    while (bitmaps && *bitmaps)
a41c76
-        virBufferEscapeString(&disabledBitmapsBuf, "<bitmap name='%s'/>\n", *(bitmaps++));
a41c76
-
a41c76
     virXMLFormatElement(buf, "disabledBaseBitmaps", NULL, &disabledBitmapsBuf);
a41c76
 }
a41c76
 
a41c76
@@ -3238,9 +3234,6 @@ static int
a41c76
 qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job,
a41c76
                                                xmlXPathContextPtr ctxt)
a41c76
 {
a41c76
-    g_autofree xmlNodePtr *nodes = NULL;
a41c76
-    ssize_t nnodes;
a41c76
-
a41c76
     if (job->type == QEMU_BLOCKJOB_TYPE_COMMIT) {
a41c76
         qemuDomainObjPrivateXMLParseBlockjobNodename(job,
a41c76
                                                      "string(./topparent/@node)",
a41c76
@@ -3267,21 +3260,6 @@ qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job,
a41c76
         !job->data.commit.base)
a41c76
         return -1;
a41c76
 
a41c76
-    if ((nnodes = virXPathNodeSet("./disabledBaseBitmaps/bitmap", ctxt, &nodes)) > 0) {
a41c76
-        size_t i;
a41c76
-
a41c76
-        job->data.commit.disabledBitmapsBase = g_new0(char *, nnodes + 1);
a41c76
-
a41c76
-        for (i = 0; i < nnodes; i++) {
a41c76
-            char *tmp;
a41c76
-
a41c76
-            if (!(tmp = virXMLPropString(nodes[i], "name")))
a41c76
-                return -1;
a41c76
-
a41c76
-            job->data.commit.disabledBitmapsBase[i] = g_steal_pointer(&tmp);
a41c76
-        }
a41c76
-    }
a41c76
-
a41c76
     return 0;
a41c76
 }
a41c76
 
a41c76
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
a41c76
index 983d4a04a8..ed5498d2bc 100644
a41c76
--- a/src/qemu/qemu_driver.c
a41c76
+++ b/src/qemu/qemu_driver.c
a41c76
@@ -18757,7 +18757,6 @@ qemuDomainBlockCommit(virDomainPtr dom,
a41c76
     const char *nodebase = NULL;
a41c76
     bool persistjob = false;
a41c76
     bool blockdev = false;
a41c76
-    VIR_AUTOSTRINGLIST bitmapDisableList = NULL;
a41c76
 
a41c76
     virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW |
a41c76
                   VIR_DOMAIN_BLOCK_COMMIT_ACTIVE |
a41c76
@@ -18919,7 +18918,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
a41c76
     }
a41c76
 
a41c76
     if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
a41c76
-                                          baseSource, &bitmapDisableList,
a41c76
+                                          baseSource,
a41c76
                                           flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE,
a41c76
                                           flags)))
a41c76
         goto endjob;
a41c76
diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
a41c76
index cc17a17ff4..ca6d110179 100644
a41c76
--- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
a41c76
+++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
a41c76
@@ -243,10 +243,6 @@
a41c76
       <base node='libvirt-19-format'/>
a41c76
       <top node='libvirt-17-format'/>
a41c76
       <deleteCommittedImages/>
a41c76
-      <disabledBaseBitmaps>
a41c76
-        <bitmap name='test'/>
a41c76
-        <bitmap name='test1'/>
a41c76
-      </disabledBaseBitmaps>
a41c76
     </blockjob>
a41c76
     <blockjob name='create-libvirt-1337-storage' type='create' state='running'>
a41c76
       <create mode='storage'/>
a41c76
-- 
a41c76
2.27.0
a41c76