mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
qemuBlockExportAddNBD: Use 'block-export-add' when available
Switch to the new QMP command once it becomes available. Since the code was refactored to have just one central location to do this we can contain the ugly bits to just this one function. Since we now use the replacement for 'nbd-server-add' mark the test case as being OK with removal of the command. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f70e9c6cb8
commit
8c67e389d6
@ -3414,15 +3414,27 @@ qemuBlockExportAddNBD(virDomainObjPtr vm,
|
||||
const char *bitmap)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
const char *exportsrc = drivealias;
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
exportsrc = src->nodeformat;
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCK_EXPORT_ADD)) {
|
||||
g_autoptr(virJSONValue) nbdprops = NULL;
|
||||
|
||||
if (!(nbdprops = qemuBlockExportGetNBDProps(src->nodeformat,
|
||||
exportname,
|
||||
writable,
|
||||
bitmap)))
|
||||
return -1;
|
||||
|
||||
return qemuMonitorBlockExportAdd(priv->mon, &nbdprops);
|
||||
} else {
|
||||
return qemuMonitorNBDServerAdd(priv->mon, src->nodeformat,
|
||||
exportname, writable, bitmap);
|
||||
}
|
||||
} else {
|
||||
/* older qemu versions didn't support configuring the exportname and
|
||||
* took the 'drivealias' as the export name */
|
||||
exportname = NULL;
|
||||
return qemuMonitorNBDServerAdd(priv->mon, drivealias, NULL, writable, NULL);
|
||||
}
|
||||
|
||||
return qemuMonitorNBDServerAdd(priv->mon, exportsrc, exportname, writable, bitmap);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3299,7 +3299,7 @@ mymain(void)
|
||||
DO_TEST_GEN(qemuMonitorJSONDrivePivot);
|
||||
DO_TEST_GEN(qemuMonitorJSONScreendump);
|
||||
DO_TEST_GEN(qemuMonitorJSONOpenGraphics);
|
||||
DO_TEST_GEN_DEPRECATED(qemuMonitorJSONNBDServerAdd, false);
|
||||
DO_TEST_GEN_DEPRECATED(qemuMonitorJSONNBDServerAdd, true);
|
||||
DO_TEST_GEN(qemuMonitorJSONDetachCharDev);
|
||||
DO_TEST_GEN(qemuMonitorJSONBlockdevTrayOpen);
|
||||
DO_TEST_GEN(qemuMonitorJSONBlockdevTrayClose);
|
||||
|
Loading…
x
Reference in New Issue
Block a user