[RFC PATCH 40/43] qemu: monitor: Remove qemuMonitorSupportsActiveCommit

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

 



Modern code uses QMP schema to query for active commit support.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      | 11 ---------
 src/qemu/qemu_monitor.h      |  1 -
 src/qemu/qemu_monitor_json.c | 33 ---------------------------
 src/qemu/qemu_monitor_json.h |  3 ---
 tests/qemumonitorjsontest.c  | 44 ------------------------------------
 5 files changed, 92 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index f337f20140..375c56ca9f 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3280,17 +3280,6 @@ qemuMonitorBlockCommit(qemuMonitorPtr mon,
 }


-/* Probe whether active commits are supported by a given qemu binary. */
-bool
-qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon)
-{
-    if (!mon)
-        return false;
-
-    return qemuMonitorJSONSupportsActiveCommit(mon);
-}
-
-
 /* Determine the name that qemu is using for tracking the backing
  * element TARGET within the chain starting at TOP.  */
 char *
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 310635881d..6cb04d6f76 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1067,7 +1067,6 @@ int qemuMonitorBlockCommit(qemuMonitorPtr mon,
                            const char *backingName,
                            unsigned long long bandwidth)
     ATTRIBUTE_NONNULL(2);
-bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon);
 char *qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
                                 const char *device,
                                 virStorageSourcePtr top,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index f7a84f86e6..0732e2dc1e 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4726,39 +4726,6 @@ qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
     return ret;
 }

-/* Probe if active commit is supported: pass in a bogus device and NULL top
- * and base.  The probe return is true if active commit is detected or false
- * if not supported or on any error */
-bool
-qemuMonitorJSONSupportsActiveCommit(qemuMonitorPtr mon)
-{
-    bool ret = false;
-    virJSONValuePtr cmd;
-    virJSONValuePtr reply = NULL;
-
-    if (!(cmd = qemuMonitorJSONMakeCommand("block-commit", "s:device",
-                                           "bogus", NULL)))
-        return false;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) {
-        VIR_DEBUG("block-commit supports active commit");
-        ret = true;
-        goto cleanup;
-    }
-
-    /* This is a false negative for qemu 2.0; but probably not
-     * worth the additional complexity to worry about it */
-    VIR_DEBUG("block-commit requires 'top' parameter, "
-              "assuming it lacks active commit");
- cleanup:
-    virJSONValueFree(cmd);
-    virJSONValueFree(reply);
-    return ret;
-}
-

 /* speed is in bytes/sec. Returns 0 on success, -1 with error message
  * emitted on failure. */
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 9e046df9fe..91a8ef9878 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -276,9 +276,6 @@ int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
                               const char *jobname)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

-bool qemuMonitorJSONSupportsActiveCommit(qemuMonitorPtr mon)
-    ATTRIBUTE_NONNULL(1);
-
 int qemuMonitorJSONBlockCommit(qemuMonitorPtr mon,
                                const char *device,
                                const char *jobname,
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 48b41c908a..184c608e5c 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2146,49 +2146,6 @@ testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *opaque)
     return 0;
 }

-static int
-testQemuMonitorJSONqemuMonitorSupportsActiveCommit(const void *opaque)
-{
-    const testGenericData *data = opaque;
-    virDomainXMLOptionPtr xmlopt = data->xmlopt;
-    const char *error1 =
-        "{"
-        "  \"error\": {"
-        "    \"class\": \"DeviceNotFound\","
-        "    \"desc\": \"Device 'bogus' not found\""
-        "  }"
-        "}";
-    const char *error2 =
-        "{"
-        "  \"error\": {"
-        "    \"class\": \"GenericError\","
-        "    \"desc\": \"Parameter 'top' is missing\""
-        "  }"
-        "}";
-    g_autoptr(qemuMonitorTest) test = NULL;
-
-    if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
-        return -1;
-
-    if (qemuMonitorTestAddItemParams(test, "block-commit", error1,
-                                     "device", "\"bogus\"",
-                                     NULL, NULL) < 0)
-        return -1;
-
-    if (!qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
-        return -1;
-
-    if (qemuMonitorTestAddItemParams(test, "block-commit", error2,
-                                     "device", "\"bogus\"",
-                                     NULL, NULL) < 0)
-        return -1;
-
-    if (qemuMonitorSupportsActiveCommit(qemuMonitorTestGetMonitor(test)))
-        return -1;
-
-    return 0;
-}
-
 static int
 testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *opaque)
 {
@@ -3137,7 +3094,6 @@ mymain(void)
     DO_TEST(qemuMonitorJSONSendKey);
     DO_TEST(qemuMonitorJSONGetDumpGuestMemoryCapability);
     DO_TEST(qemuMonitorJSONSendKeyHoldtime);
-    DO_TEST(qemuMonitorSupportsActiveCommit);
     DO_TEST(qemuMonitorJSONNBDServerStart);

     DO_TEST_CPU_DATA("host");
-- 
2.30.2




[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