Bug 1281710 - It's better support to delete snapshots for rbd volume
It's better support to delete snapshots for rbd volume
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
x86_64 Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: John Ferlan
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2015-11-13 03:35 EST by yangyang
Modified: 2017-06-06 02:45 EDT (History)
4 users (show)

See Also:
Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-11-03 14:30:43 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description yangyang 2015-11-13 03:35:58 EST
Description of problem:
Snapshot is supported for rbd image, but currently libvirt has
not concept of snapshot. Once snapshot is created outside libvirt
, libvirt can not delete this image any more. It's better to support
to delete snapshots for rbd volume at least.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Create a rbd image
#rbd create rbd/rbd1.img --size 5120

2. Create a snapshot for the image
#rbd snap create rbd/rbd1.img@sn1

# rbd snap ls rbd/rbd1.img
     2 sn1  5070 MB

3. Create a rbd pool
# cat rbd-pool.xml 
<pool type='rbd'>
    <host name='10.66.x.x' port='6789'/>
    <host name='10.66.x.x' port='6789'/>

# virsh pool-define rbd-pool.xml 
Pool rbd defined from rbd-pool.xml

# virsh pool-start rbd
Pool rbd started

# virsh vol-list rbd
 Name                 Path                                    
 rbd1.img             rbd/rbd1.img                            
 yy2.img              rbd/yy2.img                             
 yy3.img              rbd/yy3.img  

4. delete volume - rbd1.img
# virsh vol-delete rbd1.img rbd
error: Failed to delete vol rbd1.img
error: failed to remove volume 'rbd/rbd1.img': Directory not empty

Actual results:
Libvirt cannot delete rbd snapshot

Expected results:
It's better to support to delete snapshots for rbd volume

Additional info:
Comment 2 Jaroslav Suchanek 2015-11-27 06:41:44 EST
Might be already supported in API by?

commit 3c7590e0a435d833895fc7b5be489e53e223ad95
Author: Wido den Hollander <wido@widodh.nl>
Date:   Tue Oct 27 15:16:34 2015 +0100

    rbd: Remove snapshots if the DELETE_WITH_SNAPSHOTS flag has been provided
    When a RBD volume has snapshots it can not be removed.
    This patch introduces a new flag to force volume removal,
    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>
Comment 3 John Ferlan 2015-12-02 16:33:24 EST
Turns out the above commit was a "start", but not nearly complete enough for a general solution. It's one of those "hidden" options that one could pass a flag via the API, but it's not documented.

I'll use this bz to work through those issues.
Comment 4 John Ferlan 2015-12-02 18:20:46 EST
Posted some patches upstream:


In particular the third patch is the meat and potatoes of the patch

Comment 5 John Ferlan 2015-12-18 10:55:25 EST
Patches have been pushed:

$ git describe 2eba5c5635a041a0a3a736e917fa1495c97c132b
Comment 9 errata-xmlrpc 2016-11-03 14:30:43 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.