Skip to content

Commit

Permalink
Add support for the new fixed_ip quota.
Browse files Browse the repository at this point in the history
Required for bug 1125468.

Change-Id: If9f8f31a9fd35497a308ae13351685e470e20cd0
  • Loading branch information
mikalstill committed Mar 16, 2013
1 parent 7850fcd commit 59f8360
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
3 changes: 2 additions & 1 deletion novaclient/v1_1/quotas.py
Expand Up @@ -39,7 +39,7 @@ def get(self, tenant_id):
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):

Expand All @@ -53,6 +53,7 @@ def update(self, tenant_id, metadata_items=None,
'gigabytes': gigabytes,
'ram': ram,
'floating_ips': floating_ips,
'fixed_ips': fixed_ips,
'instances': instances,
'injected_files': injected_files,
'cores': cores,
Expand Down
13 changes: 9 additions & 4 deletions novaclient/v1_1/shell.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 10 additions & 1 deletion tests/v1_1/test_shell.py
Expand Up @@ -1002,7 +1002,7 @@ def test_quota_defaults(self):
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')

Expand All @@ -1013,6 +1013,15 @@ def test_quota_update(self):
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')
Expand Down

0 comments on commit 59f8360

Please sign in to comment.