qemu: Drop qemuMonitorGetMigrationCapability

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@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Jiri Denemark 2017-10-17 22:01:01 +02:00
parent 310287b1c9
commit 38b0e4f58f
5 changed files with 10 additions and 47 deletions

View File

@ -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 int
qemuMonitorSetMigrationCapability(qemuMonitorPtr mon, qemuMonitorSetMigrationCapability(qemuMonitorPtr mon,
qemuMonitorMigrationCaps capability, qemuMonitorMigrationCaps capability,

View File

@ -714,8 +714,6 @@ VIR_ENUM_DECL(qemuMonitorMigrationCaps);
int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon, int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
char ***capabilities); char ***capabilities);
int qemuMonitorGetMigrationCapability(qemuMonitorPtr mon,
qemuMonitorMigrationCaps capability);
int qemuMonitorSetMigrationCapability(qemuMonitorPtr mon, int qemuMonitorSetMigrationCapability(qemuMonitorPtr mon,
qemuMonitorMigrationCaps capability, qemuMonitorMigrationCaps capability,
bool state); bool state);

View File

@ -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 int
qemuMonitorJSONSetMigrationCapability(qemuMonitorPtr mon, qemuMonitorJSONSetMigrationCapability(qemuMonitorPtr mon,
qemuMonitorMigrationCaps capability, qemuMonitorMigrationCaps capability,

View File

@ -146,8 +146,6 @@ int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon,
int qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon, int qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon,
char ***capabilities); char ***capabilities);
int qemuMonitorJSONGetMigrationCapability(qemuMonitorPtr mon,
qemuMonitorMigrationCaps capability);
int qemuMonitorJSONSetMigrationCapability(qemuMonitorPtr mon, int qemuMonitorJSONSetMigrationCapability(qemuMonitorPtr mon,
qemuMonitorMigrationCaps capability, qemuMonitorMigrationCaps capability,
bool state); bool state);

View File

@ -2214,7 +2214,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapability(const void *data)
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data; virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt); qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1; int ret = -1;
int cap; const char *cap;
char **caps = NULL;
const char *reply = const char *reply =
"{" "{"
" \"return\": [" " \"return\": ["
@ -2234,12 +2235,14 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapability(const void *data)
"{\"return\":{}}") < 0) "{\"return\":{}}") < 0)
goto cleanup; goto cleanup;
cap = qemuMonitorJSONGetMigrationCapability(qemuMonitorTestGetMonitor(test), if (qemuMonitorGetMigrationCapabilities(qemuMonitorTestGetMonitor(test),
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE); &caps) < 0)
if (cap != 1) { goto cleanup;
cap = qemuMonitorMigrationCapsTypeToString(QEMU_MONITOR_MIGRATION_CAPS_XBZRLE);
if (!virStringListHasString((const char **) caps, cap)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"Unexpected capability: %d, expecting 1", "Expected capability %s is missing", cap);
cap);
goto cleanup; goto cleanup;
} }
@ -2251,6 +2254,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapability(const void *data)
ret = 0; ret = 0;
cleanup: cleanup:
qemuMonitorTestFree(test); qemuMonitorTestFree(test);
virStringListFree(caps);
return ret; return ret;
} }