Remove quota-class subcommand
quota-classes API was already removed. Change-Id: I1110022d6f628d03aaf363da707f2d2ef1600437 This patch removed quota-class subcommand from nova client. Change-Id: I18bf7c255fabdb52c8ce8159f68c3e5c70e54993
This commit is contained in:
parent
427e346a7b
commit
7c11b06bd4
@ -1161,56 +1161,6 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
def delete_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, **kw):
|
||||
return (202, {}, {})
|
||||
|
||||
#
|
||||
# Quota Classes
|
||||
#
|
||||
|
||||
def get_os_quota_class_sets_test(self, **kw):
|
||||
return (200, {}, {'quota_class_set': {
|
||||
'id': 'test',
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def put_os_quota_class_sets_test(self, body, **kw):
|
||||
assert list(body) == ['quota_class_set']
|
||||
return (200, {}, {'quota_class_set': {
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def put_os_quota_class_sets_97f4c221bff44578b0300df4ef119353(self,
|
||||
body, **kw):
|
||||
assert list(body) == ['quota_class_set']
|
||||
return (200, {}, {'quota_class_set': {
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
#
|
||||
# Security Groups
|
||||
#
|
||||
|
@ -1,42 +0,0 @@
|
||||
# Copyright 2011 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from novaclient.tests import utils
|
||||
from novaclient.tests.v1_1 import fakes
|
||||
|
||||
|
||||
cs = fakes.FakeClient()
|
||||
|
||||
|
||||
class QuotaClassSetsTest(utils.TestCase):
|
||||
|
||||
def test_class_quotas_get(self):
|
||||
class_name = 'test'
|
||||
cs.quota_classes.get(class_name)
|
||||
cs.assert_called('GET', '/os-quota-class-sets/%s' % class_name)
|
||||
|
||||
def test_update_quota(self):
|
||||
q = cs.quota_classes.get('test')
|
||||
q.update(cores=2)
|
||||
cs.assert_called('PUT', '/os-quota-class-sets/test')
|
||||
|
||||
def test_refresh_quota(self):
|
||||
q = cs.quota_classes.get('test')
|
||||
q2 = cs.quota_classes.get('test')
|
||||
self.assertEqual(q.cores, q2.cores)
|
||||
q2.cores = 0
|
||||
self.assertNotEqual(q.cores, q2.cores)
|
||||
q2.get()
|
||||
self.assertEqual(q.cores, q2.cores)
|
@ -1507,17 +1507,6 @@ class ShellTest(utils.TestCase):
|
||||
self.assert_called('DELETE',
|
||||
'/os-quota-sets/97f4c221bff44578b0300df4ef119353?user_id=u1')
|
||||
|
||||
def test_quota_class_show(self):
|
||||
self.run_command('quota-class-show test')
|
||||
self.assert_called('GET', '/os-quota-class-sets/test')
|
||||
|
||||
def test_quota_class_update(self):
|
||||
self.run_command('quota-class-update 97f4c221bff44578b0300df4ef119353'
|
||||
' --instances=5')
|
||||
self.assert_called('PUT',
|
||||
'/os-quota-class-sets/97f4c221bff44578b0300'
|
||||
'df4ef119353')
|
||||
|
||||
def test_network_list(self):
|
||||
self.run_command('network-list')
|
||||
self.assert_called('GET', '/os-networks')
|
||||
|
@ -1,25 +0,0 @@
|
||||
# Copyright IBM Corp. 2013
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from novaclient.tests.v1_1 import test_quota_classes
|
||||
from novaclient.tests.v3 import fakes
|
||||
|
||||
|
||||
class QuotaClassSetsTest(test_quota_classes.QuotaClassSetsTest):
|
||||
def setUp(self):
|
||||
super(QuotaClassSetsTest, self).setUp()
|
||||
self.cs = self._get_fake_client()
|
||||
|
||||
def _get_fake_client(self):
|
||||
return fakes.FakeClient()
|
@ -33,7 +33,6 @@ from novaclient.v1_1 import images
|
||||
from novaclient.v1_1 import keypairs
|
||||
from novaclient.v1_1 import limits
|
||||
from novaclient.v1_1 import networks
|
||||
from novaclient.v1_1 import quota_classes
|
||||
from novaclient.v1_1 import quotas
|
||||
from novaclient.v1_1 import security_group_rules
|
||||
from novaclient.v1_1 import security_groups
|
||||
@ -99,7 +98,6 @@ class Client(object):
|
||||
self.volume_types = volume_types.VolumeTypeManager(self)
|
||||
self.keypairs = keypairs.KeypairManager(self)
|
||||
self.networks = networks.NetworkManager(self)
|
||||
self.quota_classes = quota_classes.QuotaClassSetManager(self)
|
||||
self.quotas = quotas.QuotaSetManager(self)
|
||||
self.security_groups = security_groups.SecurityGroupManager(self)
|
||||
self.security_group_rules = \
|
||||
|
@ -1,44 +0,0 @@
|
||||
# Copyright 2012 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from novaclient import base
|
||||
|
||||
|
||||
class QuotaClassSet(base.Resource):
|
||||
|
||||
def update(self, *args, **kwargs):
|
||||
return self.manager.update(self.id, *args, **kwargs)
|
||||
|
||||
|
||||
class QuotaClassSetManager(base.Manager):
|
||||
resource_class = QuotaClassSet
|
||||
|
||||
def get(self, class_name):
|
||||
return self._get("/os-quota-class-sets/%s" % (class_name),
|
||||
"quota_class_set")
|
||||
|
||||
def _update_body(self, **kwargs):
|
||||
return {'quota_class_set': kwargs}
|
||||
|
||||
def update(self, class_name, **kwargs):
|
||||
body = self._update_body(**kwargs)
|
||||
|
||||
for key in list(body['quota_class_set']):
|
||||
if body['quota_class_set'][key] is None:
|
||||
body['quota_class_set'].pop(key)
|
||||
|
||||
return self._update('/os-quota-class-sets/%s' % (class_name),
|
||||
body,
|
||||
'quota_class_set')
|
@ -3286,88 +3286,6 @@ def do_quota_delete(cs, args):
|
||||
cs.quotas.delete(args.tenant, user_id=args.user)
|
||||
|
||||
|
||||
@utils.arg('class_name',
|
||||
metavar='<class>',
|
||||
help=_('Name of quota class to list the quotas for.'))
|
||||
def do_quota_class_show(cs, args):
|
||||
"""List the quotas for a quota class."""
|
||||
|
||||
_quota_show(cs.quota_classes.get(args.class_name))
|
||||
|
||||
|
||||
@utils.arg('class_name',
|
||||
metavar='<class>',
|
||||
help=_('Name of quota class to set the quotas for.'))
|
||||
@utils.arg('--instances',
|
||||
metavar='<instances>',
|
||||
type=int, default=None,
|
||||
help=_('New value for the "instances" quota.'))
|
||||
@utils.arg('--cores',
|
||||
metavar='<cores>',
|
||||
type=int, default=None,
|
||||
help=_('New value for the "cores" quota.'))
|
||||
@utils.arg('--ram',
|
||||
metavar='<ram>',
|
||||
type=int, default=None,
|
||||
help=_('New value for the "ram" quota.'))
|
||||
@utils.arg('--floating-ips',
|
||||
metavar='<floating-ips>',
|
||||
type=int,
|
||||
default=None,
|
||||
help=_('New value for the "floating-ips" quota.'))
|
||||
@utils.arg('--floating_ips',
|
||||
type=int,
|
||||
help=argparse.SUPPRESS)
|
||||
@utils.arg('--metadata-items',
|
||||
metavar='<metadata-items>',
|
||||
type=int,
|
||||
default=None,
|
||||
help=_('New value for the "metadata-items" quota.'))
|
||||
@utils.arg('--metadata_items',
|
||||
type=int,
|
||||
help=argparse.SUPPRESS)
|
||||
@utils.arg('--injected-files',
|
||||
metavar='<injected-files>',
|
||||
type=int,
|
||||
default=None,
|
||||
help=_('New value for the "injected-files" quota.'))
|
||||
@utils.arg('--injected_files',
|
||||
type=int,
|
||||
help=argparse.SUPPRESS)
|
||||
@utils.arg('--injected-file-content-bytes',
|
||||
metavar='<injected-file-content-bytes>',
|
||||
type=int,
|
||||
default=None,
|
||||
help=_('New value for the "injected-file-content-bytes" quota.'))
|
||||
@utils.arg('--injected_file_content_bytes',
|
||||
type=int,
|
||||
help=argparse.SUPPRESS)
|
||||
@utils.arg('--injected-file-path-bytes',
|
||||
metavar='<injected-file-path-bytes>',
|
||||
type=int,
|
||||
default=None,
|
||||
help=_('New value for the "injected-file-path-bytes" quota.'))
|
||||
@utils.arg('--key-pairs',
|
||||
metavar='<key-pairs>',
|
||||
type=int,
|
||||
default=None,
|
||||
help=_('New value for the "key-pairs" quota.'))
|
||||
@utils.arg('--security-groups',
|
||||
metavar='<security-groups>',
|
||||
type=int,
|
||||
default=None,
|
||||
help=_('New value for the "security-groups" quota.'))
|
||||
@utils.arg('--security-group-rules',
|
||||
metavar='<security-group-rules>',
|
||||
type=int,
|
||||
default=None,
|
||||
help=_('New value for the "security-group-rules" quota.'))
|
||||
def do_quota_class_update(cs, args):
|
||||
"""Update the quotas for a quota class."""
|
||||
|
||||
_quota_update(cs.quota_classes, args.class_name, args)
|
||||
|
||||
|
||||
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
|
||||
@utils.arg('host', metavar='<host>', help=_('Name or ID of target host.'))
|
||||
@utils.arg('--password',
|
||||
|
@ -24,7 +24,6 @@ from novaclient.v3 import hosts
|
||||
from novaclient.v3 import hypervisors
|
||||
from novaclient.v3 import images
|
||||
from novaclient.v3 import keypairs
|
||||
from novaclient.v3 import quota_classes
|
||||
from novaclient.v3 import quotas
|
||||
from novaclient.v3 import servers
|
||||
from novaclient.v3 import services
|
||||
@ -76,7 +75,6 @@ class Client(object):
|
||||
self.images = images.ImageManager(self)
|
||||
self.keypairs = keypairs.KeypairManager(self)
|
||||
self.quotas = quotas.QuotaSetManager(self)
|
||||
self.quota_classes = quota_classes.QuotaClassSetManager(self)
|
||||
self.servers = servers.ServerManager(self)
|
||||
self.services = services.ServiceManager(self)
|
||||
self.usage = usage.UsageManager(self)
|
||||
|
@ -1,23 +0,0 @@
|
||||
# Copyright IBM Corp. 2013
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from novaclient.v1_1 import quota_classes
|
||||
|
||||
|
||||
class QuotaClassSet(quota_classes.QuotaClassSet):
|
||||
pass
|
||||
|
||||
|
||||
class QuotaClassSetManager(quota_classes.QuotaClassSetManager):
|
||||
resource_class = QuotaClassSet
|
@ -2777,49 +2777,6 @@ def do_quota_delete(cs, args):
|
||||
cs.quotas.delete(args.tenant)
|
||||
|
||||
|
||||
@utils.arg('class_name',
|
||||
metavar='<class>',
|
||||
help='Name of quota class to list the quotas for.')
|
||||
def do_quota_class_show(cs, args):
|
||||
"""List the quotas for a quota class."""
|
||||
|
||||
_quota_show(cs.quota_classes.get(args.class_name))
|
||||
|
||||
|
||||
@utils.arg('class_name',
|
||||
metavar='<class>',
|
||||
help='Name of quota class to set the quotas for.')
|
||||
@utils.arg('--instances',
|
||||
metavar='<instances>',
|
||||
type=int, default=None,
|
||||
help='New value for the "instances" quota.')
|
||||
@utils.arg('--cores',
|
||||
metavar='<cores>',
|
||||
type=int, default=None,
|
||||
help='New value for the "cores" quota.')
|
||||
@utils.arg('--ram',
|
||||
metavar='<ram>',
|
||||
type=int, default=None,
|
||||
help='New value for the "ram" quota.')
|
||||
@utils.arg('--metadata-items',
|
||||
metavar='<metadata-items>',
|
||||
type=int,
|
||||
default=None,
|
||||
help='New value for the "metadata-items" quota.')
|
||||
@utils.arg('--metadata_items',
|
||||
type=int,
|
||||
help=argparse.SUPPRESS)
|
||||
@utils.arg('--key-pairs',
|
||||
metavar='<key-pairs>',
|
||||
type=int,
|
||||
default=None,
|
||||
help='New value for the "key-pairs" quota.')
|
||||
def do_quota_class_update(cs, args):
|
||||
"""Update the quotas for a quota class."""
|
||||
|
||||
_quota_update(cs.quota_classes, args.class_name, args)
|
||||
|
||||
|
||||
@utils.arg('server', metavar='<server>', help='Name or ID of server.')
|
||||
@utils.arg('host', metavar='<host>', help='Name or ID of target host.')
|
||||
@utils.arg('--password',
|
||||
|
Loading…
x
Reference in New Issue
Block a user