Bug 1021858 - add "-drive ...,discard=on|off" for guest-fstrim supported with passthrough or emulated SCSI hard disk
add "-drive ...,discard=on|off" for guest-fstrim supported with passthrough o...
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Virtualization Maintenance
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2013-10-22 04:36 EDT by Sibiao Luo
Modified: 2013-10-24 19:15 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-10-24 19:15:11 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Sibiao Luo 2013-10-22 04:36:49 EDT
Description of problem:
As now rhel7 work with both discard=on and discard=off, but it will only have an actual effect with discard=on for passthrough and emulated SCSI hard disk. So we should also add "-drive ...,discard=on|off" for guest-fstrim supported with passthrough or emulated SCSI hard disk in rhel6.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev

How reproducible:

Steps to Reproduce:
1.check the discard=on|off in qmeu-kvm man help.
2.boot guest with '-drive ...,discard=on' specified.
e.g:...-drive file=/dev/disk/by-path/ip-\:3260-iscsi-iqn.2001-05.com.equallogic\:0-8a0906-0971f7d03-1dff49b26885073d-s2-sluo-172259-lun-0,if=none,id=drive-data-disk,format=raw,aio=native,discard=on -device virtio-scsi-pci,bus=pci.0,addr=0x7,id=scsi0 -device scsi-block,drive=drive-data-disk,id=data-disk,bus=scsi0.0
qemu-kvm: -drive file=/dev/disk/by-path/ip-,if=none,id=drive-data-disk,format=raw,aio=native,discard=on: Invalid parameter 'discard'

Actual results:
after step 1, there is no any discard=on|off info in qmeu-kvm man help.
after step 2, QEMU quit with message prompt: Invalid parameter 'discard'.

Expected results:
Add "-drive ...,discard=on|off" for guest-fstrim supported with passthrough or emulated SCSI hard disk in rhel6.
e.g.]# man qemu-kvm
               discard is one of "ignore" (or "off") or "unmap" (or "on") and controls whether discard (also known as
               trim or unmap) requests are ignored or passed to the filesystem.  Some machine types may not support
               discard requests.

Additional info:
Comment 1 Paolo Bonzini 2013-10-24 19:15:11 EDT
You cannot disable discard on passthrough; passthrough will always pass the commands to the underlying device.  The right way to disable discard for passthrough is to configure it on the storage.

It might be better if libvirt forbids configuration of passthrough if the disk type='lun'.  That would be a separate bug.

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