Add quota-delete command to cinder client
Add the command quota-delete <tenant_id> to the client. This change depends on the cinder change: Ia040a20abb831c311eb13624ddecbbf0f12fdd9f DocImpact Implements blueprint quota-delete Change-Id: I1e5c98154dc3c6de168747eb912b45265cd1b9db
This commit is contained in:
committed by
Gerrit Code Review
parent
07fd0fa5e6
commit
5278bdb0c5
@@ -401,6 +401,12 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
'snapshots': 2,
|
||||
'gigabytes': 1}})
|
||||
|
||||
def delete_os_quota_sets_1234(self, **kw):
|
||||
return (200, {}, {})
|
||||
|
||||
def delete_os_quota_sets_test(self, **kw):
|
||||
return (200, {}, {})
|
||||
|
||||
#
|
||||
# Quota Classes
|
||||
#
|
||||
|
||||
@@ -50,3 +50,8 @@ class QuotaSetsTest(utils.TestCase):
|
||||
q2.get()
|
||||
self.assertEqual(q.volumes, q2.volumes)
|
||||
self.assertEqual(q.snapshots, q2.snapshots)
|
||||
|
||||
def test_delete_quota(self):
|
||||
tenant_id = 'test'
|
||||
cs.quotas.delete(tenant_id)
|
||||
cs.assert_called('DELETE', '/os-quota-sets/test')
|
||||
|
||||
@@ -355,3 +355,7 @@ class ShellTest(utils.TestCase):
|
||||
def test_snapshot_delete(self):
|
||||
self.run_command('snapshot-delete 1234')
|
||||
self.assert_called('DELETE', '/snapshots/1234')
|
||||
|
||||
def test_quota_delete(self):
|
||||
self.run_command('quota-delete 1234')
|
||||
self.assert_called('DELETE', '/os-quota-sets/1234')
|
||||
|
||||
@@ -412,6 +412,12 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
'snapshots': 2,
|
||||
'gigabytes': 1}})
|
||||
|
||||
def delete_os_quota_sets_1234(self, **kw):
|
||||
return (200, {}, {})
|
||||
|
||||
def delete_os_quota_sets_test(self, **kw):
|
||||
return (200, {}, {})
|
||||
|
||||
#
|
||||
# Quota Classes
|
||||
#
|
||||
|
||||
@@ -50,3 +50,8 @@ class QuotaSetsTest(utils.TestCase):
|
||||
q2.get()
|
||||
self.assertEqual(q.volumes, q2.volumes)
|
||||
self.assertEqual(q.snapshots, q2.snapshots)
|
||||
|
||||
def test_delete_quota(self):
|
||||
tenant_id = 'test'
|
||||
cs.quotas.delete(tenant_id)
|
||||
cs.assert_called('DELETE', '/os-quota-sets/test')
|
||||
|
||||
@@ -355,3 +355,7 @@ class ShellTest(utils.TestCase):
|
||||
def test_snapshot_delete(self):
|
||||
self.run_command('snapshot-delete 1234')
|
||||
self.assert_called('DELETE', '/snapshots/1234')
|
||||
|
||||
def test_quota_delete(self):
|
||||
self.run_command('quota-delete 1234')
|
||||
self.assert_called('DELETE', '/os-quota-sets/1234')
|
||||
|
||||
@@ -49,3 +49,8 @@ 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):
|
||||
if hasattr(tenant_id, 'tenant_id'):
|
||||
tenant_id = tenant_id.tenant_id
|
||||
return self._delete("/os-quota-sets/%s" % tenant_id)
|
||||
|
||||
@@ -725,6 +725,15 @@ def do_quota_update(cs, args):
|
||||
_quota_update(cs.quotas, args.tenant, args)
|
||||
|
||||
|
||||
@utils.arg('tenant', metavar='<tenant_id>',
|
||||
help='UUID of tenant to delete the quotas for.')
|
||||
@utils.service_type('volume')
|
||||
def do_quota_delete(cs, args):
|
||||
"""Delete the quotas for a tenant."""
|
||||
|
||||
cs.quotas.delete(args.tenant)
|
||||
|
||||
|
||||
@utils.arg('class_name', metavar='<class>',
|
||||
help='Name of quota class to list the quotas for.')
|
||||
@utils.service_type('volume')
|
||||
|
||||
@@ -47,3 +47,8 @@ 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):
|
||||
if hasattr(tenant_id, 'tenant_id'):
|
||||
tenant_id = tenant_id.tenant_id
|
||||
return self._delete("/os-quota-sets/%s" % tenant_id)
|
||||
|
||||
@@ -786,6 +786,15 @@ def do_quota_update(cs, args):
|
||||
_quota_update(cs.quotas, args.tenant, args)
|
||||
|
||||
|
||||
@utils.arg('tenant', metavar='<tenant_id>',
|
||||
help='UUID of tenant to delete the quotas for.')
|
||||
@utils.service_type('volume')
|
||||
def do_quota_delete(cs, args):
|
||||
"""Delete the quotas for a tenant."""
|
||||
|
||||
cs.quotas.delete(args.tenant)
|
||||
|
||||
|
||||
@utils.arg('class_name',
|
||||
metavar='<class>',
|
||||
help='Name of quota class to list the quotas for.')
|
||||
|
||||
Reference in New Issue
Block a user