qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 2/6] qemu_img: add cvtnum_full to print error reports


From: Eric Blake
Subject: Re: [PULL 2/6] qemu_img: add cvtnum_full to print error reports
Date: Wed, 20 May 2020 16:39:32 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 5/18/20 11:32 AM, Eric Blake wrote:
From: Eyal Moscovici <address@hidden>

All calls to cvtnum check the return value and print the same error
message more or less. And so error reporting moved to cvtnum_full to
reduce code duplication and provide a single error
message. Additionally, cvtnum now wraps cvtnum_full with the existing
default range of 0 to MAX_INT64.

Acked-by: Mark Kanda <address@hidden>
Signed-off-by: Eyal Moscovici <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
[eblake: fix printf formatting, avoid trailing space, change error wording,
reformat commit message]
Signed-off-by: Eric Blake <address@hidden>
---

@@ -572,16 +584,8 @@ static int img_create(int argc, char **argv)
      if (optind < argc) {
          int64_t sval;

-        sval = cvtnum(argv[optind++]);
+        sval = cvtnum("image size", argv[optind++]);
          if (sval < 0) {
-            if (sval == -ERANGE) {
-                error_report("Image size must be less than 8 EiB!");

This change broke iotest 178:

--- /home/eblake/qemu/tests/qemu-iotests/178.out.qcow2 2020-05-20 16:33:20.065710365 -0500 +++ /home/eblake/qemu/build/tests/qemu-iotests/178.out.bad 2020-05-20 16:35:28.924512423 -0500
@@ -13,7 +13,7 @@
 qemu-img: Invalid parameter 'snapshot.foo'
 qemu-img: Failed in parsing snapshot param 'snapshot.foo'
 qemu-img: --output must be used with human or json as argument.
-qemu-img: Image size must be less than 8 EiB!
+qemu-img: Invalid image size specified. Must be between 0 and 9223372036854775807.
 qemu-img: Unknown file format 'foo'

 == Size calculation for a new file (human) ==

I'll post a followup patch shortly.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]