qemu: monitor: Add transaction generators for dirty bitmap APIs

Rather than generating the transaction contents in random places add a
unified set of APIs to generate the contents for a 'transaction' for the
dirty bitmap APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2019-09-26 15:53:39 +02:00
parent 6227d9806f
commit 2adae485ae
4 changed files with 167 additions and 0 deletions

View File

@ -4491,3 +4491,51 @@ qemuMonitorGetJobInfo(qemuMonitorPtr mon,
return qemuMonitorJSONGetJobInfo(mon, jobs, njobs);
}
int
qemuMonitorTransactionBitmapAdd(virJSONValuePtr actions,
const char *node,
const char *name,
bool persistent,
bool disabled)
{
return qemuMonitorJSONTransactionBitmapAdd(actions, node, name, persistent, disabled);
}
int
qemuMonitorTransactionBitmapRemove(virJSONValuePtr actions,
const char *node,
const char *name)
{
return qemuMonitorJSONTransactionBitmapRemove(actions, node, name);
}
int
qemuMonitorTransactionBitmapEnable(virJSONValuePtr actions,
const char *node,
const char *name)
{
return qemuMonitorJSONTransactionBitmapEnable(actions, node, name);
}
int
qemuMonitorTransactionBitmapDisable(virJSONValuePtr actions,
const char *node,
const char *name)
{
return qemuMonitorJSONTransactionBitmapDisable(actions, node, name);
}
int
qemuMonitorTransactionBitmapMerge(virJSONValuePtr actions,
const char *node,
const char *target,
virJSONValuePtr *sources)
{
return qemuMonitorJSONTransactionBitmapMerge(actions, node, target, sources);
}

View File

@ -1337,3 +1337,27 @@ VIR_DEFINE_AUTOPTR_FUNC(qemuMonitorJobInfo, qemuMonitorJobInfoFree);
int qemuMonitorGetJobInfo(qemuMonitorPtr mon,
qemuMonitorJobInfoPtr **jobs,
size_t *njobs);
int
qemuMonitorTransactionBitmapAdd(virJSONValuePtr actions,
const char *node,
const char *name,
bool persistent,
bool disabled);
int
qemuMonitorTransactionBitmapRemove(virJSONValuePtr actions,
const char *node,
const char *name);
int
qemuMonitorTransactionBitmapEnable(virJSONValuePtr actions,
const char *node,
const char *name);
int
qemuMonitorTransactionBitmapDisable(virJSONValuePtr actions,
const char *node,
const char *name);
int
qemuMonitorTransactionBitmapMerge(virJSONValuePtr actions,
const char *node,
const char *target,
virJSONValuePtr *sources);

View File

@ -9029,6 +9029,77 @@ qemuMonitorJSONDeleteBitmap(qemuMonitorPtr mon,
}
int
qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr actions,
const char *node,
const char *name,
bool persistent,
bool disabled)
{
return qemuMonitorJSONTransactionAdd(actions,
"block-dirty-bitmap-add",
"s:node", node,
"s:name", name,
"b:persistent", persistent,
"b:disabled", disabled,
NULL);
}
int
qemuMonitorJSONTransactionBitmapRemove(virJSONValuePtr actions,
const char *node,
const char *name)
{
return qemuMonitorJSONTransactionAdd(actions,
"block-dirty-bitmap-remove",
"s:node", node,
"s:name", name,
NULL);
}
int
qemuMonitorJSONTransactionBitmapEnable(virJSONValuePtr actions,
const char *node,
const char *name)
{
return qemuMonitorJSONTransactionAdd(actions,
"block-dirty-bitmap-enable",
"s:node", node,
"s:name", name,
NULL);
}
int
qemuMonitorJSONTransactionBitmapDisable(virJSONValuePtr actions,
const char *node,
const char *name)
{
return qemuMonitorJSONTransactionAdd(actions,
"block-dirty-bitmap-disable",
"s:node", node,
"s:name", name,
NULL);
}
int
qemuMonitorJSONTransactionBitmapMerge(virJSONValuePtr actions,
const char *node,
const char *target,
virJSONValuePtr *sources)
{
return qemuMonitorJSONTransactionAdd(actions,
"block-dirty-bitmap-merge",
"s:node", node,
"s:target", target,
"a:bitmaps", sources,
NULL);
}
static qemuMonitorJobInfoPtr
qemuMonitorJSONGetJobInfoOne(virJSONValuePtr data)
{

View File

@ -632,3 +632,27 @@ int qemuMonitorJSONMergeBitmaps(qemuMonitorPtr mon,
int qemuMonitorJSONDeleteBitmap(qemuMonitorPtr mon,
const char *node,
const char *bitmap);
int
qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr actions,
const char *node,
const char *name,
bool persistent,
bool disabled);
int
qemuMonitorJSONTransactionBitmapRemove(virJSONValuePtr actions,
const char *node,
const char *name);
int
qemuMonitorJSONTransactionBitmapEnable(virJSONValuePtr actions,
const char *node,
const char *name);
int
qemuMonitorJSONTransactionBitmapDisable(virJSONValuePtr actions,
const char *node,
const char *name);
int
qemuMonitorJSONTransactionBitmapMerge(virJSONValuePtr actions,
const char *node,
const char *target,
virJSONValuePtr *sources);