[PATCH 9/9] qemu: monitor: Remove non-transaction based dirty bitmap APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We replaced them by use of transaction to simplify possible failure
scenarios.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      |  51 ---------------
 src/qemu/qemu_monitor.h      |  19 ------
 src/qemu/qemu_monitor_json.c | 119 -----------------------------------
 src/qemu/qemu_monitor_json.h |  17 -----
 tests/qemumonitorjsontest.c  |  41 ------------
 5 files changed, 247 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 0f54c5c0e2..135d70084e 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4419,57 +4419,6 @@ qemuMonitorGetCurrentMachineInfo(qemuMonitorPtr mon,
 }


-int
-qemuMonitorAddBitmap(qemuMonitorPtr mon,
-                     const char *node,
-                     const char *bitmap,
-                     bool persistent)
-{
-    VIR_DEBUG("node=%s bitmap=%s persistent=%d", node, bitmap, persistent);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    return qemuMonitorJSONAddBitmap(mon, node, bitmap, persistent);
-}
-
-int
-qemuMonitorEnableBitmap(qemuMonitorPtr mon,
-                        const char *node,
-                        const char *bitmap)
-{
-    VIR_DEBUG("node=%s bitmap=%s", node, bitmap);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    return qemuMonitorJSONEnableBitmap(mon, node, bitmap);
-}
-
-int
-qemuMonitorMergeBitmaps(qemuMonitorPtr mon,
-                        const char *node,
-                        const char *dst,
-                        virJSONValuePtr *src)
-{
-    VIR_DEBUG("node=%s dst=%s", node, dst);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    return qemuMonitorJSONMergeBitmaps(mon, node, dst, src);
-}
-
-int
-qemuMonitorDeleteBitmap(qemuMonitorPtr mon,
-                        const char *node,
-                        const char *bitmap)
-{
-    VIR_DEBUG("node=%s bitmap=%s", node, bitmap);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    return qemuMonitorJSONDeleteBitmap(mon, node, bitmap);
-}
-
-
 void
 qemuMonitorJobInfoFree(qemuMonitorJobInfoPtr job)
 {
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index c6f1f3572b..c3b4808ddc 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -691,25 +691,6 @@ int qemuMonitorSetBalloon(qemuMonitorPtr mon,
                           unsigned long long newmem);
 int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);

-int qemuMonitorAddBitmap(qemuMonitorPtr mon,
-                         const char *node,
-                         const char *bitmap,
-                         bool persistent)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
-int qemuMonitorEnableBitmap(qemuMonitorPtr mon,
-                            const char *node,
-                            const char *bitmap)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
-int qemuMonitorMergeBitmaps(qemuMonitorPtr mon,
-                            const char *node,
-                            const char *dst,
-                            virJSONValuePtr *src)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
-int qemuMonitorDeleteBitmap(qemuMonitorPtr mon,
-                            const char *node,
-                            const char *bitmap)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
-

 /* XXX should we pass the virDomainDiskDefPtr instead
  * and hide dev_name details inside monitor. Reconsider
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 0073c863c2..b8ac413eb8 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -8910,125 +8910,6 @@ qemuMonitorJSONGetCurrentMachineInfo(qemuMonitorPtr mon,
 }


-int
-qemuMonitorJSONAddBitmap(qemuMonitorPtr mon,
-                         const char *node,
-                         const char *bitmap,
-                         bool persistent)
-{
-    int ret = -1;
-    virJSONValuePtr cmd;
-    virJSONValuePtr reply = NULL;
-
-    if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-add",
-                                           "s:node", node,
-                                           "s:name", bitmap,
-                                           "b:persistent", persistent,
-                                           NULL)))
-        return -1;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
-        goto cleanup;
-
-    ret = 0;
- cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    return ret;
-}
-
-int
-qemuMonitorJSONEnableBitmap(qemuMonitorPtr mon,
-                            const char *node,
-                            const char *bitmap)
-{
-    int ret = -1;
-    virJSONValuePtr cmd;
-    virJSONValuePtr reply = NULL;
-
-    if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-enable",
-                                           "s:node", node,
-                                           "s:name", bitmap,
-                                           NULL)))
-        return -1;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
-        goto cleanup;
-
-    ret = 0;
- cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    return ret;
-}
-
-int
-qemuMonitorJSONMergeBitmaps(qemuMonitorPtr mon,
-                            const char *node,
-                            const char *dst,
-                            virJSONValuePtr *src)
-{
-    int ret = -1;
-    virJSONValuePtr cmd;
-    virJSONValuePtr reply = NULL;
-
-    if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-merge",
-                                           "s:node", node,
-                                           "s:target", dst,
-                                           "a:bitmaps", src,
-                                           NULL)))
-        goto cleanup;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
-        goto cleanup;
-
-    ret = 0;
- cleanup:
-    virJSONValueFree(*src);
-    *src = NULL;
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    return ret;
-}
-
-int
-qemuMonitorJSONDeleteBitmap(qemuMonitorPtr mon,
-                            const char *node,
-                            const char *bitmap)
-{
-    int ret = -1;
-    virJSONValuePtr cmd;
-    virJSONValuePtr reply = NULL;
-
-    if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-remove",
-                                           "s:node", node,
-                                           "s:name", bitmap,
-                                           NULL)))
-        return -1;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
-        goto cleanup;
-
-    ret = 0;
- cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    return ret;
-}
-
-
 int
 qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr actions,
                                     const char *node,
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 38bed040c1..65f75bd56c 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -611,23 +611,6 @@ int
 qemuMonitorJSONGetCurrentMachineInfo(qemuMonitorPtr mon,
                                      qemuMonitorCurrentMachineInfoPtr info)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-int qemuMonitorJSONAddBitmap(qemuMonitorPtr mon,
-                             const char *node,
-                             const char *bitmap,
-                             bool persistent);
-
-int qemuMonitorJSONEnableBitmap(qemuMonitorPtr mon,
-                                const char *node,
-                                const char *bitmap);
-
-int qemuMonitorJSONMergeBitmaps(qemuMonitorPtr mon,
-                                const char *node,
-                                const char *dst,
-                                virJSONValuePtr *src);
-
-int qemuMonitorJSONDeleteBitmap(qemuMonitorPtr mon,
-                                const char *node,
-                                const char *bitmap);

 int
 qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr actions,
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 8179e802c1..0118dd94b1 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1337,9 +1337,6 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayOpen, "foodev", true)
 GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayClose, "foodev")
 GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumRemove, "foodev")
 GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumInsert, "foodev", "newnode")
-GEN_TEST_FUNC(qemuMonitorJSONAddBitmap, "node", "bitmap", true)
-GEN_TEST_FUNC(qemuMonitorJSONEnableBitmap, "node", "bitmap")
-GEN_TEST_FUNC(qemuMonitorJSONDeleteBitmap, "node", "bitmap")
 GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname")
 GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname", false)
 GEN_TEST_FUNC(qemuMonitorJSONJobComplete, "jobname")
@@ -1382,40 +1379,6 @@ testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque)
     return 0;
 }

-static int
-testQemuMonitorJSONqemuMonitorJSONMergeBitmaps(const void *opaque)
-{
-    const testGenericData *data = opaque;
-    virDomainXMLOptionPtr xmlopt = data->xmlopt;
-    VIR_AUTOPTR(qemuMonitorTest) test = NULL;
-    VIR_AUTOPTR(virJSONValue) arr = NULL;
-
-    if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
-        return -1;
-
-    if (!(arr = virJSONValueNewArray()))
-        return -1;
-
-    if (virJSONValueArrayAppendString(arr, "b1") < 0 ||
-        virJSONValueArrayAppendString(arr, "b2") < 0)
-        return -1;
-
-    if (qemuMonitorTestAddItem(test, "block-dirty-bitmap-merge",
-                               "{\"return\":{}}") < 0)
-        return -1;
-
-    if (qemuMonitorJSONMergeBitmaps(qemuMonitorTestGetMonitor(test),
-                                    "node", "dst", &arr) < 0)
-        return -1;
-
-    if (arr) {
-        VIR_TEST_VERBOSE("arr should have been cleared");
-        return -1;
-    }
-
-    return 0;
-}
-
 static bool
 testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(struct qemuMonitorQueryCpusEntry *a,
                                                  struct qemuMonitorQueryCpusEntry *b)
@@ -3174,9 +3137,6 @@ mymain(void)
     DO_TEST_GEN(qemuMonitorJSONBlockdevTrayClose);
     DO_TEST_GEN(qemuMonitorJSONBlockdevMediumRemove);
     DO_TEST_GEN(qemuMonitorJSONBlockdevMediumInsert);
-    DO_TEST_GEN(qemuMonitorJSONAddBitmap);
-    DO_TEST_GEN(qemuMonitorJSONEnableBitmap);
-    DO_TEST_GEN(qemuMonitorJSONDeleteBitmap);
     DO_TEST_GEN(qemuMonitorJSONJobDismiss);
     DO_TEST_GEN(qemuMonitorJSONJobCancel);
     DO_TEST_GEN(qemuMonitorJSONJobComplete);
@@ -3196,7 +3156,6 @@ mymain(void)
     DO_TEST(qemuMonitorJSONSendKeyHoldtime);
     DO_TEST(qemuMonitorSupportsActiveCommit);
     DO_TEST(qemuMonitorJSONNBDServerStart);
-    DO_TEST(qemuMonitorJSONMergeBitmaps);

     DO_TEST_CPU_DATA("host");
     DO_TEST_CPU_DATA("full");
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux