Merge "Fix cmd options for updating a quota class"
This commit is contained in:
commit
71dfec6743
cinderclient
@ -668,13 +668,11 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
def get_os_quota_class_sets_test(self, **kw):
|
||||
return (200, {}, {'quota_class_set': {
|
||||
'class_name': 'test',
|
||||
'metadata_items': [],
|
||||
'volumes': 1,
|
||||
'snapshots': 1,
|
||||
'gigabytes': 1,
|
||||
'backups': 1,
|
||||
'backup_gigabytes': 1,
|
||||
'consistencygroups': 1,
|
||||
'per_volume_gigabytes': 1, }})
|
||||
|
||||
def put_os_quota_class_sets_test(self, body, **kw):
|
||||
@ -683,13 +681,11 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
required=['class_name'])
|
||||
return (200, {}, {'quota_class_set': {
|
||||
'class_name': 'test',
|
||||
'metadata_items': [],
|
||||
'volumes': 2,
|
||||
'snapshots': 2,
|
||||
'gigabytes': 1,
|
||||
'backups': 1,
|
||||
'backup_gigabytes': 1,
|
||||
'consistencygroups': 2,
|
||||
'per_volume_gigabytes': 1}})
|
||||
|
||||
#
|
||||
|
@ -32,7 +32,7 @@ class QuotaClassSetsTest(utils.TestCase):
|
||||
q = cs.quota_classes.get('test')
|
||||
q.update(volumes=2, snapshots=2, gigabytes=2000,
|
||||
backups=2, backup_gigabytes=2000,
|
||||
consistencygroups=2, per_volume_gigabytes=100)
|
||||
per_volume_gigabytes=100)
|
||||
cs.assert_called('PUT', '/os-quota-class-sets/test')
|
||||
self._assert_request_id(q)
|
||||
|
||||
@ -44,7 +44,6 @@ class QuotaClassSetsTest(utils.TestCase):
|
||||
self.assertEqual(q.gigabytes, q2.gigabytes)
|
||||
self.assertEqual(q.backups, q2.backups)
|
||||
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||
self.assertEqual(q.consistencygroups, q2.consistencygroups)
|
||||
self.assertEqual(q.per_volume_gigabytes, q2.per_volume_gigabytes)
|
||||
q2.volumes = 0
|
||||
self.assertNotEqual(q.volumes, q2.volumes)
|
||||
@ -56,8 +55,6 @@ class QuotaClassSetsTest(utils.TestCase):
|
||||
self.assertNotEqual(q.backups, q2.backups)
|
||||
q2.backup_gigabytes = 0
|
||||
self.assertNotEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||
q2.consistencygroups = 0
|
||||
self.assertNotEqual(q.consistencygroups, q2.consistencygroups)
|
||||
q2.per_volume_gigabytes = 0
|
||||
self.assertNotEqual(q.per_volume_gigabytes, q2.per_volume_gigabytes)
|
||||
q2.get()
|
||||
@ -66,7 +63,6 @@ class QuotaClassSetsTest(utils.TestCase):
|
||||
self.assertEqual(q.gigabytes, q2.gigabytes)
|
||||
self.assertEqual(q.backups, q2.backups)
|
||||
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
|
||||
self.assertEqual(q.consistencygroups, q2.consistencygroups)
|
||||
self.assertEqual(q.per_volume_gigabytes, q2.per_volume_gigabytes)
|
||||
self._assert_request_id(q)
|
||||
self._assert_request_id(q2)
|
||||
|
@ -1386,3 +1386,24 @@ class ShellTest(utils.TestCase):
|
||||
def test_extra_specs_list(self):
|
||||
self.run_command('extra-specs-list')
|
||||
self.assert_called('GET', '/types?is_public=None')
|
||||
|
||||
def test_quota_class_show(self):
|
||||
self.run_command('quota-class-show test')
|
||||
self.assert_called('GET', '/os-quota-class-sets/test')
|
||||
|
||||
def test_quota_class_update(self):
|
||||
expected = {'quota_class_set': {'class_name': 'test',
|
||||
'volumes': 2,
|
||||
'snapshots': 2,
|
||||
'gigabytes': 1,
|
||||
'backups': 1,
|
||||
'backup_gigabytes': 1,
|
||||
'per_volume_gigabytes': 1}}
|
||||
self.run_command('quota-class-update test '
|
||||
'--volumes 2 '
|
||||
'--snapshots 2 '
|
||||
'--gigabytes 1 '
|
||||
'--backups 1 '
|
||||
'--backup-gigabytes 1 '
|
||||
'--per-volume-gigabytes 1')
|
||||
self.assert_called('PUT', '/os-quota-class-sets/test', body=expected)
|
||||
|
@ -1026,10 +1026,22 @@ def do_quota_class_show(cs, args):
|
||||
metavar='<gigabytes>',
|
||||
type=int, default=None,
|
||||
help='The new "gigabytes" quota value. Default=None.')
|
||||
@utils.arg('--backups',
|
||||
metavar='<backups>',
|
||||
type=int, default=None,
|
||||
help='The new "backups" quota value. Default=None.')
|
||||
@utils.arg('--backup-gigabytes',
|
||||
metavar='<backup_gigabytes>',
|
||||
type=int, default=None,
|
||||
help='The new "backup_gigabytes" quota value. Default=None.')
|
||||
@utils.arg('--volume-type',
|
||||
metavar='<volume_type_name>',
|
||||
default=None,
|
||||
help='Volume type. Default=None.')
|
||||
@utils.arg('--per-volume-gigabytes',
|
||||
metavar='<per_volume_gigabytes>',
|
||||
type=int, default=None,
|
||||
help='Set max volume size limit. Default=None.')
|
||||
def do_quota_class_update(cs, args):
|
||||
"""Updates quotas for a quota class."""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user