qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] block: do_commit() does not pass along error messag


From: Jeff Cody
Subject: [Qemu-devel] [PATCH] block: do_commit() does not pass along error messages for all errors
Date: Wed, 16 Jan 2013 18:04:52 -0500

The non-live bdrv_commit() function may return one of the following
errors: -ENOTSUP, -EBUSY, -EACCES, -EIO.  The only error that is
checked in the HMP handler is -EBUSY, so the monitor command 'commit'
silently fails for all error cases other than 'Device is in use'.

This patch adds the appropriate error messages for the errors
explicitely returned by bdrv_commit().

Signed-off-by: Jeff Cody <address@hidden>
---
 blockdev.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index d724e2d..7db7d8e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -657,6 +657,20 @@ void do_commit(Monitor *mon, const QDict *qdict)
             qerror_report(QERR_DEVICE_IN_USE, device);
             return;
         }
+        if (ret == -EACCES) {
+            qerror_report(QERR_DEVICE_IS_READ_ONLY, device);
+            return;
+        }
+        if (ret == -EIO) {
+            qerror_report(QERR_IO_ERROR);
+            return;
+        }
+        if (ret == -ENOTSUP) {
+            const char *format = bdrv_get_format_name(bs);
+            qerror_report(QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+                          format ? format : "NULL", device, "commit");
+
+        }
     }
 }
 
-- 
1.8.0.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]