
On Wed, Jan 27, 2016 at 11:20:07AM +0100, Wido den Hollander wrote:
This new algorithm adds support for wiping volumes using TRIM.
It does not overwrite all the data in a volume, but it tells the backing storage pool/driver that all bytes in a volume can be discarded.
It depends on the backing storage pool how this is handled.
A SCSI backend might send UNMAP commands to remove all data present on a LUN.
A Ceph backend might use rbd_discard() to instruct the Ceph cluster that all data on that RBD volume can be discarded.
Signed-off-by: Wido den Hollander <wido@widodh.nl> --- include/libvirt/libvirt-storage.h | 3 +++ src/storage/storage_backend.c | 4 ++++ tools/virsh-volume.c | 2 +- tools/virsh.pod | 1 + 4 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h index 2c55c93..232b4d3 100644 --- a/include/libvirt/libvirt-storage.h +++ b/include/libvirt/libvirt-storage.h @@ -153,6 +153,9 @@ typedef enum {
VIR_STORAGE_VOL_WIPE_ALG_RANDOM = 8, /* 1-pass random */
+ VIR_STORAGE_VOL_WIPE_ALG_TRIM = 9, /* 1-pass, trim all data on the + volume by using TRIM or DISCARD */ +
Do we need a separate flag for that? VIR_STORAGE_VOL_WIPE_ALG_ZERO already has a similar behavior for sparse files, where we truncate the file size to 0, then back to the original size. We could treat it as 'rbd_discard' in the rbd driver, with a fallback to writing zeroes if that's not supported. Jan