[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 7/8] 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 <pkrempa redhat com>
---
 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 6e0644221b..9bc7aa9ed1 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3306,13 +3306,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);
 }


@@ -3386,26 +3386,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 2fa8d5b51d..ac41827693 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -861,7 +861,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,
@@ -903,11 +903,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 670089b87c..51b1fddccf 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4633,14 +4633,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;
     }

@@ -4685,21 +4685,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;
@@ -4713,7 +4713,7 @@ qemuMonitorJSONBlockJobCancel(qemuMonitorPtr mon,

 int
 qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon,
-                                const char *device,
+                                const char *jobname,
                                 unsigned long long speed)
 {
     int ret = -1;
@@ -4721,7 +4721,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;
@@ -4729,7 +4729,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;
@@ -4743,14 +4743,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;
@@ -4758,7 +4758,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 2408ab0c5b..013bee3364 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -264,7 +264,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,
@@ -307,11 +307,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);

-- 
2.16.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]