qcow2: Add error messages in qcow2_truncate
PATCH 1/1 qcow2: Add error messages in qcow2_truncate
qemu-img resize has some limitations with qcow2, but the user is only told that "this image format does not support resize". Quite confusing, so add some more detailed error_report() calls and change "this image format" into "this image".
Signed-off-by Kevin Wolf <[email protected]>
--- block/qcow2.c | 3 +++ qemu-img.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-)
block/qcow2.c +3 -0
@@ -1120,16 +1120,19 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset)int ret, new_l1_size;if (offset &511 ) { +error_report ("The new size must be a multiple of 512" );return -EINVAL ; }/* cannot proceed if image has snapshots */ if (s->nb_snapshots) { +error_report ("Can't resize an image which has snapshots" );return -ENOTSUP ; }/* shrinking is currently not supported */ if (offset < bs->total_sectors *512 ) { +error_report ("qcow2 doesn't support shrinking images yet" );return -ENOTSUP ; }
qemu-img.c +1 -1
@@ -1614,7 +1614,7 @@ static int img_resize(int argc, char **argv)printf ("Image resized.\n" );break ;case -ENOTSUP : -error_report ("This image format does not support resize" ); +error_report ("This image does not support resize" );break ;case -EACCES :error_report ("Image is read-only" );
Signature · 1 line
1.7.6.5
Quoted 10 lines · Kevin Wolf
qemu-img resize has some limitations with qcow2, but the user is only told that "this image format does not support resize". Quite confusing, so add some more detailed
error_report()calls and change "this image format" into "this image".Signed-off-by Kevin Wolf <[email protected]>---
block/qcow2.c | 3 +++
qemu-img.c | 2 +-2 files changed, 4 insertions(+), 1 deletions(-)
Reviewed-by Stefan Hajnoczi <[email protected]>