The only remaining user of qemuMonitorGetMigrationCapability is our test suite. Let's replace qemuMonitorGetMigrationCapability with qemuMonitorGetMigrationCapabilities there and drop the unused function. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_monitor.c | 19 ------------------- src/qemu/qemu_monitor.h | 2 -- src/qemu/qemu_monitor_json.c | 18 ------------------ src/qemu/qemu_monitor_json.h | 2 -- tests/qemumonitorjsontest.c | 16 ++++++++++------ 5 files changed, 10 insertions(+), 47 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 8ffce5a35d..55b123e5f5 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3938,25 +3938,6 @@ qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon, } -/** - * Returns 1 if @capability is supported, 0 if it's not, or -1 on error. - */ -int -qemuMonitorGetMigrationCapability(qemuMonitorPtr mon, - qemuMonitorMigrationCaps capability) -{ - VIR_DEBUG("capability=%d", capability); - - QEMU_CHECK_MONITOR(mon); - - /* No capability is supported without JSON monitor */ - if (!mon->json) - return 0; - - return qemuMonitorJSONGetMigrationCapability(mon, capability); -} - - int qemuMonitorSetMigrationCapability(qemuMonitorPtr mon, qemuMonitorMigrationCaps capability, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 57893c61c6..0365b0f397 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -714,8 +714,6 @@ VIR_ENUM_DECL(qemuMonitorMigrationCaps); int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon, char ***capabilities); -int qemuMonitorGetMigrationCapability(qemuMonitorPtr mon, - qemuMonitorMigrationCaps capability); int qemuMonitorSetMigrationCapability(qemuMonitorPtr mon, qemuMonitorMigrationCaps capability, bool state); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 663fce3c3c..f7567eb771 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6068,24 +6068,6 @@ qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon, } -int -qemuMonitorJSONGetMigrationCapability(qemuMonitorPtr mon, - qemuMonitorMigrationCaps capability) -{ - int ret; - char **capsList = NULL; - const char *cap = qemuMonitorMigrationCapsTypeToString(capability); - - if (qemuMonitorJSONGetMigrationCapabilities(mon, &capsList) < 0) - return -1; - - ret = virStringListHasString((const char **) capsList, cap); - - virStringListFree(capsList); - return ret; -} - - int qemuMonitorJSONSetMigrationCapability(qemuMonitorPtr mon, qemuMonitorMigrationCaps capability, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 7c45be6725..b17348a119 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -146,8 +146,6 @@ int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon, int qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon, char ***capabilities); -int qemuMonitorJSONGetMigrationCapability(qemuMonitorPtr mon, - qemuMonitorMigrationCaps capability); int qemuMonitorJSONSetMigrationCapability(qemuMonitorPtr mon, qemuMonitorMigrationCaps capability, bool state); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 475fd270e1..4d3b738e52 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2214,7 +2214,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapability(const void *data) virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data; qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt); int ret = -1; - int cap; + const char *cap; + char **caps = NULL; const char *reply = "{" " \"return\": [" @@ -2234,12 +2235,14 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapability(const void *data) "{\"return\":{}}") < 0) goto cleanup; - cap = qemuMonitorJSONGetMigrationCapability(qemuMonitorTestGetMonitor(test), - QEMU_MONITOR_MIGRATION_CAPS_XBZRLE); - if (cap != 1) { + if (qemuMonitorGetMigrationCapabilities(qemuMonitorTestGetMonitor(test), + &caps) < 0) + goto cleanup; + + cap = qemuMonitorMigrationCapsTypeToString(QEMU_MONITOR_MIGRATION_CAPS_XBZRLE); + if (!virStringListHasString((const char **) caps, cap)) { virReportError(VIR_ERR_INTERNAL_ERROR, - "Unexpected capability: %d, expecting 1", - cap); + "Expected capability %s is missing", cap); goto cleanup; } @@ -2251,6 +2254,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapability(const void *data) ret = 0; cleanup: qemuMonitorTestFree(test); + virStringListFree(caps); return ret; } -- 2.14.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list