--- src/qemu/qemu_monitor.c | 14 ++++++++++++++ src/qemu/qemu_monitor.h | 5 +++++ src/qemu/qemu_monitor_json.c | 34 ++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 5 +++++ 4 files changed, 58 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 1d40d52..934a2c8 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4316,3 +4316,17 @@ qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info) VIR_FREE(info); } + + +int +qemuMonitorDriveBackup(virJSONValuePtr actions, + const char *device, const char *target, + const char *bitmap, const char *format, + unsigned long long speed, bool reuse) +{ + VIR_DEBUG("actions=%p, device=%s, target=%s, bitmap=%s format=%s speed==%llu", + actions, device, target, bitmap, format, speed); + + return qemuMonitorJSONDriveBackup(actions, device, target, bitmap, format, + speed, reuse); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 12f98be..f0196b8 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1125,4 +1125,9 @@ int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon); +int qemuMonitorDriveBackup(virJSONValuePtr actions, + const char *device, const char *target, + const char *bitmap, const char *format, + unsigned long long speed, bool reuse); + #endif /* QEMU_MONITOR_H */ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 0837290..b3446ee 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7647,5 +7647,39 @@ qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon) virJSONValueFree(cmd); virJSONValueFree(reply); + return ret; +} + + +int +qemuMonitorJSONDriveBackup(virJSONValuePtr actions, + const char *device, const char *target, + const char *bitmap, const char *format, + unsigned long long speed, bool reuse) +{ + int ret = -1; + virJSONValuePtr cmd; + + cmd = qemuMonitorJSONMakeCommandRaw(true, + "drive-backup", + "s:device", device, + "s:target", target, + "S:bitmap", bitmap, + "s:sync", bitmap ? "incremental" : "full", + "S:format", format, + "Y:speed", speed, + "S:mode", reuse ? "existing" : NULL, + NULL); + if (!cmd) + return -1; + + if (virJSONValueArrayAppend(actions, cmd) < 0) + goto cleanup; + + ret = 0; + cmd = NULL; + + cleanup: + virJSONValueFree(cmd); return ret; } diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index d090d57..24c4fba 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -522,4 +522,9 @@ int qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon) ATTRIBUTE_NONNULL(1); +int qemuMonitorJSONDriveBackup(virJSONValuePtr actions, + const char *device, const char *target, + const char *bitmap, const char *format, + unsigned long long speed, bool reuse) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); #endif /* QEMU_MONITOR_JSON_H */ -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list