]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: monitor: Remove qemuMonitorSupportsActiveCommit
authorPeter Krempa <pkrempa@redhat.com>
Wed, 7 Apr 2021 15:14:22 +0000 (17:14 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 3 May 2021 10:14:44 +0000 (12:14 +0200)
Modern code uses QMP schema to query for active commit support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
tests/qemumonitorjsontest.c

index 8b8db20a01407bad705237711c0e9c1fa3d593dc..3a7f231ce02108d2a9c6ac342a8f9e799d3f35f3 100644 (file)
@@ -3280,17 +3280,6 @@ qemuMonitorBlockCommit(qemuMonitor *mon,
 }
 
 
-/* Probe whether active commits are supported by a given qemu binary. */
-bool
-qemuMonitorSupportsActiveCommit(qemuMonitor *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 *
index f917098324759933ec2e80f2adf8ba4ee9ddbf9f..6a25def78b96b1beb0c65967106917a5c7a73add 100644 (file)
@@ -1046,7 +1046,6 @@ int qemuMonitorBlockCommit(qemuMonitor *mon,
                            const char *backingName,
                            unsigned long long bandwidth)
     ATTRIBUTE_NONNULL(2);
-bool qemuMonitorSupportsActiveCommit(qemuMonitor *mon);
 char *qemuMonitorDiskNameLookup(qemuMonitor *mon,
                                 const char *device,
                                 virStorageSource *top,
index 639e10e4885fd5a84b7c21bed57b8553f3eb674d..46aa3330a8d19d224cc0bf441837ff94f75f4ccd 100644 (file)
@@ -4726,39 +4726,6 @@ qemuMonitorJSONTransaction(qemuMonitor *mon, virJSONValue **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(qemuMonitor *mon)
-{
-    bool ret = false;
-    virJSONValue *cmd;
-    virJSONValue *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. */
index c6b0d606f6e6f2183455c6054f5447cb61683758..01a3ba25f10490ce4eafd5263194ee528b15073a 100644 (file)
@@ -276,9 +276,6 @@ int qemuMonitorJSONDrivePivot(qemuMonitor *mon,
                               const char *jobname)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
-bool qemuMonitorJSONSupportsActiveCommit(qemuMonitor *mon)
-    ATTRIBUTE_NONNULL(1);
-
 int qemuMonitorJSONBlockCommit(qemuMonitor *mon,
                                const char *device,
                                const char *jobname,
index e36036e0d23ae5ec7c849833bbb4426ee380f964..0dce8f6ab5e313efba29e5f46c688b82871ce0b7 100644 (file)
@@ -2145,49 +2145,6 @@ testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *opaque)
     return 0;
 }
 
-static int
-testQemuMonitorJSONqemuMonitorSupportsActiveCommit(const void *opaque)
-{
-    const testGenericData *data = opaque;
-    virDomainXMLOption *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)
 {
@@ -3136,7 +3093,6 @@ mymain(void)
     DO_TEST(qemuMonitorJSONSendKey);
     DO_TEST(qemuMonitorJSONGetDumpGuestMemoryCapability);
     DO_TEST(qemuMonitorJSONSendKeyHoldtime);
-    DO_TEST(qemuMonitorSupportsActiveCommit);
     DO_TEST(qemuMonitorJSONNBDServerStart);
 
     DO_TEST_CPU_DATA("host");