Allow updating fixed_ips quotas in quota-class-update (v2 shell only)

The quota-class-update command wasn't allowing updating quotas for
fixed_ips which is a supported key for the os-quota-class-sets API.

This change adds the support to update qoutas for fixed_ips and updates
the existing test to be more robust in (a) the quota keys it's testing
and (b) the request body it's asserting.

This is a v2-only change since the os-quota-class-sets API was removed
from the nova v3 API in Icehouse.

Closes-Bug: #1330571

Change-Id: Ifcca6d00551619b993b96f05134980a4ca2f2acf
This commit is contained in:
Matt Riedemann 2014-06-17 11:01:18 -07:00
parent e6a51f47c4
commit 3441007062
2 changed files with 21 additions and 5 deletions

View File

@ -1600,11 +1600,22 @@ class ShellTest(utils.TestCase):
self.assert_called('GET', '/os-quota-class-sets/test')
def test_quota_class_update(self):
self.run_command('quota-class-update 97f4c221bff44578b0300df4ef119353'
' --instances=5')
self.assert_called('PUT',
'/os-quota-class-sets/97f4c221bff44578b0300'
'df4ef119353')
# The list of args we can update.
args = (
'--instances', '--cores', '--ram', '--floating-ips', '--fixed-ips',
'--metadata-items', '--injected-files',
'--injected-file-content-bytes', '--injected-file-path-bytes',
'--key-pairs', '--security-groups', '--security-group-rules'
)
for arg in args:
self.run_command('quota-class-update '
'97f4c221bff44578b0300df4ef119353 '
'%s=5' % arg)
request_param = arg[2:].replace('-', '_')
body = {'quota_class_set': {request_param: 5}}
self.assert_called(
'PUT', '/os-quota-class-sets/97f4c221bff44578b0300df4ef119353',
body)
def test_network_list(self):
self.run_command('network-list')

View File

@ -3373,6 +3373,11 @@ def do_quota_class_show(cs, args):
@utils.arg('--floating_ips',
type=int,
help=argparse.SUPPRESS)
@utils.arg('--fixed-ips',
metavar='<fixed-ips>',
type=int,
default=None,
help=_('New value for the "fixed-ips" quota.'))
@utils.arg('--metadata-items',
metavar='<metadata-items>',
type=int,