Revert "Support force update quota"

This reverts commit e8b665edbf.

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
This commit is contained in:
Sean Dague 2013-05-24 09:04:09 -04:00
parent c07f05ed33
commit c305a45892
4 changed files with 6 additions and 42 deletions

View File

@ -36,7 +36,7 @@ class QuotaSetManager(base.Manager):
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,
@ -58,8 +58,7 @@ class QuotaSetManager(base.Manager):
'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:

View File

@ -31,7 +31,6 @@ from novaclient.openstack.common import timeutils
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
@ -2791,10 +2790,6 @@ 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)
@ -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."""

View File

@ -37,15 +37,6 @@ class QuotaSetsTest(utils.TestCase):
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')

View File

@ -1022,22 +1022,8 @@ class ShellTest(utils.TestCase):
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(
@ -1045,8 +1031,7 @@ class ShellTest(utils.TestCase):
' --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):