diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index 75d252b1ae37..7f0b9ef5cf58 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -44,7 +44,6 @@ import six.moves.urllib.parse as urlparse from sqlalchemy.engine import url as sqla_url from nova.api.ec2 import ec2utils -from nova import availability_zones from nova.cmd import common as cmd_common import nova.conf from nova import config @@ -380,34 +379,6 @@ class NetworkCommands(object): db.network_update(admin_context, network['id'], net) -class HostCommands(object): - """List hosts.""" - - # TODO(stephenfin): Remove this during the Queens cycle - description = ('DEPRECATED: The host commands are deprecated since ' - 'Pike as this information is available over the API. They ' - 'will be removed in an upcoming release.') - - def list(self, zone=None): - """Show a list of all physical hosts. Filter by zone. - args: [zone] - """ - print("%-25s\t%-15s" % (_('host'), - _('zone'))) - ctxt = context.get_admin_context() - services = db.service_get_all(ctxt) - services = availability_zones.set_availability_zones(ctxt, services) - if zone: - services = [s for s in services if s['availability_zone'] == zone] - hosts = [] - for srv in services: - if not [h for h in hosts if h['host'] == srv['host']]: - hosts.append(srv) - - for h in hosts: - print("%-25s\t%-15s" % (h['host'], h['availability_zone'])) - - class DbCommands(object): """Class for managing the main database.""" @@ -794,95 +765,6 @@ class ApiDbCommands(object): print(migration.db_version(database='api')) -class AgentBuildCommands(object): - """Class for managing agent builds.""" - - # TODO(stephenfin): Remove this during the Queens cycle - description = ('DEPRECATED: The agent commands are deprecated since ' - 'Pike as this information is available over the API. They ' - 'will be removed in an upcoming release.') - - @args('--os', metavar='', help='os') - @args('--architecture', dest='architecture', - metavar='', help='architecture') - @args('--version', metavar='', help='version') - @args('--url', metavar='', help='url') - @args('--md5hash', metavar='', help='md5hash') - @args('--hypervisor', metavar='', - help='hypervisor(default: xen)') - def create(self, os, architecture, version, url, md5hash, - hypervisor='xen'): - """Creates a new agent build.""" - ctxt = context.get_admin_context() - db.agent_build_create(ctxt, {'hypervisor': hypervisor, - 'os': os, - 'architecture': architecture, - 'version': version, - 'url': url, - 'md5hash': md5hash}) - - @args('--os', metavar='', help='os') - @args('--architecture', dest='architecture', - metavar='', help='architecture') - @args('--hypervisor', metavar='', - help='hypervisor(default: xen)') - def delete(self, os, architecture, hypervisor='xen'): - """Deletes an existing agent build.""" - ctxt = context.get_admin_context() - agent_build_ref = db.agent_build_get_by_triple(ctxt, - hypervisor, os, architecture) - db.agent_build_destroy(ctxt, agent_build_ref['id']) - - @args('--hypervisor', metavar='', - help='hypervisor(default: None)') - def list(self, hypervisor=None): - """Lists all agent builds. - - arguments: - """ - fmt = "%-10s %-8s %12s %s" - ctxt = context.get_admin_context() - by_hypervisor = {} - for agent_build in db.agent_build_get_all(ctxt): - buildlist = by_hypervisor.get(agent_build.hypervisor) - if not buildlist: - buildlist = by_hypervisor[agent_build.hypervisor] = [] - - buildlist.append(agent_build) - - for key, buildlist in by_hypervisor.items(): - if hypervisor and key != hypervisor: - continue - - print(_('Hypervisor: %s') % key) - print(fmt % ('-' * 10, '-' * 8, '-' * 12, '-' * 32)) - for agent_build in buildlist: - print(fmt % (agent_build.os, agent_build.architecture, - agent_build.version, agent_build.md5hash)) - print(' %s' % agent_build.url) - - print() - - @args('--os', metavar='', help='os') - @args('--architecture', dest='architecture', - metavar='', help='architecture') - @args('--version', metavar='', help='version') - @args('--url', metavar='', help='url') - @args('--md5hash', metavar='', help='md5hash') - @args('--hypervisor', metavar='', - help='hypervisor(default: xen)') - def modify(self, os, architecture, version, url, md5hash, - hypervisor='xen'): - """Update an existing agent build.""" - ctxt = context.get_admin_context() - agent_build_ref = db.agent_build_get_by_triple(ctxt, - hypervisor, os, architecture) - db.agent_build_update(ctxt, agent_build_ref['id'], - {'version': version, - 'url': url, - 'md5hash': md5hash}) - - class CellCommands(object): """Commands for managing cells v1 functionality.""" @@ -1622,13 +1504,11 @@ class CellV2Commands(object): CATEGORIES = { - 'agent': AgentBuildCommands, 'api_db': ApiDbCommands, 'cell': CellCommands, 'cell_v2': CellV2Commands, 'db': DbCommands, 'floating': FloatingIpCommands, - 'host': HostCommands, 'network': NetworkCommands, } diff --git a/releasenotes/notes/remove-deprecated-nova-manage-commands-2826e6b50eccfef1.yaml b/releasenotes/notes/remove-deprecated-nova-manage-commands-2826e6b50eccfef1.yaml index 253ee356f077..268d9c7e2b88 100644 --- a/releasenotes/notes/remove-deprecated-nova-manage-commands-2826e6b50eccfef1.yaml +++ b/releasenotes/notes/remove-deprecated-nova-manage-commands-2826e6b50eccfef1.yaml @@ -8,5 +8,7 @@ upgrade: - ``project`` - ``account`` - ``logs`` + - ``host`` + - ``agent`` These were previously deprecated in 16.0.0.