Unify with other code that generates parameters for the 'transaction' command.
Signed-off-by: Peter Krempa <pkre...@redhat.com> --- src/qemu/qemu_monitor.c | 21 +++++++++++++++++++++ src/qemu/qemu_monitor.h | 11 +++++++++++ src/qemu/qemu_monitor_json.c | 35 +++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 11 +++++++++++ 4 files changed, 78 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index b1499503d4..0f54c5c0e2 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -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); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 4f449f3515..c6f1f3572b 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -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); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index b1f29e4870..527a658b08 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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) { diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index d5408107be..39a84b3efd 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -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); -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list