mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemumonitorjsontest: Test qemuMonitorJSONGetMigrationCapability
And so do qemuMonitorJSONSetMigrationCapability.
This commit is contained in:
parent
02d57c7226
commit
f371400262
@ -1697,6 +1697,51 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
testQemuMonitorJSONqemuMonitorJSONGetMigrationCapability(const void *data)
|
||||
{
|
||||
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
|
||||
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
|
||||
int ret = -1;
|
||||
int cap;
|
||||
const char *reply =
|
||||
"{"
|
||||
" \"return\": ["
|
||||
" {"
|
||||
" \"state\": false,"
|
||||
" \"capability\": \"xbzrle\""
|
||||
" }"
|
||||
" ],"
|
||||
" \"id\": \"libvirt-22\""
|
||||
"}";
|
||||
|
||||
if (!test)
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorTestAddItem(test, "query-migrate-capabilities", reply) < 0 ||
|
||||
qemuMonitorTestAddItem(test, "migrate-set-capabilities",
|
||||
"{\"return\":{}}") < 0)
|
||||
goto cleanup;
|
||||
|
||||
cap = qemuMonitorJSONGetMigrationCapability(qemuMonitorTestGetMonitor(test),
|
||||
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE);
|
||||
if (cap != 1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Unexpected capability: %d, expecting 1",
|
||||
cap);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuMonitorJSONSetMigrationCapability(qemuMonitorTestGetMonitor(test),
|
||||
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
qemuMonitorTestFree(test);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
mymain(void)
|
||||
{
|
||||
@ -1755,6 +1800,7 @@ mymain(void)
|
||||
DO_TEST(qemuMonitorJSONGetPtyPaths);
|
||||
DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
|
||||
DO_TEST(qemuMonitorJSONGetTargetArch);
|
||||
DO_TEST(qemuMonitorJSONGetMigrationCapability);
|
||||
|
||||
virObjectUnref(xmlopt);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user