Allow CG quota to be showed and updated
This patch added the ability for CG quota to be showed and updated. - Added consistencygroups as a quota resource to be displayed. - Added an option for consistencygroups quota to be updated. Change-Id: I7e88eb426eb1733bce955b7a15b8bffdb1e8ee20 Closes-Bug: #1373766
This commit is contained in:
@@ -476,7 +476,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
'snapshots': 1,
|
'snapshots': 1,
|
||||||
'gigabytes': 1,
|
'gigabytes': 1,
|
||||||
'backups': 1,
|
'backups': 1,
|
||||||
'backup_gigabytes': 1}})
|
'backup_gigabytes': 1,
|
||||||
|
'consistencygroups': 1}})
|
||||||
|
|
||||||
def get_os_quota_sets_test_defaults(self):
|
def get_os_quota_sets_test_defaults(self):
|
||||||
return (200, {}, {'quota_set': {
|
return (200, {}, {'quota_set': {
|
||||||
@@ -486,7 +487,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
'snapshots': 1,
|
'snapshots': 1,
|
||||||
'gigabytes': 1,
|
'gigabytes': 1,
|
||||||
'backups': 1,
|
'backups': 1,
|
||||||
'backup_gigabytes': 1}})
|
'backup_gigabytes': 1,
|
||||||
|
'consistencygroups': 1}})
|
||||||
|
|
||||||
def put_os_quota_sets_test(self, body, **kw):
|
def put_os_quota_sets_test(self, body, **kw):
|
||||||
assert list(body) == ['quota_set']
|
assert list(body) == ['quota_set']
|
||||||
@@ -499,7 +501,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
'snapshots': 2,
|
'snapshots': 2,
|
||||||
'gigabytes': 1,
|
'gigabytes': 1,
|
||||||
'backups': 1,
|
'backups': 1,
|
||||||
'backup_gigabytes': 1}})
|
'backup_gigabytes': 1,
|
||||||
|
'consistencygroups': 2}})
|
||||||
|
|
||||||
def delete_os_quota_sets_1234(self, **kw):
|
def delete_os_quota_sets_1234(self, **kw):
|
||||||
return (200, {}, {})
|
return (200, {}, {})
|
||||||
@@ -519,7 +522,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
'snapshots': 1,
|
'snapshots': 1,
|
||||||
'gigabytes': 1,
|
'gigabytes': 1,
|
||||||
'backups': 1,
|
'backups': 1,
|
||||||
'backup_gigabytes': 1}})
|
'backup_gigabytes': 1,
|
||||||
|
'consistencygroups': 1}})
|
||||||
|
|
||||||
def put_os_quota_class_sets_test(self, body, **kw):
|
def put_os_quota_class_sets_test(self, body, **kw):
|
||||||
assert list(body) == ['quota_class_set']
|
assert list(body) == ['quota_class_set']
|
||||||
@@ -532,7 +536,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
'snapshots': 2,
|
'snapshots': 2,
|
||||||
'gigabytes': 1,
|
'gigabytes': 1,
|
||||||
'backups': 1,
|
'backups': 1,
|
||||||
'backup_gigabytes': 1}})
|
'backup_gigabytes': 1,
|
||||||
|
'consistencygroups': 2}})
|
||||||
|
|
||||||
#
|
#
|
||||||
# VolumeTypes
|
# VolumeTypes
|
||||||
|
@@ -30,7 +30,8 @@ class QuotaClassSetsTest(utils.TestCase):
|
|||||||
def test_update_quota(self):
|
def test_update_quota(self):
|
||||||
q = cs.quota_classes.get('test')
|
q = cs.quota_classes.get('test')
|
||||||
q.update(volumes=2, snapshots=2, gigabytes=2000,
|
q.update(volumes=2, snapshots=2, gigabytes=2000,
|
||||||
backups=2, backup_gigabytes=2000)
|
backups=2, backup_gigabytes=2000,
|
||||||
|
consistencygroups=2)
|
||||||
cs.assert_called('PUT', '/os-quota-class-sets/test')
|
cs.assert_called('PUT', '/os-quota-class-sets/test')
|
||||||
|
|
||||||
def test_refresh_quota(self):
|
def test_refresh_quota(self):
|
||||||
@@ -41,6 +42,7 @@ class QuotaClassSetsTest(utils.TestCase):
|
|||||||
self.assertEqual(q.gigabytes, q2.gigabytes)
|
self.assertEqual(q.gigabytes, q2.gigabytes)
|
||||||
self.assertEqual(q.backups, q2.backups)
|
self.assertEqual(q.backups, q2.backups)
|
||||||
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||||
|
self.assertEqual(q.consistencygroups, q2.consistencygroups)
|
||||||
q2.volumes = 0
|
q2.volumes = 0
|
||||||
self.assertNotEqual(q.volumes, q2.volumes)
|
self.assertNotEqual(q.volumes, q2.volumes)
|
||||||
q2.snapshots = 0
|
q2.snapshots = 0
|
||||||
@@ -51,9 +53,12 @@ class QuotaClassSetsTest(utils.TestCase):
|
|||||||
self.assertNotEqual(q.backups, q2.backups)
|
self.assertNotEqual(q.backups, q2.backups)
|
||||||
q2.backup_gigabytes = 0
|
q2.backup_gigabytes = 0
|
||||||
self.assertNotEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
self.assertNotEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||||
|
q2.consistencygroups = 0
|
||||||
|
self.assertNotEqual(q.consistencygroups, q2.consistencygroups)
|
||||||
q2.get()
|
q2.get()
|
||||||
self.assertEqual(q.volumes, q2.volumes)
|
self.assertEqual(q.volumes, q2.volumes)
|
||||||
self.assertEqual(q.snapshots, q2.snapshots)
|
self.assertEqual(q.snapshots, q2.snapshots)
|
||||||
self.assertEqual(q.gigabytes, q2.gigabytes)
|
self.assertEqual(q.gigabytes, q2.gigabytes)
|
||||||
self.assertEqual(q.backups, q2.backups)
|
self.assertEqual(q.backups, q2.backups)
|
||||||
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||||
|
self.assertEqual(q.consistencygroups, q2.consistencygroups)
|
||||||
|
@@ -39,6 +39,7 @@ class QuotaSetsTest(utils.TestCase):
|
|||||||
q.update(gigabytes=2000)
|
q.update(gigabytes=2000)
|
||||||
q.update(backups=2)
|
q.update(backups=2)
|
||||||
q.update(backup_gigabytes=2000)
|
q.update(backup_gigabytes=2000)
|
||||||
|
q.update(consistencygroups=2)
|
||||||
cs.assert_called('PUT', '/os-quota-sets/test')
|
cs.assert_called('PUT', '/os-quota-sets/test')
|
||||||
|
|
||||||
def test_refresh_quota(self):
|
def test_refresh_quota(self):
|
||||||
@@ -49,6 +50,7 @@ class QuotaSetsTest(utils.TestCase):
|
|||||||
self.assertEqual(q.gigabytes, q2.gigabytes)
|
self.assertEqual(q.gigabytes, q2.gigabytes)
|
||||||
self.assertEqual(q.backups, q2.backups)
|
self.assertEqual(q.backups, q2.backups)
|
||||||
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||||
|
self.assertEqual(q.consistencygroups, q2.consistencygroups)
|
||||||
q2.volumes = 0
|
q2.volumes = 0
|
||||||
self.assertNotEqual(q.volumes, q2.volumes)
|
self.assertNotEqual(q.volumes, q2.volumes)
|
||||||
q2.snapshots = 0
|
q2.snapshots = 0
|
||||||
@@ -59,12 +61,15 @@ class QuotaSetsTest(utils.TestCase):
|
|||||||
self.assertNotEqual(q.backups, q2.backups)
|
self.assertNotEqual(q.backups, q2.backups)
|
||||||
q2.backup_gigabytes = 0
|
q2.backup_gigabytes = 0
|
||||||
self.assertNotEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
self.assertNotEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||||
|
q2.consistencygroups = 0
|
||||||
|
self.assertNotEqual(q.consistencygroups, q2.consistencygroups)
|
||||||
q2.get()
|
q2.get()
|
||||||
self.assertEqual(q.volumes, q2.volumes)
|
self.assertEqual(q.volumes, q2.volumes)
|
||||||
self.assertEqual(q.snapshots, q2.snapshots)
|
self.assertEqual(q.snapshots, q2.snapshots)
|
||||||
self.assertEqual(q.gigabytes, q2.gigabytes)
|
self.assertEqual(q.gigabytes, q2.gigabytes)
|
||||||
self.assertEqual(q.backups, q2.backups)
|
self.assertEqual(q.backups, q2.backups)
|
||||||
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||||
|
self.assertEqual(q.consistencygroups, q2.consistencygroups)
|
||||||
|
|
||||||
def test_delete_quota(self):
|
def test_delete_quota(self):
|
||||||
tenant_id = 'test'
|
tenant_id = 'test'
|
||||||
|
@@ -765,7 +765,8 @@ def do_credentials(cs, args):
|
|||||||
|
|
||||||
|
|
||||||
_quota_resources = ['volumes', 'snapshots', 'gigabytes',
|
_quota_resources = ['volumes', 'snapshots', 'gigabytes',
|
||||||
'backups', 'backup_gigabytes']
|
'backups', 'backup_gigabytes',
|
||||||
|
'consistencygroups']
|
||||||
_quota_infos = ['Type', 'In_use', 'Reserved', 'Limit']
|
_quota_infos = ['Type', 'In_use', 'Reserved', 'Limit']
|
||||||
|
|
||||||
|
|
||||||
@@ -863,6 +864,10 @@ def do_quota_defaults(cs, args):
|
|||||||
metavar='<backup_gigabytes>',
|
metavar='<backup_gigabytes>',
|
||||||
type=int, default=None,
|
type=int, default=None,
|
||||||
help='The new "backup_gigabytes" quota value. Default=None.')
|
help='The new "backup_gigabytes" quota value. Default=None.')
|
||||||
|
@utils.arg('--consistencygroups',
|
||||||
|
metavar='<consistencygroups>',
|
||||||
|
type=int, default=None,
|
||||||
|
help='The new "consistencygroups" quota value. Default=None.')
|
||||||
@utils.arg('--volume-type',
|
@utils.arg('--volume-type',
|
||||||
metavar='<volume_type_name>',
|
metavar='<volume_type_name>',
|
||||||
default=None,
|
default=None,
|
||||||
|
Reference in New Issue
Block a user