[libvirt] [PATCH 1/2] rbd: Add wiping RBD volumes by using rbd_discard() or rbd_write()

Daniel P. Berrange berrange at redhat.com
Fri Jan 22 09:59:11 UTC 2016


On Thu, Jan 21, 2016 at 02:10:02PM -0500, John Ferlan wrote:
> 
> 
> On 12/23/2015 10:06 AM, Wido den Hollander wrote:
> > This allows user to use the volume wiping functionality of the libvirt
> > storage driver.
> > 
> > This patch also adds a new wiping algorithm VIR_STORAGE_VOL_WIPE_ALG_DISCARD
> > 
> > By default the VIR_STORAGE_VOL_WIPE_ALG_ZERO algorithm is used and with
> > RBD this will called rbd_write() in chunks of the underlying object size
> > to completely zero out the volume.
> > 
> > With VIR_STORAGE_VOL_WIPE_ALG_DISCARD it will call rbd_discard() in the
> > same object size chunks which will trim/discard all underlying RADOS objects
> > in the Ceph cluster.
> > 
> > Signed-off-by: Wido den Hollander <wido at widodh.nl>
> > ---
> >  include/libvirt/libvirt-storage.h |   4 +
> >  src/storage/storage_backend_rbd.c | 155 +++++++++++++++++++++++++++++++++++++-
> >  tools/virsh-volume.c              |   2 +-
> >  3 files changed, 159 insertions(+), 2 deletions(-)
> > 
> 
> Found these buried in my todo list of things to look at from during the
> holiday break. I figure by bumping it'll bring it back into focus...
> "Semantically" speaking - this patch is a v2 of the original patch series...
> 
> I'm still a bit conflicted whether to add a new option to Wipe or
> whether a new API should be developed. I see value in both options.
> Although perhaps thinking of this as "trim" and not "discard" could make
> it more palatable for wipe. As a new API, each backend driver could
> decide whether it supports the discard/trim option, but that's quite a
> bit more work (essentially mimic the Wipe functionality, but generate Trim).

I think I can certainly see a dedicated API for trim in the future,
as there's use cases for trim beyond full-disk wiping. eg to spars-ify
a disk image.

I think its still ok to add trim to the existing Wipe API though, as
a specific targetted use case.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list