From 3786219ce8cc34342c4dc8ffbc25ac57b883efcf Mon Sep 17 00:00:00 2001 From: Aseel Awwad Date: Tue, 19 Dec 2017 08:22:02 -0500 Subject: [PATCH] Create group from snapshot-group failure leaves behind the volume While creating a group from snapshot group or source group, if the quota exceeds during volume creation, the volume which are scheduled for creation are left behind in the DB.Only Group gets destroyed from the DB. To solve this, If error happens, taskflow will handle rollback of quota and removal of volume entry in the db. Change-Id: I5d60680fa92e50e51c9b3a6bcc940b18bef5b150 Closes-Bug: #1727314 --- cinder/group/api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cinder/group/api.py b/cinder/group/api.py index f034f3c1b23..3815d8cf58f 100644 --- a/cinder/group/api.py +++ b/cinder/group/api.py @@ -315,6 +315,10 @@ class API(base.Base): except Exception: with excutils.save_and_reraise_exception(): try: + volumes = objects.VolumeList.get_all_by_generic_group( + context, group.id) + for vol in volumes: + vol.destroy() group.destroy() finally: LOG.error("Error occurred when creating group " @@ -392,6 +396,10 @@ class API(base.Base): except Exception: with excutils.save_and_reraise_exception(): try: + volumes = objects.VolumeList.get_all_by_generic_group( + context, group.id) + for vol in volumes: + vol.destroy() group.destroy() finally: LOG.error("Error occurred when creating "