Remove old flavor_access_remove db api method
We haven't used this since the flavor migration compat code was removed: I4107af592448e20fe929f8fa3112929e3685b581 Change-Id: If0433c7a6d988165d854e965f3b7d498af3f952d
This commit is contained in:
parent
cf6a2688b9
commit
39e54d5d44
|
@ -1563,11 +1563,6 @@ def flavor_access_add(context, flavor_id, project_id):
|
|||
"""Add flavor access for project."""
|
||||
return IMPL.flavor_access_add(context, flavor_id, project_id)
|
||||
|
||||
|
||||
def flavor_access_remove(context, flavor_id, project_id):
|
||||
"""Remove flavor access for project."""
|
||||
return IMPL.flavor_access_remove(context, flavor_id, project_id)
|
||||
|
||||
####################
|
||||
|
||||
|
||||
|
|
|
@ -4820,20 +4820,6 @@ def flavor_access_add(context, flavor_id, project_id):
|
|||
return access_ref
|
||||
|
||||
|
||||
@pick_context_manager_writer
|
||||
def flavor_access_remove(context, flavor_id, project_id):
|
||||
"""Remove given tenant from the flavor access list."""
|
||||
instance_type_id = _flavor_get_id_from_flavor(context, flavor_id)
|
||||
|
||||
count = _flavor_access_query(context).\
|
||||
filter_by(instance_type_id=instance_type_id).\
|
||||
filter_by(project_id=project_id).\
|
||||
soft_delete(synchronize_session=False)
|
||||
if count == 0:
|
||||
raise exception.FlavorAccessNotFound(flavor_id=flavor_id,
|
||||
project_id=project_id)
|
||||
|
||||
|
||||
####################
|
||||
|
||||
|
||||
|
|
|
@ -4795,37 +4795,6 @@ class InstanceTypeAccessTestCase(BaseInstanceTypeTestCase):
|
|||
self.assertRaises(exception.FlavorAccessExists,
|
||||
self._create_flavor_access, *params)
|
||||
|
||||
def test_flavor_access_remove(self):
|
||||
flavors = ({'name': 'n1', 'flavorid': 'f1'},
|
||||
{'name': 'n2', 'flavorid': 'f2'})
|
||||
it1, it2 = tuple((self._create_flavor(v) for v in flavors))
|
||||
|
||||
access_it1 = [self._create_flavor_access(it1['flavorid'], 'pr1'),
|
||||
self._create_flavor_access(it1['flavorid'], 'pr2')]
|
||||
|
||||
access_it2 = [self._create_flavor_access(it2['flavorid'], 'pr1')]
|
||||
|
||||
db.flavor_access_remove(self.ctxt, it1['flavorid'],
|
||||
access_it1[1]['project_id'])
|
||||
|
||||
for it, access_it in zip((it1, it2), (access_it1[:1], access_it2)):
|
||||
params = (self.ctxt, it['flavorid'])
|
||||
real_access_it = db.flavor_access_get_by_flavor_id(*params)
|
||||
self._assertEqualListsOfObjects(access_it, real_access_it)
|
||||
|
||||
def test_flavor_access_remove_flavor_not_found(self):
|
||||
self.assertRaises(exception.FlavorNotFound,
|
||||
db.flavor_access_remove,
|
||||
self.ctxt, 'nonexists', 'does_not_matter')
|
||||
|
||||
def test_flavor_access_remove_access_not_found(self):
|
||||
flavor = self._create_flavor({'flavorid': 'f1'})
|
||||
params = (flavor['flavorid'], 'p1')
|
||||
self._create_flavor_access(*params)
|
||||
self.assertRaises(exception.FlavorAccessNotFound,
|
||||
db.flavor_access_remove,
|
||||
self.ctxt, flavor['flavorid'], 'p2')
|
||||
|
||||
def test_flavor_access_removed_after_flavor_destroy(self):
|
||||
flavor1 = self._create_flavor({'flavorid': 'f1', 'name': 'n1'})
|
||||
flavor2 = self._create_flavor({'flavorid': 'f2', 'name': 'n2'})
|
||||
|
|
Loading…
Reference in New Issue