Browse Source

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
tags/2.14.0
Sean Dague 6 years ago
parent
commit
c305a45892
4 changed files with 6 additions and 42 deletions
  1. 2
    3
      novaclient/v1_1/quotas.py
  2. 1
    12
      novaclient/v1_1/shell.py
  3. 0
    9
      tests/v1_1/test_quotas.py
  4. 3
    18
      tests/v1_1/test_shell.py

+ 2
- 3
novaclient/v1_1/quotas.py View File

@@ -36,7 +36,7 @@ class QuotaSetManager(base.Manager):
36 36
             tenant_id = tenant_id.tenant_id
37 37
         return self._get("/os-quota-sets/%s" % (tenant_id), "quota_set")
38 38
 
39
-    def update(self, tenant_id, force=None, metadata_items=None,
39
+    def update(self, tenant_id, metadata_items=None,
40 40
                injected_file_content_bytes=None, injected_file_path_bytes=None,
41 41
                volumes=None, gigabytes=None,
42 42
                ram=None, floating_ips=None, fixed_ips=None, instances=None,
@@ -58,8 +58,7 @@ class QuotaSetManager(base.Manager):
58 58
                 'injected_files': injected_files,
59 59
                 'cores': cores,
60 60
                 'security_groups': security_groups,
61
-                'security_group_rules': security_group_rules,
62
-                'force': force}}
61
+                'security_group_rules': security_group_rules}}
63 62
 
64 63
         for key in body['quota_set'].keys():
65 64
             if body['quota_set'][key] is None:

+ 1
- 12
novaclient/v1_1/shell.py View File

@@ -31,7 +31,6 @@ from novaclient.openstack.common import timeutils
31 31
 from novaclient.openstack.common import uuidutils
32 32
 from novaclient import utils
33 33
 from novaclient.v1_1 import availability_zones
34
-from novaclient.v1_1 import quotas
35 34
 from novaclient.v1_1 import servers
36 35
 
37 36
 
@@ -2791,11 +2790,7 @@ def _quota_update(manager, identifier, args):
2791 2790
             updates[resource] = val
2792 2791
 
2793 2792
     if updates:
2794
-        force_update = getattr(args, 'force', False)
2795
-        if isinstance(manager, quotas.QuotaSetManager):
2796
-            manager.update(identifier, force_update, **updates)
2797
-        else:
2798
-            manager.update(identifier, **updates)
2793
+        manager.update(identifier, **updates)
2799 2794
 
2800 2795
 
2801 2796
 @utils.arg('--tenant',
@@ -2904,12 +2899,6 @@ def do_quota_defaults(cs, args):
2904 2899
     type=int,
2905 2900
     default=None,
2906 2901
     help='New value for the "security-group-rules" quota.')
2907
-@utils.arg('--force',
2908
-    dest='force',
2909
-    action="store_true",
2910
-    default=False,
2911
-    help='Whether force update the quota even if the already used'
2912
-            ' and reserved exceeds the new quota')
2913 2902
 def do_quota_update(cs, args):
2914 2903
     """Update the quotas for a tenant."""
2915 2904
 

+ 0
- 9
tests/v1_1/test_quotas.py View File

@@ -37,15 +37,6 @@ class QuotaSetsTest(utils.TestCase):
37 37
         cs.assert_called('PUT',
38 38
                    '/os-quota-sets/97f4c221bff44578b0300df4ef119353')
39 39
 
40
-    def test_force_update_quota(self):
41
-        q = cs.quotas.get('97f4c221bff44578b0300df4ef119353')
42
-        q.update(cores=2, force=True)
43
-        cs.assert_called(
44
-            'PUT', '/os-quota-sets/97f4c221bff44578b0300df4ef119353',
45
-            {'quota_set': {'force': True,
46
-                           'cores': 2,
47
-                           'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
48
-
49 40
     def test_refresh_quota(self):
50 41
         q = cs.quotas.get('test')
51 42
         q2 = cs.quotas.get('test')

+ 3
- 18
tests/v1_1/test_shell.py View File

@@ -1022,22 +1022,8 @@ class ShellTest(utils.TestCase):
1022 1022
         self.run_command(
1023 1023
             'quota-update 97f4c221bff44578b0300df4ef119353'
1024 1024
             ' --instances=5')
1025
-        self.assert_called(
1026
-            'PUT',
1027
-            '/os-quota-sets/97f4c221bff44578b0300df4ef119353',
1028
-            {'quota_set': {'force': False,
1029
-                           'instances': 5,
1030
-                           'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
1031
-
1032
-    def test_quota_force_update(self):
1033
-        self.run_command(
1034
-            'quota-update 97f4c221bff44578b0300df4ef119353'
1035
-            ' --instances=5 --force')
1036
-        self.assert_called(
1037
-            'PUT', '/os-quota-sets/97f4c221bff44578b0300df4ef119353',
1038
-            {'quota_set': {'force': True,
1039
-                           'instances': 5,
1040
-                           'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
1025
+        self.assert_called('PUT',
1026
+                           '/os-quota-sets/97f4c221bff44578b0300df4ef119353')
1041 1027
 
1042 1028
     def test_quota_update_fixed_ip(self):
1043 1029
         self.run_command(
@@ -1045,8 +1031,7 @@ class ShellTest(utils.TestCase):
1045 1031
             ' --fixed-ips=5')
1046 1032
         self.assert_called(
1047 1033
             'PUT', '/os-quota-sets/97f4c221bff44578b0300df4ef119353',
1048
-            {'quota_set': {'force': False,
1049
-                           'fixed_ips': 5,
1034
+            {'quota_set': {'fixed_ips': 5,
1050 1035
                            'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
1051 1036
 
1052 1037
     def test_quota_class_show(self):

Loading…
Cancel
Save