Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 613893 - [RFE] qemu-io enable truncate function for qcow2.
[RFE] qemu-io enable truncate function for qcow2.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.1
All Linux
low Severity medium
: beta
: 6.1
Assigned To: Kevin Wolf
Virtualization Bugs
: FutureFeature
Depends On:
Blocks: 580953
  Show dependency treegraph
 
Reported: 2010-07-13 02:30 EDT by Quan Wenli
Modified: 2013-01-09 17:51 EST (History)
7 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.123.el6
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-05-19 07:34:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0534 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2011-05-19 07:20:36 EDT

  None (edit)
Description Quan Wenli 2010-07-13 02:30:31 EDT
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:
Comment 2 Kevin Wolf 2010-07-15 07:26:23 EDT
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.
Comment 3 Quan Wenli 2010-07-19 01:32:58 EDT
I check that truncate can work for raw images.
Add RFE into summary.
Comment 9 Shirley Zhou 2010-12-23 21:50:12 EST
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.
Comment 10 Kevin Wolf 2011-01-19 09:32:06 EST
qcow2 only supports growing images, not shrinking. So this is the expected result (except that qemu-io doesn't get the right error message).
Comment 11 Shirley Zhou 2011-01-19 21:30:23 EST
(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?
Comment 12 Shirley Zhou 2011-01-24 05:38:26 EST
(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.
Comment 14 errata-xmlrpc 2011-05-19 07:34:00 EDT
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
Comment 15 errata-xmlrpc 2011-05-19 08:46:19 EDT
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

Note You need to log in before you can comment on or make changes to this bug.