From 40bf06023314792f49c931c5a42b3f4e4be81b8e Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 11 Jan 2018 15:59:16 -0500 Subject: [PATCH] Remove deprecated MigrationManager.list cell_name kwarg The cell_name kwarg was deprecated in Pike: I54468682d5391668a513e708e26bc3c165c95ca1 And the CLI option was removed earlier in Queens (not yet released): I5d11eda2a6b35de98f0484492f597a87df882013 But that change forgot about the python API binding code so this change removes that as well and updates the release note. Change-Id: I0cf808eaf7df80e221b412d2374b81fd402bd037 Closes-Bug: #1668743 --- novaclient/tests/unit/v2/test_migrations.py | 20 ++++--------------- novaclient/v2/migrations.py | 11 +--------- novaclient/v2/shell.py | 2 +- ...ated-option-in-9.0.0-bc76629d28f1d4c4.yaml | 3 +++ 4 files changed, 9 insertions(+), 27 deletions(-) diff --git a/novaclient/tests/unit/v2/test_migrations.py b/novaclient/tests/unit/v2/test_migrations.py index 408909cda..4054012fe 100644 --- a/novaclient/tests/unit/v2/test_migrations.py +++ b/novaclient/tests/unit/v2/test_migrations.py @@ -10,8 +10,6 @@ # 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 @@ -40,33 +38,23 @@ class MigrationsTest(utils.TestCase): self.assertIsInstance(m, migrations.Migration) self.assertEqual(m.migration_type, 'live-migration') - @mock.patch('novaclient.v2.migrations.warnings.warn') - def test_list_migrations_with_cell_name(self, mock_warn): - ml = self.cs.migrations.list(cell_name="abc") - self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST) - self.cs.assert_called('GET', '/os-migrations?cell_name=abc') - for m in ml: - self.assertIsInstance(m, migrations.Migration) - self.assertTrue(mock_warn.called) - def test_list_migrations_with_filters(self): - ml = self.cs.migrations.list('host1', 'finished', 'child1') + ml = self.cs.migrations.list('host1', 'finished') self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST) self.cs.assert_called( 'GET', - '/os-migrations?cell_name=child1&host=host1&status=finished') + '/os-migrations?host=host1&status=finished') for m in ml: self.assertIsInstance(m, migrations.Migration) def test_list_migrations_with_instance_uuid_filter(self): - ml = self.cs.migrations.list('host1', 'finished', 'child1', - 'instance_id_456') + ml = self.cs.migrations.list('host1', 'finished', 'instance_id_456') self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST) self.cs.assert_called( 'GET', - ('/os-migrations?cell_name=child1&host=host1&' + ('/os-migrations?host=host1&' 'instance_uuid=instance_id_456&status=finished')) self.assertEqual(1, len(ml)) self.assertEqual('instance_id_456', ml[0].instance_uuid) diff --git a/novaclient/v2/migrations.py b/novaclient/v2/migrations.py index d1562b711..10e8f37fb 100644 --- a/novaclient/v2/migrations.py +++ b/novaclient/v2/migrations.py @@ -15,9 +15,6 @@ migration interface """ from novaclient import base -from novaclient.i18n import _ - -import warnings class Migration(base.Resource): @@ -28,23 +25,17 @@ class Migration(base.Resource): class MigrationManager(base.ManagerWithFind): resource_class = Migration - def list(self, host=None, status=None, cell_name=None, instance_uuid=None): + def list(self, host=None, status=None, instance_uuid=None): """ Get a list of migrations. :param host: (optional) filter migrations by host name. :param status: (optional) filter migrations by status. - :param cell_name: (optional) filter migrations for a cell. """ opts = {} if host: opts['host'] = host if status: opts['status'] = status - if cell_name: - warnings.warn(_("Argument 'cell_name' is " - "deprecated since Pike, and will " - "be removed in a future release.")) - opts['cell_name'] = cell_name if instance_uuid: opts['instance_uuid'] = instance_uuid diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 7976adf88..d7dba3e20 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -5212,6 +5212,6 @@ def _print_migrations(cs, migrations): help=_('Fetch migrations for the given status.')) def do_migration_list(cs, args): """Print a list of migrations.""" - migrations = cs.migrations.list(args.host, args.status, None, + migrations = cs.migrations.list(args.host, args.status, instance_uuid=args.instance_uuid) _print_migrations(cs, migrations) diff --git a/releasenotes/notes/remove-deprecated-option-in-9.0.0-bc76629d28f1d4c4.yaml b/releasenotes/notes/remove-deprecated-option-in-9.0.0-bc76629d28f1d4c4.yaml index 89d5afabc..a98272c80 100644 --- a/releasenotes/notes/remove-deprecated-option-in-9.0.0-bc76629d28f1d4c4.yaml +++ b/releasenotes/notes/remove-deprecated-option-in-9.0.0-bc76629d28f1d4c4.yaml @@ -6,3 +6,6 @@ upgrade: - ``--tenant`` (from ``flavor access list``) - ``--cell_name`` (from ``migration list``) - ``--volume-service-name`` (global option) + + As a result, the ``novaclient.v2.migrations.MigrationManager.list`` + python API binding method no longer takes a ``cell_name`` kwarg.