Merge "Remove deprecated nova-manage vm list command"

This commit is contained in:
Jenkins
2016-10-19 15:40:52 +00:00
committed by Gerrit Code Review
4 changed files with 6 additions and 102 deletions

View File

@@ -177,16 +177,6 @@ Nova Images
Converts all images in directory from the old (Bexar) format to the new format. 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 SEE ALSO
======== ========

View File

@@ -708,55 +708,6 @@ class NetworkCommands(object):
db.network_update(admin_context, network['id'], net) 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='<host>', 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): class HostCommands(object):
"""List hosts.""" """List hosts."""
@@ -1591,7 +1542,6 @@ CATEGORIES = {
'network': NetworkCommands, 'network': NetworkCommands,
'project': ProjectCommands, 'project': ProjectCommands,
'shell': ShellCommands, 'shell': ShellCommands,
'vm': VmCommands,
'vpn': VpnCommands, 'vpn': VpnCommands,
} }

View File

@@ -30,8 +30,6 @@ from nova import exception
from nova import objects from nova import objects
from nova import test from nova import test
from nova.tests.unit.db import fakes as db_fakes 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.unit.objects import test_network
from nova.tests import uuidsentinel from nova.tests import uuidsentinel
@@ -422,46 +420,6 @@ class ProjectCommandsTestCase(test.TestCase):
'ram')) '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): class DBCommandsTestCase(test.NoDBTestCase):
def setUp(self): def setUp(self):
super(DBCommandsTestCase, self).setUp() super(DBCommandsTestCase, self).setUp()

View File

@@ -0,0 +1,6 @@
---
upgrade:
- |
The following deprecated nova-manage commands have been removed:
* nova-manage vm list