summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAarti Kriplani <aarti.kriplani@RACKSPACE.COM>2013-06-03 17:33:17 +0530
committerAarti Kriplani <aarti.kriplani@RACKSPACE.COM>2013-06-06 20:54:46 +0530
commitd43b923d8a0509b39c5521153def078a422a491a (patch)
tree4f159f820339f0d751d728dda17e328568196e56
parentf67c5e0cf9b067ff616145579952b47a0ed2c420 (diff)
Delete a quota through admin api.
Exposes the quota-delete api implemented as part of blueprint admin-api-for-delete-quota Change-Id: Iab358f0fcf2dfb41bcd9a3a5b73d590d3f55cd6c
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Kevin L. Mitchell <kevin.mitchell@rackspace.com> Approved+1: Andrew Laski <andrew.laski@rackspace.com> Code-Review+2: Andrew Laski <andrew.laski@rackspace.com> Code-Review+1: David Ripton <dripton@redhat.com> Submitted-by: Jenkins Submitted-at: Mon, 10 Jun 2013 17:58:51 +0000 Reviewed-on: https://review.openstack.org/31505 Project: openstack/python-novaclient Branch: refs/heads/master
-rw-r--r--novaclient/tests/v1_1/fakes.py6
-rw-r--r--novaclient/tests/v1_1/test_quotas.py5
-rw-r--r--novaclient/tests/v1_1/test_shell.py6
-rw-r--r--novaclient/v1_1/quotas.py3
-rw-r--r--novaclient/v1_1/shell.py9
5 files changed, 29 insertions, 0 deletions
diff --git a/novaclient/tests/v1_1/fakes.py b/novaclient/tests/v1_1/fakes.py
index 924d390..601a060 100644
--- a/novaclient/tests/v1_1/fakes.py
+++ b/novaclient/tests/v1_1/fakes.py
@@ -1014,6 +1014,12 @@ class FakeHTTPClient(base_client.HTTPClient):
1014 'security_groups': 1, 1014 'security_groups': 1,
1015 'security_group_rules': 1}}) 1015 'security_group_rules': 1}})
1016 1016
1017 def delete_os_quota_sets_test(self, **kw):
1018 return (202, {}, {})
1019
1020 def delete_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, **kw):
1021 return (202, {}, {})
1022
1017 # 1023 #
1018 # Quota Classes 1024 # Quota Classes
1019 # 1025 #
diff --git a/novaclient/tests/v1_1/test_quotas.py b/novaclient/tests/v1_1/test_quotas.py
index 69c2952..a4d68f8 100644
--- a/novaclient/tests/v1_1/test_quotas.py
+++ b/novaclient/tests/v1_1/test_quotas.py
@@ -45,3 +45,8 @@ class QuotaSetsTest(utils.TestCase):
45 self.assertNotEqual(q.volumes, q2.volumes) 45 self.assertNotEqual(q.volumes, q2.volumes)
46 q2.get() 46 q2.get()
47 self.assertEqual(q.volumes, q2.volumes) 47 self.assertEqual(q.volumes, q2.volumes)
48
49 def test_quotas_delete(self):
50 tenant_id = 'test'
51 cs.quotas.delete(tenant_id)
52 cs.assert_called('DELETE', '/os-quota-sets/%s' % tenant_id)
diff --git a/novaclient/tests/v1_1/test_shell.py b/novaclient/tests/v1_1/test_shell.py
index 5b17b2b..96c1156 100644
--- a/novaclient/tests/v1_1/test_shell.py
+++ b/novaclient/tests/v1_1/test_shell.py
@@ -1034,6 +1034,12 @@ class ShellTest(utils.TestCase):
1034 {'quota_set': {'fixed_ips': 5, 1034 {'quota_set': {'fixed_ips': 5,
1035 'tenant_id': '97f4c221bff44578b0300df4ef119353'}}) 1035 'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
1036 1036
1037 def test_quota_delete(self):
1038 self.run_command('quota-delete --tenant '
1039 '97f4c221bff44578b0300df4ef119353')
1040 self.assert_called('DELETE',
1041 '/os-quota-sets/97f4c221bff44578b0300df4ef119353')
1042
1037 def test_quota_class_show(self): 1043 def test_quota_class_show(self):
1038 self.run_command('quota-class-show test') 1044 self.run_command('quota-class-show test')
1039 self.assert_called('GET', '/os-quota-class-sets/test') 1045 self.assert_called('GET', '/os-quota-class-sets/test')
diff --git a/novaclient/v1_1/quotas.py b/novaclient/v1_1/quotas.py
index 6aa7fe5..19f7d71 100644
--- a/novaclient/v1_1/quotas.py
+++ b/novaclient/v1_1/quotas.py
@@ -69,3 +69,6 @@ class QuotaSetManager(base.Manager):
69 def defaults(self, tenant_id): 69 def defaults(self, tenant_id):
70 return self._get('/os-quota-sets/%s/defaults' % tenant_id, 70 return self._get('/os-quota-sets/%s/defaults' % tenant_id,
71 'quota_set') 71 'quota_set')
72
73 def delete(self, tenant_id):
74 self._delete("/os-quota-sets/%s" % tenant_id)
diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py
index 4c1627c..21e6589 100644
--- a/novaclient/v1_1/shell.py
+++ b/novaclient/v1_1/shell.py
@@ -2914,6 +2914,15 @@ def do_quota_update(cs, args):
2914 _quota_update(cs.quotas, args.tenant, args) 2914 _quota_update(cs.quotas, args.tenant, args)
2915 2915
2916 2916
2917@utils.arg('--tenant',
2918 metavar='<tenant-id>',
2919 help='ID of tenant to delete quota for.')
2920def do_quota_delete(cs, args):
2921 """Delete quota for a tenant so their quota will revert back to default."""
2922
2923 cs.quotas.delete(args.tenant)
2924
2925
2917@utils.arg('class_name', 2926@utils.arg('class_name',
2918 metavar='<class>', 2927 metavar='<class>',
2919 help='Name of quota class to list the quotas for.') 2928 help='Name of quota class to list the quotas for.')