qemu: monitor: Introduce qemuMonitorBitmapRemove

The non-transaction wrapper is useful for code paths which want to
delete individual bitmaps or for cleanup after a failed job where we
want to attempt to delete every bitmap individually to prevent a failure
from cleaning up the rest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Peter Krempa 2021-02-08 16:58:53 +01:00
parent 8da9c7456d
commit 7a8d7d75df
5 changed files with 50 additions and 0 deletions

View File

@ -4653,6 +4653,19 @@ qemuMonitorTransactionBitmapRemove(virJSONValuePtr actions,
}
int
qemuMonitorBitmapRemove(qemuMonitorPtr mon,
const char *node,
const char *name)
{
VIR_DEBUG("node='%s', name='%s'", node, name);
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONBitmapRemove(mon, node, name);
}
int
qemuMonitorTransactionBitmapEnable(virJSONValuePtr actions,
const char *node,

View File

@ -1478,6 +1478,11 @@ int
qemuMonitorTransactionBitmapRemove(virJSONValuePtr actions,
const char *node,
const char *name);
int
qemuMonitorBitmapRemove(qemuMonitorPtr mon,
const char *node,
const char *name);
int
qemuMonitorTransactionBitmapEnable(virJSONValuePtr actions,
const char *node,

View File

@ -9252,6 +9252,30 @@ qemuMonitorJSONTransactionBitmapRemove(virJSONValuePtr actions,
}
int
qemuMonitorJSONBitmapRemove(qemuMonitorPtr mon,
const char *node,
const char *name)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-remove",
"s:node", node,
"s:name", name,
NULL)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
return -1;
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
return -1;
return 0;
}
int
qemuMonitorJSONTransactionBitmapEnable(virJSONValuePtr actions,
const char *node,

View File

@ -659,6 +659,12 @@ int
qemuMonitorJSONTransactionBitmapRemove(virJSONValuePtr actions,
const char *node,
const char *name);
int
qemuMonitorJSONBitmapRemove(qemuMonitorPtr mon,
const char *node,
const char *name);
int
qemuMonitorJSONTransactionBitmapEnable(virJSONValuePtr actions,
const char *node,

View File

@ -1215,6 +1215,7 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayOpen, "foodev", true)
GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayClose, "foodev")
GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumRemove, "foodev")
GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumInsert, "foodev", "newnode")
GEN_TEST_FUNC(qemuMonitorJSONBitmapRemove, "foodev", "newnode")
GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname")
GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname", false)
GEN_TEST_FUNC(qemuMonitorJSONJobComplete, "jobname")
@ -3132,6 +3133,7 @@ mymain(void)
DO_TEST_GEN(qemuMonitorJSONBlockdevTrayClose);
DO_TEST_GEN(qemuMonitorJSONBlockdevMediumRemove);
DO_TEST_GEN(qemuMonitorJSONBlockdevMediumInsert);
DO_TEST_GEN(qemuMonitorJSONBitmapRemove);
DO_TEST_GEN(qemuMonitorJSONJobDismiss);
DO_TEST_GEN(qemuMonitorJSONJobCancel);
DO_TEST_GEN(qemuMonitorJSONJobComplete);