qemu: monitor: Add transaction generators for snapshot APIs

Unify with other code that generates parameters for the 'transaction'
command.

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 16:03:46 +02:00
parent 2adae485ae
commit 5cf0a3752f
4 changed files with 78 additions and 0 deletions

View File

@ -4539,3 +4539,24 @@ qemuMonitorTransactionBitmapMerge(virJSONValuePtr actions,
{
return qemuMonitorJSONTransactionBitmapMerge(actions, node, target, sources);
}
int
qemuMonitorTransactionSnapshotLegacy(virJSONValuePtr actions,
const char *device,
const char *path,
const char *format,
bool existing)
{
return qemuMonitorJSONTransactionSnapshotLegacy(actions, device, path,
format, existing);
}
int
qemuMonitorTransactionSnapshotBlockdev(virJSONValuePtr actions,
const char *node,
const char *overlay)
{
return qemuMonitorJSONTransactionSnapshotBlockdev(actions, node, overlay);
}

View File

@ -1361,3 +1361,14 @@ qemuMonitorTransactionBitmapMerge(virJSONValuePtr actions,
const char *node,
const char *target,
virJSONValuePtr *sources);
int
qemuMonitorTransactionSnapshotLegacy(virJSONValuePtr actions,
const char *device,
const char *path,
const char *format,
bool existing);
int
qemuMonitorTransactionSnapshotBlockdev(virJSONValuePtr actions,
const char *node,
const char *overlay);

View File

@ -9100,6 +9100,41 @@ qemuMonitorJSONTransactionBitmapMerge(virJSONValuePtr actions,
}
int
qemuMonitorJSONTransactionSnapshotLegacy(virJSONValuePtr actions,
const char *device,
const char *path,
const char *format,
bool existing)
{
const char *mode = NULL;
if (existing)
mode = "existing";
return qemuMonitorJSONTransactionAdd(actions,
"blockdev-snapshot-sync",
"s:device", device,
"s:snapshot-file", path,
"s:format", format,
"S:mode", mode,
NULL);
}
int
qemuMonitorJSONTransactionSnapshotBlockdev(virJSONValuePtr actions,
const char *node,
const char *overlay)
{
return qemuMonitorJSONTransactionAdd(actions,
"blockdev-snapshot",
"s:node", node,
"s:overlay", overlay,
NULL);
}
static qemuMonitorJobInfoPtr
qemuMonitorJSONGetJobInfoOne(virJSONValuePtr data)
{

View File

@ -656,3 +656,14 @@ qemuMonitorJSONTransactionBitmapMerge(virJSONValuePtr actions,
const char *node,
const char *target,
virJSONValuePtr *sources);
int
qemuMonitorJSONTransactionSnapshotLegacy(virJSONValuePtr actions,
const char *device,
const char *path,
const char *format,
bool existing);
int
qemuMonitorJSONTransactionSnapshotBlockdev(virJSONValuePtr actions,
const char *node,
const char *overlay);