Modern code uses QMP schema to query for active commit support. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx> Reviewed-by: Neal Gompa <ngompa13@xxxxxxxxx> --- 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 f28023e957..f6754a64ed 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -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 * diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index a39e8e6e82..a1cf2856eb 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -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, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 534ab75c2c..0e405aa821 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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. */ diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 97b8d2a991..2a76b33b9b 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -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, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 0866ebe2bf..0e4b1b4954 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -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"); -- 2.30.2