Skip to content

Commit 71dfec6

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Fix cmd options for updating a quota class"
2 parents 3e1c4cc + 020bb81 commit 71dfec6

4 files changed

Lines changed: 34 additions & 9 deletions

File tree

cinderclient/tests/unit/v2/fakes.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,13 +668,11 @@ def delete_os_quota_sets_test(self, **kw):
668668
def get_os_quota_class_sets_test(self, **kw):
669669
return (200, {}, {'quota_class_set': {
670670
'class_name': 'test',
671-
'metadata_items': [],
672671
'volumes': 1,
673672
'snapshots': 1,
674673
'gigabytes': 1,
675674
'backups': 1,
676675
'backup_gigabytes': 1,
677-
'consistencygroups': 1,
678676
'per_volume_gigabytes': 1, }})
679677

680678
def put_os_quota_class_sets_test(self, body, **kw):
@@ -683,13 +681,11 @@ def put_os_quota_class_sets_test(self, body, **kw):
683681
required=['class_name'])
684682
return (200, {}, {'quota_class_set': {
685683
'class_name': 'test',
686-
'metadata_items': [],
687684
'volumes': 2,
688685
'snapshots': 2,
689686
'gigabytes': 1,
690687
'backups': 1,
691688
'backup_gigabytes': 1,
692-
'consistencygroups': 2,
693689
'per_volume_gigabytes': 1}})
694690

695691
#

cinderclient/tests/unit/v2/test_quota_classes.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_update_quota(self):
3232
q = cs.quota_classes.get('test')
3333
q.update(volumes=2, snapshots=2, gigabytes=2000,
3434
backups=2, backup_gigabytes=2000,
35-
consistencygroups=2, per_volume_gigabytes=100)
35+
per_volume_gigabytes=100)
3636
cs.assert_called('PUT', '/os-quota-class-sets/test')
3737
self._assert_request_id(q)
3838

@@ -44,7 +44,6 @@ def test_refresh_quota(self):
4444
self.assertEqual(q.gigabytes, q2.gigabytes)
4545
self.assertEqual(q.backups, q2.backups)
4646
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
47-
self.assertEqual(q.consistencygroups, q2.consistencygroups)
4847
self.assertEqual(q.per_volume_gigabytes, q2.per_volume_gigabytes)
4948
q2.volumes = 0
5049
self.assertNotEqual(q.volumes, q2.volumes)
@@ -56,8 +55,6 @@ def test_refresh_quota(self):
5655
self.assertNotEqual(q.backups, q2.backups)
5756
q2.backup_gigabytes = 0
5857
self.assertNotEqual(q.backup_gigabytes, q2.backup_gigabytes)
59-
q2.consistencygroups = 0
60-
self.assertNotEqual(q.consistencygroups, q2.consistencygroups)
6158
q2.per_volume_gigabytes = 0
6259
self.assertNotEqual(q.per_volume_gigabytes, q2.per_volume_gigabytes)
6360
q2.get()
@@ -66,7 +63,6 @@ def test_refresh_quota(self):
6663
self.assertEqual(q.gigabytes, q2.gigabytes)
6764
self.assertEqual(q.backups, q2.backups)
6865
self.assertEqual(q.backup_gigabytes, q2.backup_gigabytes)
69-
self.assertEqual(q.consistencygroups, q2.consistencygroups)
7066
self.assertEqual(q.per_volume_gigabytes, q2.per_volume_gigabytes)
7167
self._assert_request_id(q)
7268
self._assert_request_id(q2)

cinderclient/tests/unit/v2/test_shell.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,3 +1386,24 @@ def test_snapshot_unmanage(self):
13861386
def test_extra_specs_list(self):
13871387
self.run_command('extra-specs-list')
13881388
self.assert_called('GET', '/types?is_public=None')
1389+
1390+
def test_quota_class_show(self):
1391+
self.run_command('quota-class-show test')
1392+
self.assert_called('GET', '/os-quota-class-sets/test')
1393+
1394+
def test_quota_class_update(self):
1395+
expected = {'quota_class_set': {'class_name': 'test',
1396+
'volumes': 2,
1397+
'snapshots': 2,
1398+
'gigabytes': 1,
1399+
'backups': 1,
1400+
'backup_gigabytes': 1,
1401+
'per_volume_gigabytes': 1}}
1402+
self.run_command('quota-class-update test '
1403+
'--volumes 2 '
1404+
'--snapshots 2 '
1405+
'--gigabytes 1 '
1406+
'--backups 1 '
1407+
'--backup-gigabytes 1 '
1408+
'--per-volume-gigabytes 1')
1409+
self.assert_called('PUT', '/os-quota-class-sets/test', body=expected)

cinderclient/v2/shell.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,10 +1026,22 @@ def do_quota_class_show(cs, args):
10261026
metavar='<gigabytes>',
10271027
type=int, default=None,
10281028
help='The new "gigabytes" quota value. Default=None.')
1029+
@utils.arg('--backups',
1030+
metavar='<backups>',
1031+
type=int, default=None,
1032+
help='The new "backups" quota value. Default=None.')
1033+
@utils.arg('--backup-gigabytes',
1034+
metavar='<backup_gigabytes>',
1035+
type=int, default=None,
1036+
help='The new "backup_gigabytes" quota value. Default=None.')
10291037
@utils.arg('--volume-type',
10301038
metavar='<volume_type_name>',
10311039
default=None,
10321040
help='Volume type. Default=None.')
1041+
@utils.arg('--per-volume-gigabytes',
1042+
metavar='<per_volume_gigabytes>',
1043+
type=int, default=None,
1044+
help='Set max volume size limit. Default=None.')
10331045
def do_quota_class_update(cs, args):
10341046
"""Updates quotas for a quota class."""
10351047

0 commit comments

Comments
 (0)