diff --git a/doc/source/cli/nova.rst b/doc/source/cli/nova.rst index 712a5ec1f..bf919d4b8 100644 --- a/doc/source/cli/nova.rst +++ b/doc/source/cli/nova.rst @@ -108,13 +108,6 @@ nova usage ``boot`` Boot a new server. -``cell-capacities`` - Get cell capacities for all cells or a given - cell. - -``cell-show`` - Show details of a given cell. - ``clear-password`` Clear the admin password for a server from the metadata server. This action does not actually @@ -309,10 +302,6 @@ nova usage ``list`` List servers. -``list-extensions`` - List all the os-api extensions that are - available. - ``list-secgroup`` List Security Group(s) of a server. @@ -1131,38 +1120,6 @@ quality of service support, microversion ``2.72`` is required. Requested hypervisor hostname to create servers. Admin only by default. (Supported by API versions '2.74' - '2.latest') -.. _nova_cell-capacities: - -nova cell-capacities --------------------- - -.. code-block:: console - - usage: nova cell-capacities [--cell ] - -Get cell capacities for all cells or a given cell. - -**Optional arguments:** - -``--cell `` - Name of the cell to get the capacities. - -.. _nova_cell-show: - -nova cell-show --------------- - -.. code-block:: console - - usage: nova cell-show - -Show details of a given cell. - -**Positional arguments:** - -```` - Name of the cell. - .. _nova_clear-password: nova clear-password @@ -2372,18 +2329,6 @@ present in the failure domain. unlocked servers. (Supported by API versions '2.73' - '2.latest') - -.. _nova_list-extensions: - -nova list-extensions --------------------- - -.. code-block:: console - - usage: nova list-extensions - -List all the os-api extensions that are available. - .. _nova_list-secgroup: nova list-secgroup diff --git a/novaclient/tests/functional/v2/legacy/test_readonly_nova.py b/novaclient/tests/functional/v2/legacy/test_readonly_nova.py index 7f81e41ae..ed002c50b 100644 --- a/novaclient/tests/functional/v2/legacy/test_readonly_nova.py +++ b/novaclient/tests/functional/v2/legacy/test_readonly_nova.py @@ -85,13 +85,6 @@ class SimpleReadOnlyNovaClientTest(base.ClientTestBase): def test_admin_help(self): self.nova('help') - def test_admin_list_extensions(self): - output = self.nova('list-extensions', merge_stderr=True) - self.assertIn( - 'The API extension interface has been deprecated. This command ' - 'will be removed in the first major release after ' - 'the Nova server 20.0.0 Train release.', output) - def test_agent_list(self): self.nova('agent-list') self.nova('agent-list', flags='--debug') diff --git a/novaclient/tests/unit/v2/fakes.py b/novaclient/tests/unit/v2/fakes.py index dd60d7f4a..3430679be 100644 --- a/novaclient/tests/unit/v2/fakes.py +++ b/novaclient/tests/unit/v2/fakes.py @@ -328,53 +328,6 @@ class FakeSessionClient(base_client.SessionClient): "md5hash": "add6bb58e139be103324d04d82d8f546", 'id': 1}}) - # - # List all extensions - # - - def get_extensions(self, **kw): - exts = [ - { - "alias": "NMN", - "description": "Multiple network support", - "links": [], - "name": "Multinic", - "namespace": ("http://docs.openstack.org/" - "compute/ext/multinic/api/v1.1"), - "updated": "2011-06-09T00:00:00+00:00" - }, - { - "alias": "OS-DCF", - "description": "Disk Management Extension", - "links": [], - "name": "DiskConfig", - "namespace": ("http://docs.openstack.org/" - "compute/ext/disk_config/api/v1.1"), - "updated": "2011-09-27T00:00:00+00:00" - }, - { - "alias": "OS-EXT-SRV-ATTR", - "description": "Extended Server Attributes support.", - "links": [], - "name": "ExtendedServerAttributes", - "namespace": ("http://docs.openstack.org/" - "compute/ext/extended_status/api/v1.1"), - "updated": "2011-11-03T00:00:00+00:00" - }, - { - "alias": "OS-EXT-STS", - "description": "Extended Status support", - "links": [], - "name": "ExtendedStatus", - "namespace": ("http://docs.openstack.org/" - "compute/ext/extended_status/api/v1.1"), - "updated": "2011-11-03T00:00:00+00:00" - }, - ] - return (200, FAKE_RESPONSE_HEADERS, { - "extensions": exts, - }) - # # Limits # @@ -2296,34 +2249,6 @@ class FakeSessionClient(base_client.SessionClient): def post_servers_uuid6_action(self, **kw): return 202, {}, {} - def get_os_cells_child_cell(self, **kw): - cell = {'cell': { - 'username': 'cell1_user', - 'name': 'cell1', - 'rpc_host': '10.0.1.10', - 'info': { - 'username': 'cell1_user', - 'rpc_host': '10.0.1.10', - 'type': 'child', - 'name': 'cell1', - 'rpc_port': 5673}, - 'type': 'child', - 'rpc_port': 5673, - 'loaded': True - }} - return (200, FAKE_RESPONSE_HEADERS, cell) - - def get_os_cells_capacities(self, **kw): - cell_capacities_response = {"cell": {"capacities": {"ram_free": { - "units_by_mb": {"8192": 0, "512": 13, "4096": 1, "2048": 3, - "16384": 0}, "total_mb": 7680}, "disk_free": { - "units_by_mb": {"81920": 11, "20480": 46, "40960": 23, "163840": 5, - "0": 0}, "total_mb": 1052672}}}} - return (200, FAKE_RESPONSE_HEADERS, cell_capacities_response) - - def get_os_cells_child_cell_capacities(self, **kw): - return self.get_os_cells_capacities() - def get_os_migrations(self, **kw): migration1 = { "created_at": "2012-10-29T13:42:02.000000", diff --git a/novaclient/tests/unit/v2/test_cells.py b/novaclient/tests/unit/v2/test_cells.py deleted file mode 100644 index ff898f532..000000000 --- a/novaclient/tests/unit/v2/test_cells.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2013 Rackspace Hosting -# 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. - -import mock - -from novaclient import api_versions -from novaclient.tests.unit import utils -from novaclient.tests.unit.v2 import fakes - -CELL_V1_DEPRECATION_WARNING = ( - 'The cells v1 interface has been deprecated in Nova since 16.0.0 Pike ' - 'Release. This API binding will be removed in the first major release ' - 'after the Nova server 20.0.0 Train release.') - - -@mock.patch('warnings.warn') -class CellsExtensionTests(utils.TestCase): - def setUp(self): - super(CellsExtensionTests, self).setUp() - self.cs = fakes.FakeClient(api_versions.APIVersion("2.1")) - - def test_get_cells(self, mock_warn): - cell_name = 'child_cell' - cell = self.cs.cells.get(cell_name) - self.assert_request_id(cell, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('GET', '/os-cells/%s' % cell_name) - mock_warn.assert_called_once_with(CELL_V1_DEPRECATION_WARNING, - DeprecationWarning) - - def test_get_capacities_for_a_given_cell(self, mock_warn): - cell_name = 'child_cell' - ca = self.cs.cells.capacities(cell_name) - self.assert_request_id(ca, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('GET', '/os-cells/%s/capacities' % cell_name) - mock_warn.assert_called_once_with(CELL_V1_DEPRECATION_WARNING, - DeprecationWarning) - - def test_get_capacities_for_all_cells(self, mock_warn): - ca = self.cs.cells.capacities() - self.assert_request_id(ca, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('GET', '/os-cells/capacities') - mock_warn.assert_called_once_with(CELL_V1_DEPRECATION_WARNING, - DeprecationWarning) diff --git a/novaclient/tests/unit/v2/test_list_extensions.py b/novaclient/tests/unit/v2/test_list_extensions.py deleted file mode 100644 index de299cd01..000000000 --- a/novaclient/tests/unit/v2/test_list_extensions.py +++ /dev/null @@ -1,41 +0,0 @@ -# -# 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. - -import mock - -from novaclient import api_versions -from novaclient.tests.unit import utils -from novaclient.tests.unit.v2 import fakes - - -class ListExtensionsTests(utils.TestCase): - def setUp(self): - super(ListExtensionsTests, self).setUp() - self.cs = fakes.FakeClient(api_versions.APIVersion("2.1")) - - @mock.patch('warnings.warn') - def test_list_extensions(self, mock_warn): - all_exts = self.cs.list_extensions.show_all() - self.assert_request_id(all_exts, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('GET', '/extensions') - self.assertGreater(len(all_exts), 0) - warning_message = ( - 'The API extension interface has been deprecated since 12.0.0 ' - 'Liberty Release. This API binding will be removed in the first ' - 'major release after the Nova server 20.0.0 Train release.') - mock_warn.assert_called_once_with(warning_message, DeprecationWarning) - for r in all_exts: - mock_warn.reset_mock() - self.assertGreater(len(r.summary), 0) - mock_warn.assert_called_once_with(warning_message, - DeprecationWarning) diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index 48b77b224..06b27ad39 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -3992,30 +3992,6 @@ class ShellTest(utils.TestCase): self.assert_called('GET', '/os-instance_usage_audit_log' '/2016-12-10%2013%3A59%3A59.999999') - def test_cell_show(self): - _, err = self.run_command('cell-show child_cell') - self.assert_called('GET', '/os-cells/child_cell') - self.assertIn( - 'The cells v1 interface has been deprecated. This command will be ' - 'removed in the first major release after the Nova server 20.0.0 ' - 'Train release.', err) - - def test_cell_capacities_with_cell_name(self): - _, err = self.run_command('cell-capacities --cell child_cell') - self.assert_called('GET', '/os-cells/child_cell/capacities') - self.assertIn( - 'The cells v1 interface has been deprecated. This command will be ' - 'removed in the first major release after the Nova server 20.0.0 ' - 'Train release.', err) - - def test_cell_capacities_without_cell_name(self): - _, err = self.run_command('cell-capacities') - self.assert_called('GET', '/os-cells/capacities') - self.assertIn( - 'The cells v1 interface has been deprecated. This command will be ' - 'removed in the first major release after the Nova server 20.0.0 ' - 'Train release.', err) - def test_migration_list(self): self.run_command('migration-list') self.assert_called('GET', '/os-migrations') diff --git a/novaclient/v2/cells.py b/novaclient/v2/cells.py deleted file mode 100644 index 44cadddbf..000000000 --- a/novaclient/v2/cells.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2013 Rackspace Hosting -# 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. - -import warnings - -from novaclient import base -from novaclient.i18n import _ - -CELL_V1_DEPRECATION_WARNING = _( - 'The cells v1 interface has been deprecated in Nova since 16.0.0 Pike ' - 'Release. This API binding will be removed in the first major release ' - 'after the Nova server 20.0.0 Train release.') - - -class Cell(base.Resource): - """DEPRECATED""" - def __repr__(self): - return "" % self.name - - -class CellsManager(base.Manager): - """DEPRECATED""" - resource_class = Cell - - def get(self, cell_name): - """ - DEPRECATED Get a cell. - - :param cell_name: Name of the :class:`Cell` to get. - :rtype: :class:`Cell` - """ - warnings.warn(CELL_V1_DEPRECATION_WARNING, DeprecationWarning) - return self._get("/os-cells/%s" % cell_name, "cell") - - def capacities(self, cell_name=None): - """ - DEPRECATED Get capacities for a cell. - - :param cell_name: Name of the :class:`Cell` to get capacities for. - :rtype: :class:`Cell` - """ - warnings.warn(CELL_V1_DEPRECATION_WARNING, DeprecationWarning) - path = ["%s/capacities" % cell_name, "capacities"][cell_name is None] - return self._get("/os-cells/%s" % path, "cell") diff --git a/novaclient/v2/client.py b/novaclient/v2/client.py index cec9f2f65..dc1701169 100644 --- a/novaclient/v2/client.py +++ b/novaclient/v2/client.py @@ -22,7 +22,6 @@ from novaclient.v2 import agents from novaclient.v2 import aggregates from novaclient.v2 import assisted_volume_snapshots from novaclient.v2 import availability_zones -from novaclient.v2 import cells from novaclient.v2 import flavor_access from novaclient.v2 import flavors from novaclient.v2 import hypervisors @@ -31,7 +30,6 @@ from novaclient.v2 import instance_action from novaclient.v2 import instance_usage_audit_log from novaclient.v2 import keypairs from novaclient.v2 import limits -from novaclient.v2 import list_extensions from novaclient.v2 import migrations from novaclient.v2 import networks from novaclient.v2 import quota_classes @@ -167,11 +165,9 @@ class Client(object): # deprecated now, which is why it is not initialized by default. self.assisted_volume_snapshots = \ assisted_volume_snapshots.AssistedSnapshotManager(self) - self.cells = cells.CellsManager(self) self.instance_action = instance_action.InstanceActionManager(self) self.instance_usage_audit_log = \ instance_usage_audit_log.InstanceUsageAuditLogManager(self) - self.list_extensions = list_extensions.ListExtManager(self) self.migrations = migrations.MigrationManager(self) self.server_external_events = \ server_external_events.ServerExternalEventManager(self) diff --git a/novaclient/v2/list_extensions.py b/novaclient/v2/list_extensions.py deleted file mode 100644 index e7043e31b..000000000 --- a/novaclient/v2/list_extensions.py +++ /dev/null @@ -1,50 +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. - -import warnings - -from novaclient import base -from novaclient.i18n import _ - -EXTENSION_DEPRECATION_WARNING = _( - 'The API extension interface has been deprecated since 12.0.0 Liberty ' - 'Release. This API binding will be removed in the first major release ' - 'after the Nova server 20.0.0 Train release.') - - -class ListExtResource(base.Resource): - """DEPRECATED""" - @property - def summary(self): - """DEPRECATED""" - warnings.warn(EXTENSION_DEPRECATION_WARNING, DeprecationWarning) - descr = self.description.strip() - if not descr: - return '??' - lines = descr.split("\n") - if len(lines) == 1: - return lines[0] - else: - return lines[0] + "..." - - -class ListExtManager(base.Manager): - """DEPRECATED""" - resource_class = ListExtResource - - def show_all(self): - """DEPRECATED""" - warnings.warn(EXTENSION_DEPRECATION_WARNING, DeprecationWarning) - return self._list("/extensions", 'extensions') diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 772942e96..3d7ba896d 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -48,21 +48,6 @@ from novaclient.v2 import servers logger = logging.getLogger(__name__) -CELL_V1_DEPRECATION_WARNING = _( - 'The cells v1 interface has been deprecated. This command will be removed ' - 'in the first major release after the Nova server 20.0.0 Train release.') - -EXTENSION_DEPRECATION_WARNING = _( - 'The API extension interface has been deprecated. This command will be ' - 'removed in the first major release after the Nova server 20.0.0 Train ' - 'release.') - - -# NOTE(takashin): Remove this along with the deprecated commands in the first -# major python-novaclient release AFTER the nova server 20.0.0 Train release. -def _emit_deprecation_warning(message): - print(message, file=sys.stderr) - def emit_duplicated_image_with_warning(img, image_with): img_uuid_list = [str(image.id) for image in img] @@ -4928,35 +4913,6 @@ def do_server_tag_delete_all(cs, args): server.delete_all_tags() -@utils.arg( - 'cell', - metavar='', - help=_('Name of the cell.')) -def do_cell_show(cs, args): - """DEPRECATED Show details of a given cell.""" - _emit_deprecation_warning(CELL_V1_DEPRECATION_WARNING) - cell = cs.cells.get(args.cell) - utils.print_dict(cell.to_dict()) - - -@utils.arg( - '--cell', - metavar='', - help=_("Name of the cell to get the capacities."), - default=None) -def do_cell_capacities(cs, args): - """DEPRECATED Get cell capacities for all cells or a given cell.""" - _emit_deprecation_warning(CELL_V1_DEPRECATION_WARNING) - cell = cs.cells.capacities(args.cell) - print(_("Ram Available: %s MiB") % cell.capacities['ram_free']['total_mb']) - utils.print_dict(cell.capacities['ram_free']['units_by_mb'], - dict_property='Ram(MiB)', dict_value="Units") - print(_("\nDisk Available: %s MiB") % - cell.capacities['disk_free']['total_mb']) - utils.print_dict(cell.capacities['disk_free']['units_by_mb'], - dict_property='Disk(MiB)', dict_value="Units") - - @utils.arg('server', metavar='', help='Name or ID of server.') def do_force_delete(cs, args): """Force delete a server.""" @@ -5378,16 +5334,6 @@ def do_instance_action_list(cs, args): sortby_index=3) -def do_list_extensions(cs, _args): - """ - DEPRECATED List all the os-api extensions that are available. - """ - _emit_deprecation_warning(EXTENSION_DEPRECATION_WARNING) - extensions = cs.list_extensions.show_all() - fields = ["Name", "Summary", "Alias", "Updated"] - utils.print_list(extensions, fields) - - @utils.arg('host', metavar='', help='The hypervisor hostname (or pattern) to search for. ' 'WARNING: Use a fully qualified domain name if you only ' diff --git a/releasenotes/notes/remove-deprecated-cellsv1-extentions-commands-4b26c826ad5194ca.yaml b/releasenotes/notes/remove-deprecated-cellsv1-extentions-commands-4b26c826ad5194ca.yaml new file mode 100644 index 000000000..eb452452e --- /dev/null +++ b/releasenotes/notes/remove-deprecated-cellsv1-extentions-commands-4b26c826ad5194ca.yaml @@ -0,0 +1,8 @@ +--- +upgrade: + - | + The following CLIs and their backing API bindings have been removed. + + - ``nova list-extensions`` + - ``nova cell-capacities`` + - ``nova cell-show``