mirror of https://gitee.com/openkylin/libvirt.git
qemu: monitor: Remove non-transaction based dirty bitmap APIs
We replaced them by use of transaction to simplify possible failure scenarios. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
cec4e32998
commit
a4762294b9
|
@ -4472,57 +4472,6 @@ qemuMonitorGetCurrentMachineInfo(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorAddBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap,
|
||||
bool persistent)
|
||||
{
|
||||
VIR_DEBUG("node=%s bitmap=%s persistent=%d", node, bitmap, persistent);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONAddBitmap(mon, node, bitmap, persistent);
|
||||
}
|
||||
|
||||
int
|
||||
qemuMonitorEnableBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap)
|
||||
{
|
||||
VIR_DEBUG("node=%s bitmap=%s", node, bitmap);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONEnableBitmap(mon, node, bitmap);
|
||||
}
|
||||
|
||||
int
|
||||
qemuMonitorMergeBitmaps(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *dst,
|
||||
virJSONValuePtr *src)
|
||||
{
|
||||
VIR_DEBUG("node=%s dst=%s", node, dst);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONMergeBitmaps(mon, node, dst, src);
|
||||
}
|
||||
|
||||
int
|
||||
qemuMonitorDeleteBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap)
|
||||
{
|
||||
VIR_DEBUG("node=%s bitmap=%s", node, bitmap);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONDeleteBitmap(mon, node, bitmap);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
qemuMonitorJobInfoFree(qemuMonitorJobInfoPtr job)
|
||||
{
|
||||
|
|
|
@ -702,25 +702,6 @@ int qemuMonitorSetBalloon(qemuMonitorPtr mon,
|
|||
unsigned long long newmem);
|
||||
int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);
|
||||
|
||||
int qemuMonitorAddBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap,
|
||||
bool persistent)
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
int qemuMonitorEnableBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap)
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
int qemuMonitorMergeBitmaps(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *dst,
|
||||
virJSONValuePtr *src)
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
|
||||
int qemuMonitorDeleteBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap)
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
|
||||
|
||||
/* XXX should we pass the virDomainDiskDefPtr instead
|
||||
* and hide dev_name details inside monitor. Reconsider
|
||||
|
|
|
@ -9073,125 +9073,6 @@ qemuMonitorJSONGetCurrentMachineInfo(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorJSONAddBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap,
|
||||
bool persistent)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-add",
|
||||
"s:node", node,
|
||||
"s:name", bitmap,
|
||||
"b:persistent", persistent,
|
||||
NULL)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
qemuMonitorJSONEnableBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-enable",
|
||||
"s:node", node,
|
||||
"s:name", bitmap,
|
||||
NULL)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
qemuMonitorJSONMergeBitmaps(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *dst,
|
||||
virJSONValuePtr *src)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-merge",
|
||||
"s:node", node,
|
||||
"s:target", dst,
|
||||
"a:bitmaps", src,
|
||||
NULL)))
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virJSONValueFree(*src);
|
||||
*src = NULL;
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
qemuMonitorJSONDeleteBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block-dirty-bitmap-remove",
|
||||
"s:node", node,
|
||||
"s:name", bitmap,
|
||||
NULL)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr actions,
|
||||
const char *node,
|
||||
|
|
|
@ -627,23 +627,6 @@ int
|
|||
qemuMonitorJSONGetCurrentMachineInfo(qemuMonitorPtr mon,
|
||||
qemuMonitorCurrentMachineInfoPtr info)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
int qemuMonitorJSONAddBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap,
|
||||
bool persistent);
|
||||
|
||||
int qemuMonitorJSONEnableBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap);
|
||||
|
||||
int qemuMonitorJSONMergeBitmaps(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *dst,
|
||||
virJSONValuePtr *src);
|
||||
|
||||
int qemuMonitorJSONDeleteBitmap(qemuMonitorPtr mon,
|
||||
const char *node,
|
||||
const char *bitmap);
|
||||
|
||||
int
|
||||
qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr actions,
|
||||
|
|
|
@ -1335,9 +1335,6 @@ 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(qemuMonitorJSONAddBitmap, "node", "bitmap", true)
|
||||
GEN_TEST_FUNC(qemuMonitorJSONEnableBitmap, "node", "bitmap")
|
||||
GEN_TEST_FUNC(qemuMonitorJSONDeleteBitmap, "node", "bitmap")
|
||||
GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname")
|
||||
GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname", false)
|
||||
GEN_TEST_FUNC(qemuMonitorJSONJobComplete, "jobname")
|
||||
|
@ -1380,40 +1377,6 @@ testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
testQemuMonitorJSONqemuMonitorJSONMergeBitmaps(const void *opaque)
|
||||
{
|
||||
const testGenericData *data = opaque;
|
||||
virDomainXMLOptionPtr xmlopt = data->xmlopt;
|
||||
g_autoptr(qemuMonitorTest) test = NULL;
|
||||
g_autoptr(virJSONValue) arr = NULL;
|
||||
|
||||
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
|
||||
return -1;
|
||||
|
||||
if (!(arr = virJSONValueNewArray()))
|
||||
return -1;
|
||||
|
||||
if (virJSONValueArrayAppendString(arr, "b1") < 0 ||
|
||||
virJSONValueArrayAppendString(arr, "b2") < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorTestAddItem(test, "block-dirty-bitmap-merge",
|
||||
"{\"return\":{}}") < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONMergeBitmaps(qemuMonitorTestGetMonitor(test),
|
||||
"node", "dst", &arr) < 0)
|
||||
return -1;
|
||||
|
||||
if (arr) {
|
||||
VIR_TEST_VERBOSE("arr should have been cleared");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(struct qemuMonitorQueryCpusEntry *a,
|
||||
struct qemuMonitorQueryCpusEntry *b)
|
||||
|
@ -3154,9 +3117,6 @@ mymain(void)
|
|||
DO_TEST_GEN(qemuMonitorJSONBlockdevTrayClose);
|
||||
DO_TEST_GEN(qemuMonitorJSONBlockdevMediumRemove);
|
||||
DO_TEST_GEN(qemuMonitorJSONBlockdevMediumInsert);
|
||||
DO_TEST_GEN(qemuMonitorJSONAddBitmap);
|
||||
DO_TEST_GEN(qemuMonitorJSONEnableBitmap);
|
||||
DO_TEST_GEN(qemuMonitorJSONDeleteBitmap);
|
||||
DO_TEST_GEN(qemuMonitorJSONJobDismiss);
|
||||
DO_TEST_GEN(qemuMonitorJSONJobCancel);
|
||||
DO_TEST_GEN(qemuMonitorJSONJobComplete);
|
||||
|
@ -3176,7 +3136,6 @@ mymain(void)
|
|||
DO_TEST(qemuMonitorJSONSendKeyHoldtime);
|
||||
DO_TEST(qemuMonitorSupportsActiveCommit);
|
||||
DO_TEST(qemuMonitorJSONNBDServerStart);
|
||||
DO_TEST(qemuMonitorJSONMergeBitmaps);
|
||||
|
||||
DO_TEST_CPU_DATA("host");
|
||||
DO_TEST_CPU_DATA("full");
|
||||
|
|
Loading…
Reference in New Issue