Red Hat Bugzilla – Bug 613893
[RFE] qemu-io enable truncate function for qcow2.
Last modified: 2013-01-09 17:51:22 EST
Description of problem: [qemu-io] truncate function can not work.If it's won't included this feature,the truncate strings need be removed form manual.It may confused user. Version-Release number of selected component (if applicable): How reproducible: always Steps to Reproduce: 1.qemu-img create -f qcow2 1G 1G Formatting '1G', fmt=qcow2 size=1073741824 encryption=off cluster_size=0 2.qemu-io 1G qemu-io> length 1 GiB truncate: Unknown error 18446744073709551521qemu-io> length 1 GiB qemu-io> help aio_flush -- completes all outstanding aio requets aio_read [-Cqv] [-P pattern ] off len [len..] -- asynchronously reads a number of bytes aio_write [-Cq] [-P pattern ] off len [len..] -- asynchronously writes a number of bytes alloc off [sectors] -- checks if a sector is present in the file close -- close the current open file flush -- flush all in-core file state to disk help [command] -- help for one or all commands info -- prints information about the current file length -- gets the length of the current file open [-Crsn] [path] -- open the file specified by path quit -- exit the program read [-abCpqv] [-P pattern [-s off] [-l len]] off len -- reads a number of bytes at a specified offset readv [-Cqv] [-P pattern ] off len [len..] -- reads a number of bytes at a specified offset truncate off -- truncates the current file at the given offset write [-abCpq] [-P pattern ] off len -- writes a number of bytes at a specified offset writev [-Cq] [-P pattern ] off len [len..] -- writes a number of bytes at a specified offset Use 'help commandname' for extended help. Actual results: [qemu-io] truncate function can not work. Expected results: [qemu-io] truncate function can work well. Additional info:
I think it does work for raw image files. The implementation in qcow2 is a new feature that has not been backported, indeed. We can either make it an RFE and move it to 6.1 or close it as NOTABUG. I'll leave it to you which one you prefer.
I check that truncate can work for raw images. Add RFE into summary.
Reproduce this bug with 113. #qemu-img create -f raw test.img 2G #qemu-io test.img qemu-io> truncate 2G truncate: Unknown error 18446744073709551521 Test this bug with qemu-kvm-0.12.1.2-2.128.el6.x86_64. This bug does not exist when truncate size bigger than initiate size. #qemu-img create -f qcow2 test.img 2G #qemu-io test.img qemu-io> truncate 3G qemu-io> length 3.000 GiB While this bug reproduce when truncate size smaller than initiate size. # qemu-img create -f qcow2 test.img 2G Formatting 'test.img', fmt=qcow2 size=2147483648 encryption=off cluster_size=0 # qemu-io test.img qemu-io> truncate 1G truncate: Unknown error 18446744073709551521 BTW this issue does not exist on raw format. So change status to assigned.
qcow2 only supports growing images, not shrinking. So this is the expected result (except that qemu-io doesn't get the right error message).
(In reply to comment #10) > qcow2 only supports growing images, not shrinking. So this is the expected > result (except that qemu-io doesn't get the right error message). Kevin, would you prefer fix this error message on this bug or prefer open a separate one?
(In reply to comment #10) > qcow2 only supports growing images, not shrinking. So this is the expected > result (except that qemu-io doesn't get the right error message). According to comment 9 and comment 10, this issue has already been fixed. And I will open another bug to track error message issue.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-0534.html