mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
qemu_img: add cvtnum_full to print error reports
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 <mark.kanda@oracle.com> Signed-off-by: Eyal Moscovici <eyal.moscovici@oracle.com> Message-Id: <20200513133629.18508-2-eyal.moscovici@oracle.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: fix printf formatting, avoid trailing space, change error wording, reformat commit message] Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
0eaf453ebf
commit
43d589b074
2 changed files with 37 additions and 45 deletions
|
@ -92,19 +92,19 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1649267441664 cluster_size=65536 l
|
|||
== 3. Invalid sizes ==
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- -1024
|
||||
qemu-img: Image size must be less than 8 EiB!
|
||||
qemu-img: Invalid image size specified. Must be between 0 and 9223372036854775807.
|
||||
|
||||
qemu-img create -f qcow2 -o size=-1024 TEST_DIR/t.qcow2
|
||||
qemu-img: TEST_DIR/t.qcow2: Value '-1024' is out of range for parameter 'size'
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- -1k
|
||||
qemu-img: Image size must be less than 8 EiB!
|
||||
qemu-img: Invalid image size specified. Must be between 0 and 9223372036854775807.
|
||||
|
||||
qemu-img create -f qcow2 -o size=-1k TEST_DIR/t.qcow2
|
||||
qemu-img: TEST_DIR/t.qcow2: Value '-1k' is out of range for parameter 'size'
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- 1kilobyte
|
||||
qemu-img: Invalid image size specified! You may use k, M, G, T, P or E suffixes for
|
||||
qemu-img: Invalid image size specified. You may use k, M, G, T, P or E suffixes for
|
||||
qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
|
||||
|
||||
qemu-img create -f qcow2 -o size=1kilobyte TEST_DIR/t.qcow2
|
||||
|
@ -113,7 +113,7 @@ Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
|
|||
and exabytes, respectively.
|
||||
|
||||
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- foobar
|
||||
qemu-img: Invalid image size specified! You may use k, M, G, T, P or E suffixes for
|
||||
qemu-img: Invalid image size specified. You may use k, M, G, T, P or E suffixes for
|
||||
qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
|
||||
|
||||
qemu-img create -f qcow2 -o size=foobar TEST_DIR/t.qcow2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue