render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From c23ec1c095a13e1279660ea9b27290c9ae0f3849 Mon Sep 17 00:00:00 2001
Message-Id: <c23ec1c095a13e1279660ea9b27290c9ae0f3849@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jun 2020 12:24:03 +0200
Subject: [PATCH] qemu: blockjob: Remove 'disabledBitmapsBase' field from
 commit job private data
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

New semantics of the bitmap handling don't need this. Remove the field
and all uses of it including the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 057e4bc591093a333624acb9ed065f8f796cca1e)
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
Message-Id: <d003ac3f3f67fba9944e600cdf09f0aa4bb1001a.1592906423.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_blockjob.c                      | 39 -------------------
 src/qemu/qemu_blockjob.h                      |  3 --
 src/qemu/qemu_domain.c                        | 22 -----------
 src/qemu/qemu_driver.c                        |  3 +-
 .../blockjob-blockdev-in.xml                  |  4 --
 5 files changed, 1 insertion(+), 70 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index c63a691a0e..d106165175 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -285,7 +285,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
                           virStorageSourcePtr topparent,
                           virStorageSourcePtr top,
                           virStorageSourcePtr base,
-                          char ***disabledBitmapsBase,
                           bool delete_imgs,
                           unsigned int jobflags)
 {
@@ -311,7 +310,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
     job->data.commit.top = top;
     job->data.commit.base = base;
     job->data.commit.deleteCommittedImages = delete_imgs;
-    job->data.commit.disabledBitmapsBase = g_steal_pointer(disabledBitmapsBase);
     job->jobflags = jobflags;
 
     if (qemuBlockJobRegister(job, vm, disk, true) < 0)
@@ -1363,40 +1361,6 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver,
 }
 
 
-static void
-qemuBlockJobProcessEventFailedCommitCommon(virDomainObjPtr vm,
-                                           qemuBlockJobDataPtr job,
-                                           qemuDomainAsyncJob asyncJob)
-{
-    qemuDomainObjPrivatePtr priv = vm->privateData;
-    g_autoptr(virJSONValue) actions = virJSONValueNewArray();
-    char **disabledBitmaps = job->data.commit.disabledBitmapsBase;
-
-    if (!disabledBitmaps || !*disabledBitmaps)
-        return;
-
-    for (; *disabledBitmaps; disabledBitmaps++) {
-        qemuMonitorTransactionBitmapEnable(actions,
-                                           job->data.commit.base->nodeformat,
-                                           *disabledBitmaps);
-    }
-
-    if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0)
-        return;
-
-    if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
-        return;
-
-    qemuMonitorTransaction(priv->mon, &actions);
-
-    if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
-        return;
-
-    if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0)
-        return;
-}
-
-
 static void
 qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver,
                                         virDomainObjPtr vm,
@@ -1504,8 +1468,6 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
     case QEMU_BLOCKJOB_TYPE_COMMIT:
         if (success)
             qemuBlockJobProcessEventCompletedCommit(driver, vm, job, asyncJob);
-        else
-            qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob);
         break;
 
     case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
@@ -1513,7 +1475,6 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
             qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job, asyncJob);
         } else {
             qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job);
-            qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob);
         }
         break;
 
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index ee83d318f3..4045878568 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -88,8 +88,6 @@ struct _qemuBlockJobCommitData {
     virStorageSourcePtr top;
     virStorageSourcePtr base;
     bool deleteCommittedImages;
-    char **disabledBitmapsBase; /* a NULL-terminated list of bitmap names which
-                                   were disabled in @base for the commit job */
 };
 
 
@@ -187,7 +185,6 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
                           virStorageSourcePtr topparent,
                           virStorageSourcePtr top,
                           virStorageSourcePtr base,
-                          char ***disabledBitmapsBase,
                           bool delete_imgs,
                           unsigned int jobflags);
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a92183334f..1e968368ae 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2594,7 +2594,6 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job,
                                       virBufferPtr buf)
 {
     g_auto(virBuffer) disabledBitmapsBuf = VIR_BUFFER_INIT_CHILD(buf);
-    char **bitmaps = job->data.commit.disabledBitmapsBase;
 
     if (job->data.commit.base)
         virBufferAsprintf(buf, "<base node='%s'/>\n", job->data.commit.base->nodeformat);
@@ -2608,9 +2607,6 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job,
     if (job->data.commit.deleteCommittedImages)
         virBufferAddLit(buf, "<deleteCommittedImages/>\n");
 
-    while (bitmaps && *bitmaps)
-        virBufferEscapeString(&disabledBitmapsBuf, "<bitmap name='%s'/>\n", *(bitmaps++));
-
     virXMLFormatElement(buf, "disabledBaseBitmaps", NULL, &disabledBitmapsBuf);
 }
 
@@ -3238,9 +3234,6 @@ static int
 qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job,
                                                xmlXPathContextPtr ctxt)
 {
-    g_autofree xmlNodePtr *nodes = NULL;
-    ssize_t nnodes;
-
     if (job->type == QEMU_BLOCKJOB_TYPE_COMMIT) {
         qemuDomainObjPrivateXMLParseBlockjobNodename(job,
                                                      "string(./topparent/@node)",
@@ -3267,21 +3260,6 @@ qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job,
         !job->data.commit.base)
         return -1;
 
-    if ((nnodes = virXPathNodeSet("./disabledBaseBitmaps/bitmap", ctxt, &nodes)) > 0) {
-        size_t i;
-
-        job->data.commit.disabledBitmapsBase = g_new0(char *, nnodes + 1);
-
-        for (i = 0; i < nnodes; i++) {
-            char *tmp;
-
-            if (!(tmp = virXMLPropString(nodes[i], "name")))
-                return -1;
-
-            job->data.commit.disabledBitmapsBase[i] = g_steal_pointer(&tmp);
-        }
-    }
-
     return 0;
 }
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 983d4a04a8..ed5498d2bc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18757,7 +18757,6 @@ qemuDomainBlockCommit(virDomainPtr dom,
     const char *nodebase = NULL;
     bool persistjob = false;
     bool blockdev = false;
-    VIR_AUTOSTRINGLIST bitmapDisableList = NULL;
 
     virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW |
                   VIR_DOMAIN_BLOCK_COMMIT_ACTIVE |
@@ -18919,7 +18918,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
     }
 
     if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
-                                          baseSource, &bitmapDisableList,
+                                          baseSource,
                                           flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE,
                                           flags)))
         goto endjob;
diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
index cc17a17ff4..ca6d110179 100644
--- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
+++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
@@ -243,10 +243,6 @@
       <base node='libvirt-19-format'/>
       <top node='libvirt-17-format'/>
       <deleteCommittedImages/>
-      <disabledBaseBitmaps>
-        <bitmap name='test'/>
-        <bitmap name='test1'/>
-      </disabledBaseBitmaps>
     </blockjob>
     <blockjob name='create-libvirt-1337-storage' type='create' state='running'>
       <create mode='storage'/>
-- 
2.27.0