From 94a28d346a5a65a653d1ea7ca9ec158724a1961d Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Tue, 18 Oct 2016 10:48:13 -0400 Subject: [PATCH] Remove deprecated nova-manage vm list command The nova-manage vm list command was deprecated in newton with change: 5a5b06fb24fc6e392eb5381f1348e475f1302e1e Change-Id: I9b7a791b5b5a4c3375fcbfac081ba6bc40c84d6d --- doc/source/man/nova-manage.rst | 10 ---- nova/cmd/manage.py | 50 ------------------- nova/tests/unit/test_nova_manage.py | 42 ---------------- ...va-manage-cmds-ocata-bada0a4dbbc50eb6.yaml | 6 +++ 4 files changed, 6 insertions(+), 102 deletions(-) create mode 100644 releasenotes/notes/rm-deprecated-nova-manage-cmds-ocata-bada0a4dbbc50eb6.yaml diff --git a/doc/source/man/nova-manage.rst b/doc/source/man/nova-manage.rst index 9abd4bbfe57c..c22f84e72d59 100644 --- a/doc/source/man/nova-manage.rst +++ b/doc/source/man/nova-manage.rst @@ -177,16 +177,6 @@ Nova Images Converts all images in directory from the old (Bexar) format to the new format. -Nova VM -~~~~~~~~~~~ - -**DEPRECATED** Use the nova list command from python-novaclient instead. -The vm subcommand will be removed in the 15.0.0 Ocata release. - -``nova-manage vm list [host]`` - Show a list of all instances. Accepts optional hostname (to show only instances on specific host). - - SEE ALSO ======== diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index aee4c7c79cf1..2d39220cf235 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -708,55 +708,6 @@ class NetworkCommands(object): db.network_update(admin_context, network['id'], net) -class VmCommands(object): - """Class for managing VM instances.""" - - description = ('DEPRECATED: Use the nova list command from ' - 'python-novaclient instead. The vm subcommand will be ' - 'removed in the 15.0.0 Ocata release.') - - @args('--host', metavar='', help='Host') - def list(self, host=None): - """DEPRECATED: Show a list of all instances.""" - - print(("%-10s %-15s %-10s %-10s %-26s %-9s %-9s %-9s" - " %-10s %-10s %-10s %-5s" % (_('instance'), - _('node'), - _('type'), - _('state'), - _('launched'), - _('image'), - _('kernel'), - _('ramdisk'), - _('project'), - _('user'), - _('zone'), - _('index')))) - - if host is None: - instances = objects.InstanceList.get_by_filters( - context.get_admin_context(), {}, expected_attrs=['flavor']) - else: - instances = objects.InstanceList.get_by_host( - context.get_admin_context(), host, expected_attrs=['flavor']) - - for instance in instances: - instance_type = instance.get_flavor() - print(("%-10s %-15s %-10s %-10s %-26s %-9s %-9s %-9s" - " %-10s %-10s %-10s %-5d" % (instance.display_name, - instance.host, - instance_type.name, - instance.vm_state, - instance.launched_at, - instance.image_ref, - instance.kernel_id, - instance.ramdisk_id, - instance.project_id, - instance.user_id, - instance.availability_zone, - instance.launch_index or 0))) - - class HostCommands(object): """List hosts.""" @@ -1591,7 +1542,6 @@ CATEGORIES = { 'network': NetworkCommands, 'project': ProjectCommands, 'shell': ShellCommands, - 'vm': VmCommands, 'vpn': VpnCommands, } diff --git a/nova/tests/unit/test_nova_manage.py b/nova/tests/unit/test_nova_manage.py index e2521fd74c3f..fde43a5113e8 100644 --- a/nova/tests/unit/test_nova_manage.py +++ b/nova/tests/unit/test_nova_manage.py @@ -30,8 +30,6 @@ from nova import exception from nova import objects from nova import test from nova.tests.unit.db import fakes as db_fakes -from nova.tests.unit import fake_flavor -from nova.tests.unit import fake_instance from nova.tests.unit.objects import test_network from nova.tests import uuidsentinel @@ -422,46 +420,6 @@ class ProjectCommandsTestCase(test.TestCase): 'ram')) -class VmCommandsTestCase(test.NoDBTestCase): - def setUp(self): - super(VmCommandsTestCase, self).setUp() - self.output = StringIO() - self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output)) - self.commands = manage.VmCommands() - self.context = context.get_admin_context() - self.fake_flavor = fake_flavor.fake_flavor_obj(self.context) - - def test_list_without_host(self): - with mock.patch.object(objects.InstanceList, 'get_by_filters') as get: - get.return_value = objects.InstanceList( - objects=[fake_instance.fake_instance_obj( - self.context, host='foo-host', - flavor=self.fake_flavor, - system_metadata={})]) - self.commands.list() - - result = self.output.getvalue() - - self.assertIn('node', result) # check the header line - self.assertIn('fake_flavor', result) # flavor.name - self.assertIn('foo-host', result) - - def test_list_with_host(self): - with mock.patch.object(objects.InstanceList, 'get_by_host') as get: - get.return_value = objects.InstanceList( - objects=[fake_instance.fake_instance_obj( - self.context, - flavor=self.fake_flavor, - system_metadata={})]) - self.commands.list(host='fake-host') - - result = self.output.getvalue() - - self.assertIn('node', result) # check the header line - self.assertIn('fake_flavor', result) # flavor.name - self.assertIn('fake-host', result) - - class DBCommandsTestCase(test.NoDBTestCase): def setUp(self): super(DBCommandsTestCase, self).setUp() diff --git a/releasenotes/notes/rm-deprecated-nova-manage-cmds-ocata-bada0a4dbbc50eb6.yaml b/releasenotes/notes/rm-deprecated-nova-manage-cmds-ocata-bada0a4dbbc50eb6.yaml new file mode 100644 index 000000000000..a61809c50914 --- /dev/null +++ b/releasenotes/notes/rm-deprecated-nova-manage-cmds-ocata-bada0a4dbbc50eb6.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The following deprecated nova-manage commands have been removed: + + * nova-manage vm list