qemu: Add infrastructure for 'block-export-add' to export NBD

Add the monitor code, corresponding generator of properties for NBD and
tests validating it against the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa
2020-10-14 11:33:06 +02:00
parent adb9f7123a
commit f70e9c6cb8
7 changed files with 94 additions and 0 deletions

View File

@@ -3046,6 +3046,28 @@ testQemuMonitorJSONTransaction(const void *opaque)
}
static int
testQemuMonitorJSONBlockExportAdd(const void *opaque)
{
const testGenericData *data = opaque;
g_autoptr(qemuMonitorTest) test = NULL;
g_autoptr(virJSONValue) nbddata = NULL;
if (!(test = qemuMonitorTestNewSchema(data->xmlopt, data->schema)))
return -1;
if (!(nbddata = qemuBlockExportGetNBDProps("nodename", "exportname", true, "bitmapname")))
return -1;
if (qemuMonitorTestAddItem(test, "block-export-add", "{\"return\":{}}") < 0)
return -1;
if (qemuMonitorJSONBlockExportAdd(qemuMonitorTestGetMonitor(test), &nbddata) < 0)
return -1;
return 0;
}
static int
testQemuMonitorJSONqemuMonitorJSONGetCPUModelComparison(const void *opaque)
{
@@ -3243,6 +3265,7 @@ mymain(void)
DO_TEST(GetNonExistingCPUData);
DO_TEST(GetIOThreads);
DO_TEST(Transaction);
DO_TEST(BlockExportAdd);
DO_TEST_SIMPLE("qmp_capabilities", qemuMonitorJSONSetCapabilities);
DO_TEST_SIMPLE("system_powerdown", qemuMonitorJSONSystemPowerdown);
DO_TEST_SIMPLE("system_reset", qemuMonitorJSONSystemReset);