Add support for the new fixed_ip quota.

Required for bug 1125468.

Change-Id: If9f8f31a9fd35497a308ae13351685e470e20cd0
This commit is contained in:
Michael Still 2013-03-16 06:53:37 +11:00
parent 7850fcdc07
commit 59f8360d7e
3 changed files with 21 additions and 6 deletions

View File

@ -39,7 +39,7 @@ class QuotaSetManager(base.ManagerWithFind):
def update(self, tenant_id, metadata_items=None,
injected_file_content_bytes=None, injected_file_path_bytes=None,
volumes=None, gigabytes=None,
ram=None, floating_ips=None, instances=None,
ram=None, floating_ips=None, fixed_ips=None, instances=None,
injected_files=None, cores=None, key_pairs=None,
security_groups=None, security_group_rules=None):
@ -53,6 +53,7 @@ class QuotaSetManager(base.ManagerWithFind):
'gigabytes': gigabytes,
'ram': ram,
'floating_ips': floating_ips,
'fixed_ips': fixed_ips,
'instances': instances,
'injected_files': injected_files,
'cores': cores,

View File

@ -2683,10 +2683,10 @@ def do_ssh(cs, args):
_quota_resources = ['instances', 'cores', 'ram', 'volumes', 'gigabytes',
'floating_ips', 'metadata_items', 'injected_files',
'key_pairs', 'injected_file_content_bytes',
'injected_file_path_bytes', 'security_groups',
'security_group_rules']
'floating_ips', 'fixed_ips', 'metadata_items',
'injected_files', 'key_pairs',
'injected_file_content_bytes', 'injected_file_path_bytes',
'security_groups', 'security_group_rules']
def _quota_show(quotas):
@ -2767,6 +2767,11 @@ def do_quota_defaults(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,

View File

@ -1002,7 +1002,7 @@ class ShellTest(utils.TestCase):
self.assert_called('GET',
'/os-quota-sets/97f4c221bff44578b0300df4ef119353/defaults')
def test_quota_defaults_no_nenant(self):
def test_quota_defaults_no_tenant(self):
self.run_command('quota-defaults')
self.assert_called('GET', '/os-quota-sets/tenant_id/defaults')
@ -1013,6 +1013,15 @@ class ShellTest(utils.TestCase):
self.assert_called('PUT',
'/os-quota-sets/97f4c221bff44578b0300df4ef119353')
def test_quota_update_fixed_ip(self):
self.run_command(
'quota-update 97f4c221bff44578b0300df4ef119353'
' --fixed-ips=5')
self.assert_called(
'PUT', '/os-quota-sets/97f4c221bff44578b0300df4ef119353',
{'quota_set': {'fixed_ips': 5,
'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
def test_quota_class_show(self):
self.run_command('quota-class-show test')
self.assert_called('GET', '/os-quota-class-sets/test')