RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2041440 - Enable discard=unmap by default
Summary: Enable discard=unmap by default
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: virt-manager
Version: 9.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: rc
: ---
Assignee: Jonathon Jongsma
QA Contact: Hongzhou Liu
URL:
Whiteboard:
Depends On: 2100525
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-17 11:09 UTC by Martin Pitt
Modified: 2022-11-17 09:50 UTC (History)
8 users (show)

Fixed In Version: virt-manager-4.0.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-17 09:50:35 UTC
Type: Enhancement
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-108309 0 None None None 2022-01-17 11:10:53 UTC

Description Martin Pitt 2022-01-17 11:09:50 UTC
The libvirt disks documentation [1] mentions the "discard". This seems to be a "unbreak my setup" option at first sight? fstrim on the host and LVM etc. was enabled by default years ago in Fedora [2] and [Debian/Ubuntu [3]. Is there reason at all to not just make this the default?

That would simplify the virt-manager GUI, would do the right thing for virt-install, and not require users to think about such internal implementation details in cockpit-machines and similar UIs.

Thanks for considering!

[1] https://libvirt.org/formatdomain.html#hard-drives-floppy-disks-cdroms
[2] https://fedoraproject.org/wiki/Changes/EnableFSTrimTimer
[3] https://blueprints.launchpad.net/ubuntu/+spec/core-1311-ssd-trimming

Comment 2 Cole Robinson 2022-08-21 20:02:27 UTC
This is in virt-manager 4.0.0:

commit 381aa4050c1ca4d3320fdabb579a128b5855d022
Author: Cole Robinson <crobinso>
Date:   Thu Feb 3 13:30:50 2022 -0500

    devices: disk: Set discard=unmap by default for some cases
    
    This recommendation came from an internal discussion. The cases are
    
    * For block storage. This means guest requests are passed through
      to the host device, which seems a more reasonable default than
      ignoring them
    
    * For sparse disk images we will create. discard=unmap helps preserve
      the sparseness of the disk image. If a user requests non-sparse, they
      are likely more concerned with performance than saving disk space,
      so we leave the default as is. We limit this to disk images we will
      create, since that's the easiest case to check, and it's less clear
      if we should change the behavior here for an arbitrary existing
      disk image.

Comment 3 John Ferlan 2022-08-22 10:49:08 UTC
Changing to ON_QA and adding TestOnly keyword - sorry this has been discovered late. I know this avoids the errata process for the bug, but can we just validate this please?

Comment 4 Hongzhou Liu 2022-08-23 05:14:34 UTC
Verify this feature on RHEL9.1

packages:

virt-manager-4.0.0-1.el9.noarch
virt-install-4.0.0-1.el9.noarch
kernel-5.14.0-138.el9.x86_64


Step1: Run virt-install with nothing set for discard.
# virt-install --name vm1 --memory 4096 --location http://download.eng.pek2.redhat.com/rhel-9/composes/RHEL-9/RHEL-9.2.0-20220822.2/compose/BaseOS/x86_64/os/ --disk /home/vm1.img,size=20

Step2: the vm can be installed successfully, check the xml related 
...
<devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' discard='unmap'/>
      <source file='/home/vm1.img' index='1'/>
...

Result: The value for discard will be set by default 'unmap'
 

Based on this result, I change the status to verified, Thanks

Comment 5 Thomas Huth 2022-11-17 09:50:35 UTC
RHEL 9.1 has been released, so I think we can close this now.


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