Bug 1226977

Summary: [RFE] Discard Unused blocks
Product: Red Hat Enterprise Virtualization Manager Reporter: Anand Nande <anande>
Component: RFEsAssignee: Scott Herold <sherold>
Status: CLOSED DUPLICATE QA Contact: Gil Klein <gklein>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.5.0CC: amureini, ecohen, lpeer, lsurette, rbalakri, sherold, yeylon, ylavi
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: storage
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-14 09:29:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Anand Nande 2015-06-01 15:11:09 UTC
Description of problem:

When data is deleted from inside virtual machine the underlying block devices in the RHEV Storage Domain do not know this and blocks are not actually freed. An Example (similar to) mechanism is currently found in: http://ceph.com/docs/master/rbd/qemu-rbd/, section "Enabling Discard/TRIM"

Qemu does support trim - but RHEV 3.5 doesn't seem to enable it:

host# virsh -r dumpxml VM_NAME | grep -B3 -A5 sda
    <disk type='block' device='disk' snapshot='no'>
      <driver name='qemu' type='qcow2' cache='none' error_policy='stop' io='native'/>
      <source dev='/rhev/data-center/00000002-0002-0002-0002-000000000237/1312236c-5b8d-4d60-8c84-7e92c19ec064/images/19b6d07c-becd-4cbe-8bf6-5b1bcd37de7a/3b8ddefb-68b1-4b1c-9fc6-47f2f040b07f'/>
      <target dev='sda' bus='scsi'/>
      <serial>19b6d07c-becd-4cbe-8bf6-5b1bcd37de7a</serial>
      <boot order='1'/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

In order to enable it, <driver> element should contain "discard='unmap'"
parameter. qemu in RHEL7 can free TRIMmed space taken by qcow2-file-backed
disks and even earlier version of qemu should be able to mark TRIMmed
space in qcow2 for further allocation.

Version-Release number of selected component (if applicable):
rhev-3.5