提交 79443397 编写于 作者: L liguang 提交者: Stefan Hajnoczi

qemu-img: report size overflow error message

qemu-img will complain when qcow or qcow2
size overflow for 64 bits, report the right
message in this condition.

$./qemu-img create -f qcow2 /tmp/foo 0x10000000000000000
before change:
qemu-img: Invalid image size specified! You may use k, M, G or T suffixes for
qemu-img: kilobytes, megabytes, gigabytes and terabytes.

after change:
qemu-img: Image size must be less than 8 EiB!

[Resolved conflict with a9300911 goto removal -- Stefan]
Signed-off-by: Nliguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 37edbf7e
......@@ -348,9 +348,13 @@ static int img_create(int argc, char **argv)
char *end;
sval = strtosz_suffix(argv[optind++], &end, STRTOSZ_DEFSUFFIX_B);
if (sval < 0 || *end) {
error_report("Invalid image size specified! You may use k, M, G or "
"T suffixes for ");
if (sval == -ERANGE) {
error_report("Image size must be less than 8 EiB!");
} else {
error_report("Invalid image size specified! You may use k, M, "
"G or T suffixes for ");
error_report("kilobytes, megabytes, gigabytes and terabytes.");
}
return 1;
}
img_size = (uint64_t)sval;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册