xapi-project / xapi-storage

Experimental new storage interface for xapi
https://xapi-project.github.io/xapi-storage/
9 stars 19 forks source link

Enhancement: Support automatic VDI compaction based on Guest TRIM/UNMAP/Discard commands #104

Closed ghost closed 4 years ago

ghost commented 4 years ago

Background

A common issue with thin proivisioned (a.k.a. dynamic) virtual disk files is that they grow beyond the size of the actual Guest data. This is because when a guest is deleting data from the filesystem, the files are only unlinked. Therefore the old data remains in the VDI.

With the new SSD drives OS'es now have the possibility to actually tell the storage layer what blocks are no longer in use through the ATA TRIM or the SCSI UNMAP command sets.

Automatic compaction of VDI files

Using the TRIM support in the guest OS it should be possible to automatically compact the VDI files used in Xen, by intercepting the TRIM or UNMAP commands.

Of course the huge advantage is to be able to keep thin provisioned VDI storage thin with a low-resource automatic compaction. Today we have to fill a disk with zeroes and then either turn the VHD files sparse or use some VHD magic to compact disks. Very time consuming and not user or admin friendly.

Looking at the schematics at https://xapi-project.github.io/xapi-storage/#learn-architecture it may be possible to do this with a volume plugin. Possibly the Xapi needs to be expanded to forward the TRIM request to the plugin.

MarkSymsCtx commented 4 years ago

This project defines the control plane API to the storage layer from the toolstack. There is no implementation of any of the APIs within this project. Implementations of the API may use whatever method they like to handle the storage, indeed some already use qcow2 and will where supported by the underlying storage see that the guest initiated TRIM operations result in space reclamation.

ghost commented 4 years ago

OK. I was misinformed. Could you perhaps refer me to the right project for a request like this?

MarkSymsCtx commented 4 years ago

There isn't one, there are no public, open source, implementations of the storage APIs. The implementations of the API undertaken by Citrix are proprietary.