Merge "Delete type access list when deleting types"
This commit is contained in:
commit
a1a89ab9a3
@ -4290,10 +4290,22 @@ def share_type_destroy(context, id):
|
||||
'gtypes': share_group_types_count}
|
||||
LOG.error(msg, msg_args)
|
||||
raise exception.ShareTypeInUse(share_type_id=id)
|
||||
(model_query(context, models.ShareTypeExtraSpecs, session=session).
|
||||
filter_by(share_type_id=id).soft_delete())
|
||||
(model_query(context, models.ShareTypes, session=session).
|
||||
filter_by(id=id).soft_delete())
|
||||
|
||||
model_query(
|
||||
context, models.ShareTypeExtraSpecs, session=session
|
||||
).filter_by(
|
||||
share_type_id=id
|
||||
).soft_delete()
|
||||
model_query(
|
||||
context, models.ShareTypeProjects, session=session
|
||||
).filter_by(
|
||||
share_type_id=id,
|
||||
).soft_delete()
|
||||
model_query(
|
||||
context, models.ShareTypes, session=session
|
||||
).filter_by(
|
||||
id=id
|
||||
).soft_delete()
|
||||
|
||||
# Destroy any quotas, usages and reservations for the share type:
|
||||
quota_destroy_all_by_share_type(context, id)
|
||||
@ -5182,6 +5194,11 @@ def share_group_type_destroy(context, type_id):
|
||||
).filter_by(
|
||||
share_group_type_id=type_id,
|
||||
).soft_delete()
|
||||
model_query(
|
||||
context, models.ShareGroupTypeProjects, session=session
|
||||
).filter_by(
|
||||
share_group_type_id=type_id,
|
||||
).soft_delete()
|
||||
model_query(
|
||||
context, models.ShareGroupTypes, session=session
|
||||
).filter_by(
|
||||
|
@ -1266,6 +1266,12 @@ class ShareGroupTypeAPITestCase(test.TestCase):
|
||||
name='orange', is_public=False, share_types=[share_type_1['id']],
|
||||
group_specs={'dabo': 'allin', 'cadence': 'count'},
|
||||
override_defaults=True)
|
||||
db_api.share_group_type_access_add(self.ctxt,
|
||||
share_group_type_1['id'],
|
||||
"2018ndaetfigovnsaslcahfavmrpions")
|
||||
db_api.share_group_type_access_add(self.ctxt,
|
||||
share_group_type_1['id'],
|
||||
"2016ndaetfigovnsaslcahfavmrpions")
|
||||
share_group_type_2 = db_utils.create_share_group_type(
|
||||
name='regalia', share_types=[share_type_2['id']])
|
||||
if used_by_groups:
|
||||
@ -1291,6 +1297,9 @@ class ShareGroupTypeAPITestCase(test.TestCase):
|
||||
self.assertDictMatch(
|
||||
{}, db_api.share_group_type_specs_get(
|
||||
self.ctxt, share_group_type_1['id']))
|
||||
self.assertRaises(exception.ShareGroupTypeNotFound,
|
||||
db_api.share_group_type_access_get_all,
|
||||
self.ctxt, share_group_type_1['id'])
|
||||
self.assertRaises(exception.ShareGroupTypeNotFound,
|
||||
db_api.share_group_type_get,
|
||||
self.ctxt, share_group_type_1['id'])
|
||||
@ -3447,8 +3456,16 @@ class ShareTypeAPITestCase(test.TestCase):
|
||||
def test_share_type_destroy_in_use(self, used_by_shares,
|
||||
used_by_group_types):
|
||||
share_type_1 = db_utils.create_share_type(
|
||||
name='orange', extra_specs={'somekey': 'someval'})
|
||||
share_type_2 = db_utils.create_share_type(name='regalia')
|
||||
name='orange', extra_specs={'somekey': 'someval'},
|
||||
is_public=False, override_defaults=True)
|
||||
share_type_2 = db_utils.create_share_type(
|
||||
name='regalia', override_defaults=True)
|
||||
db_api.share_type_access_add(self.ctxt,
|
||||
share_type_1['id'],
|
||||
"2018ndaetfigovnsaslcahfavmrpions")
|
||||
db_api.share_type_access_add(self.ctxt,
|
||||
share_type_1['id'],
|
||||
"2016ndaetfigovnsaslcahfavmrpions")
|
||||
if used_by_shares:
|
||||
share_1 = db_utils.create_share(share_type_id=share_type_1['id'])
|
||||
db_utils.create_share(share_type_id=share_type_2['id'])
|
||||
@ -3481,6 +3498,9 @@ class ShareTypeAPITestCase(test.TestCase):
|
||||
self.assertDictMatch(
|
||||
{}, db_api.share_type_extra_specs_get(
|
||||
self.ctxt, share_type_1['id']))
|
||||
self.assertRaises(exception.ShareTypeNotFound,
|
||||
db_api.share_type_access_get_all,
|
||||
self.ctxt, share_type_1['id'])
|
||||
self.assertRaises(exception.ShareTypeNotFound,
|
||||
db_api.share_type_get,
|
||||
self.ctxt, share_type_1['id'])
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixed the cleanup for private share types and share group types to include
|
||||
clearing out the database entries recording project specific access
|
||||
rules to these types. See
|
||||
`Launchpad bug 1870751 <https://launchpad.net/bugs/1870751>`_ for more
|
||||
details.
|
Loading…
Reference in New Issue
Block a user