Skip to content

Commit f3d535b

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "Remove deprecated nova-manage vm list command"
2 parents 36030a7 + 94a28d3 commit f3d535b

File tree

4 files changed

+6
-102
lines changed

4 files changed

+6
-102
lines changed

doc/source/man/nova-manage.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,6 @@ Nova Images
177177

178178
Converts all images in directory from the old (Bexar) format to the new format.
179179

180-
Nova VM
181-
~~~~~~~~~~~
182-
183-
**DEPRECATED** Use the nova list command from python-novaclient instead.
184-
The vm subcommand will be removed in the 15.0.0 Ocata release.
185-
186-
``nova-manage vm list [host]``
187-
Show a list of all instances. Accepts optional hostname (to show only instances on specific host).
188-
189-
190180
SEE ALSO
191181
========
192182

nova/cmd/manage.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -708,55 +708,6 @@ def modify(self, fixed_range, project=None, host=None,
708708
db.network_update(admin_context, network['id'], net)
709709

710710

711-
class VmCommands(object):
712-
"""Class for managing VM instances."""
713-
714-
description = ('DEPRECATED: Use the nova list command from '
715-
'python-novaclient instead. The vm subcommand will be '
716-
'removed in the 15.0.0 Ocata release.')
717-
718-
@args('--host', metavar='<host>', help='Host')
719-
def list(self, host=None):
720-
"""DEPRECATED: Show a list of all instances."""
721-
722-
print(("%-10s %-15s %-10s %-10s %-26s %-9s %-9s %-9s"
723-
" %-10s %-10s %-10s %-5s" % (_('instance'),
724-
_('node'),
725-
_('type'),
726-
_('state'),
727-
_('launched'),
728-
_('image'),
729-
_('kernel'),
730-
_('ramdisk'),
731-
_('project'),
732-
_('user'),
733-
_('zone'),
734-
_('index'))))
735-
736-
if host is None:
737-
instances = objects.InstanceList.get_by_filters(
738-
context.get_admin_context(), {}, expected_attrs=['flavor'])
739-
else:
740-
instances = objects.InstanceList.get_by_host(
741-
context.get_admin_context(), host, expected_attrs=['flavor'])
742-
743-
for instance in instances:
744-
instance_type = instance.get_flavor()
745-
print(("%-10s %-15s %-10s %-10s %-26s %-9s %-9s %-9s"
746-
" %-10s %-10s %-10s %-5d" % (instance.display_name,
747-
instance.host,
748-
instance_type.name,
749-
instance.vm_state,
750-
instance.launched_at,
751-
instance.image_ref,
752-
instance.kernel_id,
753-
instance.ramdisk_id,
754-
instance.project_id,
755-
instance.user_id,
756-
instance.availability_zone,
757-
instance.launch_index or 0)))
758-
759-
760711
class HostCommands(object):
761712
"""List hosts."""
762713

@@ -1591,7 +1542,6 @@ def discover_hosts(self, cell_uuid=None):
15911542
'network': NetworkCommands,
15921543
'project': ProjectCommands,
15931544
'shell': ShellCommands,
1594-
'vm': VmCommands,
15951545
'vpn': VpnCommands,
15961546
}
15971547

nova/tests/unit/test_nova_manage.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
from nova import objects
3131
from nova import test
3232
from nova.tests.unit.db import fakes as db_fakes
33-
from nova.tests.unit import fake_flavor
34-
from nova.tests.unit import fake_instance
3533
from nova.tests.unit.objects import test_network
3634
from nova.tests import uuidsentinel
3735

@@ -422,46 +420,6 @@ def test_quota_usage_refresh_invalid_project_key(self):
422420
'ram'))
423421

424422

425-
class VmCommandsTestCase(test.NoDBTestCase):
426-
def setUp(self):
427-
super(VmCommandsTestCase, self).setUp()
428-
self.output = StringIO()
429-
self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output))
430-
self.commands = manage.VmCommands()
431-
self.context = context.get_admin_context()
432-
self.fake_flavor = fake_flavor.fake_flavor_obj(self.context)
433-
434-
def test_list_without_host(self):
435-
with mock.patch.object(objects.InstanceList, 'get_by_filters') as get:
436-
get.return_value = objects.InstanceList(
437-
objects=[fake_instance.fake_instance_obj(
438-
self.context, host='foo-host',
439-
flavor=self.fake_flavor,
440-
system_metadata={})])
441-
self.commands.list()
442-
443-
result = self.output.getvalue()
444-
445-
self.assertIn('node', result) # check the header line
446-
self.assertIn('fake_flavor', result) # flavor.name
447-
self.assertIn('foo-host', result)
448-
449-
def test_list_with_host(self):
450-
with mock.patch.object(objects.InstanceList, 'get_by_host') as get:
451-
get.return_value = objects.InstanceList(
452-
objects=[fake_instance.fake_instance_obj(
453-
self.context,
454-
flavor=self.fake_flavor,
455-
system_metadata={})])
456-
self.commands.list(host='fake-host')
457-
458-
result = self.output.getvalue()
459-
460-
self.assertIn('node', result) # check the header line
461-
self.assertIn('fake_flavor', result) # flavor.name
462-
self.assertIn('fake-host', result)
463-
464-
465423
class DBCommandsTestCase(test.NoDBTestCase):
466424
def setUp(self):
467425
super(DBCommandsTestCase, self).setUp()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
upgrade:
3+
- |
4+
The following deprecated nova-manage commands have been removed:
5+
6+
* nova-manage vm list

0 commit comments

Comments
 (0)