Delete a quota through admin api.
Exposes the quota-delete api implemented as part of blueprint admin-api-for-delete-quota Change-Id: Iab358f0fcf2dfb41bcd9a3a5b73d590d3f55cd6c
This commit is contained in:
parent
f67c5e0cf9
commit
d43b923d8a
novaclient
@ -1014,6 +1014,12 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def delete_os_quota_sets_test(self, **kw):
|
||||
return (202, {}, {})
|
||||
|
||||
def delete_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, **kw):
|
||||
return (202, {}, {})
|
||||
|
||||
#
|
||||
# Quota Classes
|
||||
#
|
||||
|
@ -45,3 +45,8 @@ class QuotaSetsTest(utils.TestCase):
|
||||
self.assertNotEqual(q.volumes, q2.volumes)
|
||||
q2.get()
|
||||
self.assertEqual(q.volumes, q2.volumes)
|
||||
|
||||
def test_quotas_delete(self):
|
||||
tenant_id = 'test'
|
||||
cs.quotas.delete(tenant_id)
|
||||
cs.assert_called('DELETE', '/os-quota-sets/%s' % tenant_id)
|
||||
|
@ -1034,6 +1034,12 @@ class ShellTest(utils.TestCase):
|
||||
{'quota_set': {'fixed_ips': 5,
|
||||
'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
|
||||
|
||||
def test_quota_delete(self):
|
||||
self.run_command('quota-delete --tenant '
|
||||
'97f4c221bff44578b0300df4ef119353')
|
||||
self.assert_called('DELETE',
|
||||
'/os-quota-sets/97f4c221bff44578b0300df4ef119353')
|
||||
|
||||
def test_quota_class_show(self):
|
||||
self.run_command('quota-class-show test')
|
||||
self.assert_called('GET', '/os-quota-class-sets/test')
|
||||
|
@ -69,3 +69,6 @@ class QuotaSetManager(base.Manager):
|
||||
def defaults(self, tenant_id):
|
||||
return self._get('/os-quota-sets/%s/defaults' % tenant_id,
|
||||
'quota_set')
|
||||
|
||||
def delete(self, tenant_id):
|
||||
self._delete("/os-quota-sets/%s" % tenant_id)
|
||||
|
@ -2914,6 +2914,15 @@ def do_quota_update(cs, args):
|
||||
_quota_update(cs.quotas, args.tenant, args)
|
||||
|
||||
|
||||
@utils.arg('--tenant',
|
||||
metavar='<tenant-id>',
|
||||
help='ID of tenant to delete quota for.')
|
||||
def do_quota_delete(cs, args):
|
||||
"""Delete quota for a tenant so their quota will revert back to default."""
|
||||
|
||||
cs.quotas.delete(args.tenant)
|
||||
|
||||
|
||||
@utils.arg('class_name',
|
||||
metavar='<class>',
|
||||
help='Name of quota class to list the quotas for.')
|
||||
|
Loading…
x
Reference in New Issue
Block a user