Merge "Delete capsule volumes properly"

This commit is contained in:
Zuul 2019-03-26 09:18:31 +00:00 committed by Gerrit Code Review
commit b8a7d3fc3c
1 changed files with 10 additions and 0 deletions

View File

@ -396,7 +396,17 @@ class Manager(periodic_task.PeriodicTasks):
volmap.cinder_volume_id)
volmap.destroy()
def _detach_volumes_for_capsule(self, context, capsule, reraise):
for c in (capsule.init_containers or []):
self._detach_volumes(context, c, reraise)
for c in (capsule.containers or []):
self._detach_volumes(context, c, reraise)
def _detach_volumes(self, context, container, reraise=True):
if isinstance(container, objects.Capsule):
self._detach_volumes_for_capsule(context, container, reraise)
return
volmaps = objects.VolumeMapping.list_by_container(context,
container.uuid)
for volmap in volmaps: