* [Qemu-devel] [PATCH] blockdev: Replace "undefined error" in qmp_block_resize
@ 2013-05-02 13:32 Kevin Wolf
2013-05-02 14:04 ` Eric Blake
2013-05-02 14:49 ` Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2013-05-02 13:32 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, stefanha
We have an errno value that can be displayed, so we should just do that.
An easy way to reproduce this case is to resize a raw image to a size
that is too large for the host file system.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
blockdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 6e293e9..7c9d8dd 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1118,6 +1118,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
void qmp_block_resize(const char *device, int64_t size, Error **errp)
{
BlockDriverState *bs;
+ int ret;
bs = bdrv_find(device);
if (!bs) {
@@ -1133,7 +1134,8 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp)
/* complete all in-flight operations before resizing the device */
bdrv_drain_all();
- switch (bdrv_truncate(bs, size)) {
+ ret = bdrv_truncate(bs, size);
+ switch (ret) {
case 0:
break;
case -ENOMEDIUM:
@@ -1149,7 +1151,7 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp)
error_set(errp, QERR_DEVICE_IN_USE, device);
break;
default:
- error_set(errp, QERR_UNDEFINED_ERROR);
+ error_setg_errno(errp, -ret, "Could not resize");
break;
}
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] blockdev: Replace "undefined error" in qmp_block_resize
2013-05-02 13:32 [Qemu-devel] [PATCH] blockdev: Replace "undefined error" in qmp_block_resize Kevin Wolf
@ 2013-05-02 14:04 ` Eric Blake
2013-05-02 14:49 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2013-05-02 14:04 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, stefanha
[-- Attachment #1: Type: text/plain, Size: 534 bytes --]
On 05/02/2013 07:32 AM, Kevin Wolf wrote:
> We have an errno value that can be displayed, so we should just do that.
> An easy way to reproduce this case is to resize a raw image to a size
> that is too large for the host file system.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> blockdev.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] blockdev: Replace "undefined error" in qmp_block_resize
2013-05-02 13:32 [Qemu-devel] [PATCH] blockdev: Replace "undefined error" in qmp_block_resize Kevin Wolf
2013-05-02 14:04 ` Eric Blake
@ 2013-05-02 14:49 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-05-02 14:49 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On Thu, May 02, 2013 at 03:32:55PM +0200, Kevin Wolf wrote:
> We have an errno value that can be displayed, so we should just do that.
> An easy way to reproduce this case is to resize a raw image to a size
> that is too large for the host file system.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> blockdev.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-02 14:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 13:32 [Qemu-devel] [PATCH] blockdev: Replace "undefined error" in qmp_block_resize Kevin Wolf
2013-05-02 14:04 ` Eric Blake
2013-05-02 14:49 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).