Bug 1373545 - Support of discard/fstrim
Summary: Support of discard/fstrim
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Ademar Reis
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1203710
TreeView+ depends on / blocked
 
Reported: 2016-09-06 14:46 UTC by Pablo Iranzo Gómez
Modified: 2019-12-16 06:38 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-30 14:16:01 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2604811 0 None None None 2016-09-06 14:48:21 UTC

Description Pablo Iranzo Gómez 2016-09-06 14:46:21 UTC
Description of problem:

While trying to create images for usage with 'packer' for a cloud environment, it has been found  tha the RHEL-base included KVM packages doesn't include the machine types that support discard/fstrim.

Updated machine types, like it was done on BZ 1229666 could help here.

Comment 3 Ademar Reis 2016-09-30 14:16:01 UTC
The discussion about machine types is a red herring.

Clarifying:

 - Discard/TRIM support was enabled by default in QEMU-1.5 upstream
 - Downstream, we ship QEMU-1.5.3 with RHEL-7.2
 - Which means yes, Discard/TRIM should work. The test-case verification is
   supposed to be simple: in the host, create the qcow2 (or even raw) image
   on a filesystem that supports sparse files (ext4 and xfs should both work);
   start a guest with this image and mount the fs with discard=on, then
   delete some files; the image size (space ocupied in the host fs) should
   decrease.

If this is not working, then we have a Bug somewhere. I haven't confirmed this personally because I don't have the setup ready.

Machine types enable the DISCARD feature, but this detail is only relevant if the VM is using an old machine-type (from RHEL6, for example, the VM was migrated from there or is reusing some old configuration).

Please *always* inform the qemu command line (from ps -auxw or from the libvirt logs) so we can understand what's being used.

Comment 4 Kevin Wolf 2016-09-30 15:01:57 UTC
(In reply to Ademar Reis from comment #3)
>  - Which means yes, Discard/TRIM should work. The test-case verification is
>    supposed to be simple: in the host, create the qcow2 (or even raw) image
>    on a filesystem that supports sparse files (ext4 and xfs should both
> work);
>    start a guest with this image and mount the fs with discard=on, then
>    delete some files; the image size (space ocupied in the host fs) should
>    decrease.

Please also make sure that discard='unmap' is set for the disk in the libvirt
XML so that the feature is actually enabled and discards don't get ignored.


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