]> git.proxmox.com Git - qemu.git/commitdiff
qcow2: Add error messages in qcow2_truncate
authorKevin Wolf <kwolf@redhat.com>
Tue, 6 Mar 2012 11:44:45 +0000 (12:44 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 12 Mar 2012 14:14:06 +0000 (15:14 +0100)
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 <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
block/qcow2.c
qemu-img.c

index 6f53ec6b7da79ff9e0b85f0c234700d9b514e78a..7aece65406d018c5d2dcff99e822d38ee5f7e799 100644 (file)
@@ -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;
     }
 
index 8df35648e947805c1d8de6c2c32ba2c360e64a13..0e48b352969d93b4857b0cd0a35b72c2e3bfe4c3 100644 (file)
@@ -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");