diff --git a/daemon-common/ceph.py b/daemon-common/ceph.py index 3609fa54..ab7e8db6 100644 --- a/daemon-common/ceph.py +++ b/daemon-common/ceph.py @@ -828,10 +828,22 @@ def remove_volume(zkhandler, pool, name): name, pool ) - # 1. Remove volume snapshots + # 1a. Remove PVC-managed volume snapshots for snapshot in zkhandler.children(("snapshot", f"{pool}/{name}")): remove_snapshot(zkhandler, pool, name, snapshot) + # 1b. Purge any remaining volume snapshots + retcode, stdout, stderr = common.run_os_command( + "rbd snap purge {}/{}".format(pool, name) + ) + if retcode: + return ( + False, + 'ERROR: Failed to purge snapshots from RBD volume "{}" in pool "{}": {}'.format( + name, pool, stderr + ), + ) + # 2. Remove the volume retcode, stdout, stderr = common.run_os_command("rbd rm {}/{}".format(pool, name)) if retcode: