Skip to content

Commit

Permalink
Revert "Support force update quota"
Browse files Browse the repository at this point in the history
This reverts commit e8b665e.

The previous commit created an incompatibility in using new nova
client with older nova server. Nova client needs to be always
releasable, and work with all nova server API versions out there.

Fixes bug #1173353

Change-Id: I2c07d109af4a35bc3b98dedaf991d5d3cc6fdd3b
  • Loading branch information
sdague committed May 24, 2013
1 parent c07f05e commit c305a45
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 42 deletions.
5 changes: 2 additions & 3 deletions novaclient/v1_1/quotas.py
Expand Up @@ -36,7 +36,7 @@ def get(self, tenant_id):
tenant_id = tenant_id.tenant_id
return self._get("/os-quota-sets/%s" % (tenant_id), "quota_set")

def update(self, tenant_id, force=None, metadata_items=None,
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, fixed_ips=None, instances=None,
Expand All @@ -58,8 +58,7 @@ def update(self, tenant_id, force=None, metadata_items=None,
'injected_files': injected_files,
'cores': cores,
'security_groups': security_groups,
'security_group_rules': security_group_rules,
'force': force}}
'security_group_rules': security_group_rules}}

for key in body['quota_set'].keys():
if body['quota_set'][key] is None:
Expand Down
13 changes: 1 addition & 12 deletions novaclient/v1_1/shell.py
Expand Up @@ -31,7 +31,6 @@
from novaclient.openstack.common import uuidutils
from novaclient import utils
from novaclient.v1_1 import availability_zones
from novaclient.v1_1 import quotas
from novaclient.v1_1 import servers


Expand Down Expand Up @@ -2791,11 +2790,7 @@ def _quota_update(manager, identifier, args):
updates[resource] = val

if updates:
force_update = getattr(args, 'force', False)
if isinstance(manager, quotas.QuotaSetManager):
manager.update(identifier, force_update, **updates)
else:
manager.update(identifier, **updates)
manager.update(identifier, **updates)


@utils.arg('--tenant',
Expand Down Expand Up @@ -2904,12 +2899,6 @@ def do_quota_defaults(cs, args):
type=int,
default=None,
help='New value for the "security-group-rules" quota.')
@utils.arg('--force',
dest='force',
action="store_true",
default=False,
help='Whether force update the quota even if the already used'
' and reserved exceeds the new quota')
def do_quota_update(cs, args):
"""Update the quotas for a tenant."""

Expand Down
9 changes: 0 additions & 9 deletions tests/v1_1/test_quotas.py
Expand Up @@ -37,15 +37,6 @@ def test_update_quota(self):
cs.assert_called('PUT',
'/os-quota-sets/97f4c221bff44578b0300df4ef119353')

def test_force_update_quota(self):
q = cs.quotas.get('97f4c221bff44578b0300df4ef119353')
q.update(cores=2, force=True)
cs.assert_called(
'PUT', '/os-quota-sets/97f4c221bff44578b0300df4ef119353',
{'quota_set': {'force': True,
'cores': 2,
'tenant_id': '97f4c221bff44578b0300df4ef119353'}})

def test_refresh_quota(self):
q = cs.quotas.get('test')
q2 = cs.quotas.get('test')
Expand Down
21 changes: 3 additions & 18 deletions tests/v1_1/test_shell.py
Expand Up @@ -1022,31 +1022,16 @@ def test_quota_update(self):
self.run_command(
'quota-update 97f4c221bff44578b0300df4ef119353'
' --instances=5')
self.assert_called(
'PUT',
'/os-quota-sets/97f4c221bff44578b0300df4ef119353',
{'quota_set': {'force': False,
'instances': 5,
'tenant_id': '97f4c221bff44578b0300df4ef119353'}})

def test_quota_force_update(self):
self.run_command(
'quota-update 97f4c221bff44578b0300df4ef119353'
' --instances=5 --force')
self.assert_called(
'PUT', '/os-quota-sets/97f4c221bff44578b0300df4ef119353',
{'quota_set': {'force': True,
'instances': 5,
'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
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': {'force': False,
'fixed_ips': 5,
{'quota_set': {'fixed_ips': 5,
'tenant_id': '97f4c221bff44578b0300df4ef119353'}})

def test_quota_class_show(self):
Expand Down

0 comments on commit c305a45

Please sign in to comment.