
On Thu, Oct 15, 2015 at 10:28:39AM +0200, Wido den Hollander wrote:
When a RBD volume has snapshots it can not be removed.
This patch introduces a new flag to force volume removal, VIR_STORAGE_VOL_DELETE_FORCED.
With this flag any existing snapshots will be removed prior to removing the volume.
No existing mechanism in libvirt allowed us to pass such information, so that's why a new flag was introduced.
Signed-off-by: Wido den Hollander <wido@widodh.nl> --- include/libvirt/libvirt-storage.h | 1 + src/storage/storage_backend_rbd.c | 58 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+)
diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h index 453089e..36ff979 100644 --- a/include/libvirt/libvirt-storage.h +++ b/include/libvirt/libvirt-storage.h @@ -115,6 +115,7 @@ typedef enum { typedef enum { VIR_STORAGE_VOL_DELETE_NORMAL = 0, /* Delete metadata only (fast) */ VIR_STORAGE_VOL_DELETE_ZEROED = 1 << 0, /* Clear all data to zeros (slow) */ + VIR_STORAGE_VOL_DELETE_FORCED = 2, /* Force removal of volume, even if in use */
Long term I could imagine there will be a number of reasons why it might be forbidden to delete a volume by default. It would be nice to selectively override these reasons. FORCED is quite a generic name for a specific action. So how about naming it VOL_DELETE_WITH_SNAPSHOTS 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 :|