mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: monitor: Add helper for generating data for block bitmap merging
Introduce qemuMonitorTransactionBitmapMergeSourceAddBitmap which adds the appropriate entry into a virJSONValue array to be used with qemuMonitorTransactionBitmapMerge. Bitmap merging supports two possible formats and this new helper implements the more universal one specifying also the source node name. In addition use the new helper in the testQemuMonitorJSONTransaction test. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
cbaee2199b
commit
bac02e396d
@ -4598,6 +4598,15 @@ qemuMonitorTransactionBitmapMerge(virJSONValuePtr actions,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorTransactionBitmapMergeSourceAddBitmap(virJSONValuePtr sources,
|
||||
const char *sourcenode,
|
||||
const char *sourcebitmap)
|
||||
{
|
||||
return qemuMonitorJSONTransactionBitmapMergeSourceAddBitmap(sources, sourcenode, sourcebitmap);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorTransactionSnapshotLegacy(virJSONValuePtr actions,
|
||||
const char *device,
|
||||
|
@ -1383,6 +1383,10 @@ qemuMonitorTransactionBitmapMerge(virJSONValuePtr actions,
|
||||
const char *node,
|
||||
const char *target,
|
||||
virJSONValuePtr *sources);
|
||||
int
|
||||
qemuMonitorTransactionBitmapMergeSourceAddBitmap(virJSONValuePtr sources,
|
||||
const char *sourcenode,
|
||||
const char *sourcebitmap);
|
||||
|
||||
int
|
||||
qemuMonitorTransactionSnapshotLegacy(virJSONValuePtr actions,
|
||||
|
@ -9281,6 +9281,27 @@ qemuMonitorJSONTransactionBitmapMerge(virJSONValuePtr actions,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorJSONTransactionBitmapMergeSourceAddBitmap(virJSONValuePtr sources,
|
||||
const char *sourcenode,
|
||||
const char *sourcebitmap)
|
||||
{
|
||||
g_autoptr(virJSONValue) sourceobj = NULL;
|
||||
|
||||
if (virJSONValueObjectCreate(&sourceobj,
|
||||
"s:node", sourcenode,
|
||||
"s:name", sourcebitmap,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (virJSONValueArrayAppend(sources, sourceobj) < 0)
|
||||
return -1;
|
||||
|
||||
sourceobj = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorJSONTransactionSnapshotLegacy(virJSONValuePtr actions,
|
||||
const char *device,
|
||||
|
@ -669,6 +669,11 @@ qemuMonitorJSONTransactionBitmapMerge(virJSONValuePtr actions,
|
||||
const char *target,
|
||||
virJSONValuePtr *sources);
|
||||
|
||||
int
|
||||
qemuMonitorJSONTransactionBitmapMergeSourceAddBitmap(virJSONValuePtr sources,
|
||||
const char *sourcenode,
|
||||
const char *sourcebitmap);
|
||||
|
||||
int
|
||||
qemuMonitorJSONTransactionSnapshotLegacy(virJSONValuePtr actions,
|
||||
const char *device,
|
||||
|
@ -3018,8 +3018,8 @@ testQemuMonitorJSONTransaction(const void *opaque)
|
||||
!(mergebitmaps = virJSONValueNewArray()))
|
||||
return -1;
|
||||
|
||||
if (virJSONValueArrayAppendString(mergebitmaps, "mergemap1") < 0 ||
|
||||
virJSONValueArrayAppendString(mergebitmaps, "mergemap2") < 0)
|
||||
if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, "node1", "bitmap1") < 0 ||
|
||||
qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, "node2", "bitmap2") < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorTransactionBitmapAdd(actions, "node1", "bitmap1", true, true) < 0 ||
|
||||
|
Loading…
Reference in New Issue
Block a user