From ff815fb4d01a3fe69a036293ddb899dbc6d99df0 Mon Sep 17 00:00:00 2001
From: shihanzhang <shihanzhang@huawei.com>
Date: Tue, 11 Feb 2014 14:50:54 +0800
Subject: [PATCH] Remove invalid parameter of quota-update

nova quota-update doesn't support update '--gigabytes' and '--volumes', but
CLI  include these two parameter, so it should remove these two parameter
from novaclient

Change-Id: I9db39dd397ba3368f214377f37b56ac4f4f3864c
Closes-bug: #1277673
---
 novaclient/tests/v1_1/fakes.py       | 16 ----------------
 novaclient/tests/v1_1/test_quotas.py | 23 -----------------------
 novaclient/tests/v3/fakes.py         |  2 --
 novaclient/v1_1/shell.py             | 18 +-----------------
 novaclient/v3/shell.py               | 18 +-----------------
 5 files changed, 2 insertions(+), 75 deletions(-)

diff --git a/novaclient/tests/v1_1/fakes.py b/novaclient/tests/v1_1/fakes.py
index aa8f2414a..594a9f2d4 100644
--- a/novaclient/tests/v1_1/fakes.py
+++ b/novaclient/tests/v1_1/fakes.py
@@ -1036,8 +1036,6 @@ class FakeHTTPClient(base_client.HTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 1,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
@@ -1053,8 +1051,6 @@ class FakeHTTPClient(base_client.HTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 1,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
@@ -1070,8 +1066,6 @@ class FakeHTTPClient(base_client.HTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 1,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
@@ -1087,8 +1081,6 @@ class FakeHTTPClient(base_client.HTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 1,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
@@ -1104,8 +1096,6 @@ class FakeHTTPClient(base_client.HTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 1,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
@@ -1121,8 +1111,6 @@ class FakeHTTPClient(base_client.HTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 1,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
@@ -1138,8 +1126,6 @@ class FakeHTTPClient(base_client.HTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 1,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
@@ -1158,8 +1144,6 @@ class FakeHTTPClient(base_client.HTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 2,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
diff --git a/novaclient/tests/v1_1/test_quotas.py b/novaclient/tests/v1_1/test_quotas.py
index 1c679389e..06d7461d3 100644
--- a/novaclient/tests/v1_1/test_quotas.py
+++ b/novaclient/tests/v1_1/test_quotas.py
@@ -42,20 +42,6 @@ class QuotaSetsTest(utils.TestCase):
         self.cs.quotas.defaults(tenant_id)
         self.cs.assert_called('GET', '/os-quota-sets/%s/defaults' % tenant_id)
 
-    def test_update_quota(self):
-        q = self.cs.quotas.get('97f4c221bff44578b0300df4ef119353')
-        q.update(volumes=2)
-        self.cs.assert_called('PUT',
-                   '/os-quota-sets/97f4c221bff44578b0300df4ef119353')
-
-    def test_update_user_quota(self):
-        tenant_id = '97f4c221bff44578b0300df4ef119353'
-        user_id = 'fake_user'
-        q = self.cs.quotas.get(tenant_id)
-        q.update(volumes=2, user_id=user_id)
-        url = '/os-quota-sets/%s?user_id=%s' % (tenant_id, user_id)
-        self.cs.assert_called('PUT', url)
-
     def test_force_update_quota(self):
         q = self.cs.quotas.get('97f4c221bff44578b0300df4ef119353')
         q.update(cores=2, force=True)
@@ -65,15 +51,6 @@ class QuotaSetsTest(utils.TestCase):
                            'cores': 2,
                            'tenant_id': '97f4c221bff44578b0300df4ef119353'}})
 
-    def test_refresh_quota(self):
-        q = self.cs.quotas.get('test')
-        q2 = self.cs.quotas.get('test')
-        self.assertEqual(q.volumes, q2.volumes)
-        q2.volumes = 0
-        self.assertNotEqual(q.volumes, q2.volumes)
-        q2.get()
-        self.assertEqual(q.volumes, q2.volumes)
-
     def test_quotas_delete(self):
         tenant_id = 'test'
         self.cs.quotas.delete(tenant_id)
diff --git a/novaclient/tests/v3/fakes.py b/novaclient/tests/v3/fakes.py
index 60063f3e9..1013910fc 100644
--- a/novaclient/tests/v3/fakes.py
+++ b/novaclient/tests/v3/fakes.py
@@ -300,8 +300,6 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
                       'metadata_items': [],
                       'injected_file_content_bytes': 1,
                       'injected_file_path_bytes': 1,
-                      'volumes': 2,
-                      'gigabytes': 1,
                       'ram': 1,
                       'floating_ips': 1,
                       'instances': 1,
diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py
index 9fee3ebbe..af26be311 100644
--- a/novaclient/v1_1/shell.py
+++ b/novaclient/v1_1/shell.py
@@ -3065,7 +3065,7 @@ def do_ssh(cs, args):
         return
 
 
-_quota_resources = ['instances', 'cores', 'ram', 'volumes', 'gigabytes',
+_quota_resources = ['instances', 'cores', 'ram',
                     'floating_ips', 'fixed_ips', 'metadata_items',
                     'injected_files', 'injected_file_content_bytes',
                     'injected_file_path_bytes', 'key_pairs',
@@ -3157,14 +3157,6 @@ def do_quota_defaults(cs, args):
            metavar='<ram>',
            type=int, default=None,
            help='New value for the "ram" quota.')
-@utils.arg('--volumes',
-           metavar='<volumes>',
-           type=int, default=None,
-           help='New value for the "volumes" quota.')
-@utils.arg('--gigabytes',
-           metavar='<gigabytes>',
-           type=int, default=None,
-           help='New value for the "gigabytes" quota.')
 @utils.arg('--floating-ips',
     metavar='<floating-ips>',
     type=int,
@@ -3272,14 +3264,6 @@ def do_quota_class_show(cs, args):
            metavar='<ram>',
            type=int, default=None,
            help='New value for the "ram" quota.')
-@utils.arg('--volumes',
-           metavar='<volumes>',
-           type=int, default=None,
-           help='New value for the "volumes" quota.')
-@utils.arg('--gigabytes',
-           metavar='<gigabytes>',
-           type=int, default=None,
-           help='New value for the "gigabytes" quota.')
 @utils.arg('--floating-ips',
     metavar='<floating-ips>',
     type=int,
diff --git a/novaclient/v3/shell.py b/novaclient/v3/shell.py
index 7b0dcfee1..9854c1e6a 100644
--- a/novaclient/v3/shell.py
+++ b/novaclient/v3/shell.py
@@ -2618,7 +2618,7 @@ def do_ssh(cs, args):
         return
 
 
-_quota_resources = ['instances', 'cores', 'ram', 'volumes', 'gigabytes',
+_quota_resources = ['instances', 'cores', 'ram',
                     'fixed_ips', 'metadata_items', 'key_pairs']
 
 
@@ -2718,14 +2718,6 @@ def do_quota_defaults(cs, args):
            metavar='<ram>',
            type=int, default=None,
            help='New value for the "ram" quota.')
-@utils.arg('--volumes',
-           metavar='<volumes>',
-           type=int, default=None,
-           help='New value for the "volumes" quota.')
-@utils.arg('--gigabytes',
-           metavar='<gigabytes>',
-           type=int, default=None,
-           help='New value for the "gigabytes" quota.')
 @utils.arg('--fixed-ips',
     metavar='<fixed-ips>',
     type=int,
@@ -2789,14 +2781,6 @@ def do_quota_class_show(cs, args):
            metavar='<ram>',
            type=int, default=None,
            help='New value for the "ram" quota.')
-@utils.arg('--volumes',
-           metavar='<volumes>',
-           type=int, default=None,
-           help='New value for the "volumes" quota.')
-@utils.arg('--gigabytes',
-           metavar='<gigabytes>',
-           type=int, default=None,
-           help='New value for the "gigabytes" quota.')
 @utils.arg('--metadata-items',
     metavar='<metadata-items>',
     type=int,