[fedora-virt] device='disk' and DISCARD

Kevin Wolf kwolf at redhat.com
Tue Aug 27 07:34:27 UTC 2013


Am 24.08.2013 um 23:00 hat Ian Pilcher geschrieben:
> I just noticed the new "Virtio SCSI disk" and "Virtio SCSI lun" storage
> types in virt-manager (and their libvirt XML device=... equivalents).
> 
> Reading up on them, I see that "generic" SCSI commands are only accepted
> when device='lun', but this only works when the source is an "actual raw
> device" -- not an LVM LV or partition.
> 
> Does this mean that DISCARD commands are rejected when device='disk'?
> 
> I've been using SSD-backed LVs as virtio-scsi disks, with the idea that
> this would cause DISCARD commands to be passed through from the guests.
> It would be a real bummer if there were no way to do this.

Not completely sure how everything is called in libvirt language, but
from a qemu perspective:

If you don't use SCSI passthrough, which only works with a raw SCSI
device, you get qemu's SCSI emulation, which then uses normal
read/write/etc. syscalls to implement the SCSI commands. qemu's block
layer does support a discard operation, which is invoked by the SCSI
emulation. You need to specify -drive discard=unmap if you want qemu to
process discard requests (not sure what the libvirt option for it is).

The effect of it depends on the backend used for the image. In your
case, the interesting point is that for host devices, the BLKDISCARD
ioctl is issued since qemu 1.4.

Hope this helps.

Kevin


More information about the virt mailing list