Bug 1152037

Summary: RFE: use virtio-scsi disk bus with discard='unmap' for guests that support it
Product: Red Hat Enterprise Linux 8 Reporter: David Jaša <djasa>
Component: gnome-boxesAssignee: Felipe Borges <feborges>
Status: CLOSED ERRATA QA Contact: Radek Duda <rduda>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.3CC: feborges, mclasen, rduda, tpelka, tpopela, vbenes
Target Milestone: rcKeywords: FutureFeature
Target Release: 8.3Flags: feborges: needinfo-
pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gnome-boxes-3.36.5-8.el8 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 14:38:08 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Jaša 2014-10-13 11:39:46 UTC
Description of problem:
gnome-boxes by default uses virtio-blk disks backed by qcow2 files stored in home directories. It would be nice to use virtio-scsi disks by default with "<driver ... discard='unmap'/>" option tuned on for guests that support virtio-scsi (IIRC RHEL >= 6.4, RHEL 7, Windows >= 7 with virtio drivers). That way, valuable space in user's home can be conserved:

## backing file usage on host
$ du -sm .local/share/gnome-boxes/images/rhel7.0 
8820	.local/share/gnome-boxes/images/rhel7.0
## run fstrim in the guest:
[root@rhel7 ~]# fstrim -v /
/: 2.4 GiB (2528993280 bytes) trimmed
## backing file usage after guest's fstrim
[djasa@cihla ~]$ du -sm .local/share/gnome-boxes/images/rhel7.0 
6768	.local/share/gnome-boxes/images/rhel7.0

Note that Windows 7 by default issue discards without user intervention, in RHEL (and IIRC Fedora as well), you either have to set up a cron job for fstrim or add "discards" to mount options


Version-Release number of selected component (if applicable):
gnome-boxes-3.8.3-9.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. install a guest that supports virtio-scsi
2. inspect domain xml for the VM
3.

Actual results:
virtio-blk is used

Expected results:
virtio-scsi with discard='unmap' is configured

Additional info:

Comment 1 Vladimir Benes 2015-05-06 11:45:06 UTC
still unfixed in 3.14, would it be possible to implement it or do we need to file it upstream first?

Comment 3 Zeeshan Ali 2020-04-14 09:53:57 UTC
I don't know and I'm not responsible any more (I hope) for Boxes so moving over to Felipe. :)

Comment 6 Felipe Borges 2020-11-02 14:57:16 UTC
Ever since QEMU 4.0, virtio-blk disks have gained discard support[0]. For this reason, we don't need to migrate to virtio-scsi to benefit from discard support.

I proposed changes to make Boxes pass discard=unmap for virtio-blk disks drivers. This should suffice to fix this bugzilla.

You can verify that this works by checking the presence of "<driver ... discard='unmap'/>" in the disk driver node.

[0] https://bugzilla.redhat.com/1672680

Comment 11 errata-xmlrpc 2021-05-18 14:38:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: GNOME security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:1586