Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/dashboard:delete image fail on dashboard while it has some protected snapshots #52901

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/pybind/mgr/dashboard/services/rbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import errno
import json
import math
import time
from enum import IntEnum

import cherrypy
Expand Down Expand Up @@ -630,9 +631,16 @@ def delete(cls, image_spec):

image = RbdService.get_image(image_spec)
snapshots = image['snapshots']
for snap in snapshots:
RbdSnapshotService.remove_snapshot(image_spec, snap['name'], snap['is_protected'])

if len(snapshots) > 0:
count = 0
for snap in snapshots:
RbdSnapshotService.remove_snapshot(image_spec, snap['name'], snap['is_protected'])
while True:
image = RbdService.get_image(image_spec)
if len(image['snapshots']) < 1 or count > 30:
break
time.sleep(1)
count += 1
rbd_inst = rbd.RBD()
return rbd_call(pool_name, namespace, rbd_inst.remove, image_name)

Expand Down