From ee06cd36e3b5889c59af9bc4e750fae26269c8d3 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 14 Aug 2018 13:11:05 +0200 Subject: [PATCH] qemu: monitor: Rename 'device' argument for block job control APIs Starting from qemu 2.7 the 'device' argument is in fact a name of the job itself. Change our APIs accordingly and adjust the error message. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_monitor.c | 18 +++++++++--------- src/qemu/qemu_monitor.h | 6 +++--- src/qemu/qemu_monitor_json.c | 22 +++++++++++----------- src/qemu/qemu_monitor_json.h | 6 +++--- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 68a9e0a874..0246189224 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3323,13 +3323,13 @@ qemuMonitorDiskNameLookup(qemuMonitorPtr mon, /* Use the block-job-complete monitor command to pivot a block copy job. */ int qemuMonitorDrivePivot(qemuMonitorPtr mon, - const char *device) + const char *jobname) { - VIR_DEBUG("device=%s", device); + VIR_DEBUG("jobname=%s", jobname); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONDrivePivot(mon, device); + return qemuMonitorJSONDrivePivot(mon, jobname); } @@ -3403,26 +3403,26 @@ qemuMonitorBlockStream(qemuMonitorPtr mon, int qemuMonitorBlockJobCancel(qemuMonitorPtr mon, - const char *device) + const char *jobname) { - VIR_DEBUG("device=%s", device); + VIR_DEBUG("jobname=%s", jobname); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONBlockJobCancel(mon, device); + return qemuMonitorJSONBlockJobCancel(mon, jobname); } int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon, - const char *device, + const char *jobname, unsigned long long bandwidth) { - VIR_DEBUG("device=%s, bandwidth=%lluB", device, bandwidth); + VIR_DEBUG("jobname=%s, bandwidth=%lluB", jobname, bandwidth); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONBlockJobSetSpeed(mon, device, bandwidth); + return qemuMonitorJSONBlockJobSetSpeed(mon, jobname, bandwidth); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index e4c71eda50..48b142a4f4 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -872,7 +872,7 @@ int qemuMonitorBlockdevMirror(qemuMonitorPtr mon, unsigned int flags) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); int qemuMonitorDrivePivot(qemuMonitorPtr mon, - const char *device) + const char *jobname) ATTRIBUTE_NONNULL(2); int qemuMonitorBlockCommit(qemuMonitorPtr mon, @@ -914,11 +914,11 @@ int qemuMonitorBlockStream(qemuMonitorPtr mon, ATTRIBUTE_NONNULL(2); int qemuMonitorBlockJobCancel(qemuMonitorPtr mon, - const char *device) + const char *jobname) ATTRIBUTE_NONNULL(2); int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon, - const char *device, + const char *jobname, unsigned long long bandwidth); typedef struct _qemuMonitorBlockJobInfo qemuMonitorBlockJobInfo; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index abcb60d3a1..2c3ba27cbf 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4768,14 +4768,14 @@ qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon) static int qemuMonitorJSONBlockJobError(virJSONValuePtr cmd, virJSONValuePtr reply, - const char *device) + const char *jobname) { virJSONValuePtr error; if ((error = virJSONValueObjectGet(reply, "error")) && (qemuMonitorJSONErrorIsClass(error, "DeviceNotActive"))) { virReportError(VIR_ERR_OPERATION_INVALID, - _("No active operation on device: %s"), device); + _("No active block job '%s'"), jobname); return -1; } @@ -4820,21 +4820,21 @@ qemuMonitorJSONBlockStream(qemuMonitorPtr mon, int qemuMonitorJSONBlockJobCancel(qemuMonitorPtr mon, - const char *device) + const char *jobname) { int ret = -1; virJSONValuePtr cmd = NULL; virJSONValuePtr reply = NULL; if (!(cmd = qemuMonitorJSONMakeCommand("block-job-cancel", - "s:device", device, + "s:device", jobname, NULL))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) goto cleanup; - if (qemuMonitorJSONBlockJobError(cmd, reply, device) < 0) + if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0) goto cleanup; ret = 0; @@ -4848,7 +4848,7 @@ qemuMonitorJSONBlockJobCancel(qemuMonitorPtr mon, int qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon, - const char *device, + const char *jobname, unsigned long long speed) { int ret = -1; @@ -4856,7 +4856,7 @@ qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon, virJSONValuePtr reply = NULL; if (!(cmd = qemuMonitorJSONMakeCommand("block-job-set-speed", - "s:device", device, + "s:device", jobname, "J:speed", speed, NULL))) return -1; @@ -4864,7 +4864,7 @@ qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon, if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) goto cleanup; - if (qemuMonitorJSONBlockJobError(cmd, reply, device) < 0) + if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0) goto cleanup; ret = 0; @@ -4878,14 +4878,14 @@ qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon, int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon, - const char *device) + const char *jobname) { int ret = -1; virJSONValuePtr cmd; virJSONValuePtr reply = NULL; cmd = qemuMonitorJSONMakeCommand("block-job-complete", - "s:device", device, + "s:device", jobname, NULL); if (!cmd) return -1; @@ -4893,7 +4893,7 @@ qemuMonitorJSONDrivePivot(qemuMonitorPtr mon, if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) goto cleanup; - if (qemuMonitorJSONBlockJobError(cmd, reply, device) < 0) + if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0) goto cleanup; ret = 0; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 51214e3797..69faecd0ab 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -267,7 +267,7 @@ int qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon, unsigned int flags) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon, - const char *device) + const char *jobname) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int qemuMonitorJSONBlockCommit(qemuMonitorPtr mon, @@ -310,11 +310,11 @@ int qemuMonitorJSONBlockStream(qemuMonitorPtr mon, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int qemuMonitorJSONBlockJobCancel(qemuMonitorPtr mon, - const char *device) + const char *jobname) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon, - const char *device, + const char *jobname, unsigned long long speed) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);