Skip to contentSkip to conversation

blockdev: Use error_report() in hmp_commit()

PATCH In review Kevin Wolf 3 participants 3 messages Oct 15, 2019

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 blockdev: Use error_report() in hmp_commit()

Instead of using monitor_printf() to report errors, hmp_commit() should use error_report() like other places do.

---
 blockdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
blockdev.c +3 -4
index f89e48fc79..e2358966c3 100644
@@ -1088,11 +1088,11 @@ void hmp_commit(Monitor *mon, const QDict *qdict)
 
         blk = blk_by_name(device);
         if (!blk) {
-            monitor_printf(mon, "Device '%s' not found\n", device);
+            error_report("Device '%s' not found", device);
             return;
         }
         if (!blk_is_available(blk)) {
-            monitor_printf(mon, "Device '%s' has no medium\n", device);
+            error_report("Device '%s' has no medium", device);
             return;
         }
 
@@ -1105,8 +1105,7 @@ void hmp_commit(Monitor *mon, const QDict *qdict)
         aio_context_release(aio_context);
     }
     if (ret < 0) {
-        monitor_printf(mon, "'commit' error for '%s': %s\n", device,
-                       strerror(-ret));
+        error_report("'commit' error for '%s': %s", device, strerror(-ret));
     }
 }
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Kevin Wolf

Instead of using monitor_printf() to report errors, hmp_commit() should use error_report() like other places do.

---
  blockdev.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kevin Wolf
Quoted 28 lines · Kevin Wolf

Instead of using monitor_printf() to report errors, hmp_commit() should use error_report() like other places do.

---
  blockdev.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
blockdev.c +2 -2
index f89e48fc79..e2358966c3 100644
@@ -1088,11 +1088,11 @@ void hmp_commit(Monitor *mon, const QDict *qdict)
 
          blk = blk_by_name(device);
          if (!blk) {
-            monitor_printf(mon, "Device '%s' not found\n", device);
+            error_report("Device '%s' not found", device);
              return;
          }
          if (!blk_is_available(blk)) {
-            monitor_printf(mon, "Device '%s' has no medium\n", device);
+            error_report("Device '%s' has no medium", device);
              return;
          }
 

blockdev.c void hmp_commit(Monitor *mon, const QDict *qdict) · line 1111

Quoted 9 lines
blockdev.c +1 -2
@@ -1105,8 +1105,7 @@ void hmp_commit(Monitor *mon, const QDict *qdict)
          aio_context_release(aio_context);
      }
      if (ret < 0) {
-        monitor_printf(mon, "'commit' error for '%s': %s\n", device,
-                       strerror(-ret));
+        error_report("'commit' error for '%s': %s", device, strerror(-ret));
      }
  }