[libvirt] [PATCH] rbd: Remove snapshots if the FORCED flag has been provided

Wido den Hollander wido at widodh.nl
Thu Oct 15 08:58:45 UTC 2015



On 15-10-15 10:44, Daniel P. Berrange wrote:
> 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 at 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
> 

Seems like a good thing to me. Want me to submit a new patch?

Before I do so, any code-wide objections?

Wido

> 
> Regards,
> Daniel
> 




More information about the libvir-list mailing list