]> Git Repo - qemu.git/commitdiff
qemu-img: Report bdrv_block_status failures
authorEric Blake <[email protected]>
Sat, 23 Mar 2019 21:26:38 +0000 (16:26 -0500)
committerEric Blake <[email protected]>
Sat, 30 Mar 2019 15:06:07 +0000 (10:06 -0500)
If bdrv_block_status_above() fails, we are aborting the convert
process but failing to print an error message.  Broken in commit
690c7301 (v2.4) when rewriting convert's logic.

Discovered when teaching nbdkit to support NBD_CMD_BLOCK_STATUS, and
accidentally violating the protocol by returning more than one extent
in spite of qemu asking for NBD_CMD_FLAG_REQ_ONE.  The qemu NBD code
should probably handle the server's non-compliance more gracefully
than failing with EINVAL, but qemu-img shouldn't be silently
squelching any block status failures. It doesn't help that qemu 3.1
masks the qemu-img bug with extra noise that the nbd code is dumping
to stderr (that noise was cleaned up in d8b4bad8).

Reported-by: Richard W.M. Jones <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20190323212639[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
qemu-img.c

index 8ee63daeaeb4f897b2da639983ee82980c5b12a5..03a9a10dec145cf65b0f00b2cd5bd2209eb3c061 100644 (file)
@@ -1630,6 +1630,8 @@ static int convert_iteration_sectors(ImgConvertState *s, int64_t sector_num)
                                           count, &count, NULL, NULL);
         }
         if (ret < 0) {
+            error_report("error while reading block status of sector %" PRId64
+                         ": %s", sector_num, strerror(-ret));
             return ret;
         }
         n = DIV_ROUND_UP(count, BDRV_SECTOR_SIZE);
This page took 0.031973 seconds and 4 git commands to generate.