Hide Forgot
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 2.6.32-424.el6.x86_64 qemu-kvm-rhev-0.12.1.2-2.414.el6.x86_64 How reproducible: 100% 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-10.66.90.100\: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-10.66.90.100: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: Invalid parameter 'discard' 3. 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=discard 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:
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.