aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2011-08-17 17:41:09 +0100
committerKevin Wolf <kwolf@redhat.com>2011-08-23 14:15:17 +0200
commit3fba9d8198a50f69e80aba8458d26cf1654e6e26 (patch)
tree36dae7fa0db1bef5d8cb22374aec59f237bd8747 /qemu-img.c
parentde33b1f3ddef8d6b4d53dbd4ae049262de2d3f02 (diff)
qemu-img: print error codes when convert fails
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 2fee782217..0561d77f9d 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -870,7 +870,8 @@ static int img_convert(int argc, char **argv)
ret = bdrv_read(bs[bs_i], bs_num, buf2, nlow);
if (ret < 0) {
- error_report("error while reading");
+ error_report("error while reading sector %" PRId64 ": %s",
+ bs_num, strerror(-ret));
goto out;
}
@@ -888,8 +889,8 @@ static int img_convert(int argc, char **argv)
ret = bdrv_write_compressed(out_bs, sector_num, buf,
cluster_sectors);
if (ret != 0) {
- error_report("error while compressing sector %" PRId64,
- sector_num);
+ error_report("error while compressing sector %" PRId64
+ ": %s", sector_num, strerror(-ret));
goto out;
}
}
@@ -952,7 +953,8 @@ static int img_convert(int argc, char **argv)
ret = bdrv_read(bs[bs_i], sector_num - bs_offset, buf, n);
if (ret < 0) {
- error_report("error while reading");
+ error_report("error while reading sector %" PRId64 ": %s",
+ sector_num - bs_offset, strerror(-ret));
goto out;
}
/* NOTE: at the same time we convert, we do not write zero
@@ -971,7 +973,8 @@ static int img_convert(int argc, char **argv)
is_allocated_sectors(buf1, n, &n1)) {
ret = bdrv_write(out_bs, sector_num, buf1, n1);
if (ret < 0) {
- error_report("error while writing");
+ error_report("error while writing sector %" PRId64
+ ": %s", sector_num, strerror(-ret));
goto out;
}
}