[nova]is there support for discard/trim in virtio-blk?
Kashyap Chamarthy
kchamart at redhat.com
Fri Sep 3 08:32:55 UTC 2021
On Fri, Sep 03, 2021 at 08:15:51AM +0000, Sven Kieske wrote:
[...]
> Thanks for all the feedback and pointers! FWIW we were already aware
> of the discard=unmap option in libvirt, I should have mentioned that.
>
> In the meantime I found this bugreport:
> https://bugzilla.redhat.com/show_bug.cgi?id=1672682
>
> which seems to indicate that this indeed works in libvirt for
> virtio-blk.
>
> So I will continue to figure out why this doesn't work as intended in
> our setup.
Yes, 'discard' support for 'virtio-blk' was added to Linux and QEMU in
the following versions:
- Linux: v5.0 onwards
- QEMU: v4.0.0
So make sure you have those versions at a minimum. And as you've
discovered in the above Red Hat bugzilla, libvirt already has the config
option to enable 'discard'; and Nova has the config option too.
* * *
Some notes on 'discard' (also called as 'trim') that I learnt from my
colleague Dan Berrangé:
- To genuinely save storage space, you need to enable 'trim' at every
single layer of the I/O stack -- guest, host, and storage server(s).
- Even if the host storage doesn't support 'discard', it might still
be useful to enable it for the guests -- it'll keep your qcow2 file
size down by releasing unused clusters, so if you need to copy the
qcow2 file to another host there will be less data needing copying.
- If you're "thick-provisoning" your guests so that they will never
trigger ENOSPC, then you don't want to enable 'discard'.
[...]
--
/kashyap
More information about the openstack-discuss
mailing list