Use plain routes list for os-migrations endpoint instead of stevedore

This patch adds os-migrations related routes by a plain list,
instead of using stevedore. After all the Nova API endpoints moves
to the plain routes list, the usage of stevedore for API loading will
be removed from Nova.

Partial-implement-blueprint api-no-more-extensions-pike

Change-Id: Ic6ded36d2247a01f8b41027cc07ef251b3570a46
This commit is contained in:
jichenjc 2017-04-28 21:34:38 +08:00 committed by Sean Dague
parent 0cd67d23bd
commit 61fa894389
3 changed files with 8 additions and 21 deletions

View File

@ -19,9 +19,6 @@ from nova.objects import base as obj_base
from nova.policies import migrations as migrations_policies
ALIAS = "os-migrations"
class MigrationsController(wsgi.Controller):
"""Controller for accessing migrations in OpenStack API."""
@ -80,20 +77,3 @@ class MigrationsController(wsgi.Controller):
return {'migrations': self._output(req, migrations, True)}
return {'migrations': self._output(req, migrations)}
class Migrations(extensions.V21APIExtensionBase):
"""Provide data on migrations."""
name = "Migrations"
alias = ALIAS
version = 1
def get_resources(self):
resources = []
resource = extensions.ResourceExtension(ALIAS,
MigrationsController())
resources.append(resource)
return resources
def get_controller_extensions(self):
return []

View File

@ -49,6 +49,7 @@ from nova.api.openstack.compute import instance_usage_audit_log
from nova.api.openstack.compute import keypairs
from nova.api.openstack.compute import lock_server
from nova.api.openstack.compute import migrate_server
from nova.api.openstack.compute import migrations
from nova.api.openstack.compute import multinic
from nova.api.openstack.compute import pause_server
from nova.api.openstack.compute import quota_sets
@ -159,6 +160,10 @@ instance_usage_audit_log_controller = functools.partial(_create_controller,
instance_usage_audit_log.InstanceUsageAuditLogController, [], [])
migrations_controller = functools.partial(_create_controller,
migrations.MigrationsController, [], [])
quota_set_controller = functools.partial(_create_controller,
quota_sets.QuotaSetsController, [], [])
@ -342,6 +347,9 @@ ROUTE_LIST = (
'GET': [keypairs_controller, 'show'],
'DELETE': [keypairs_controller, 'delete']
}),
('/os-migrations', {
'GET': [migrations_controller, 'index']
}),
('/os-quota-sets/{id}', {
'GET': [quota_set_controller, 'show'],
'PUT': [quota_set_controller, 'update'],

View File

@ -89,7 +89,6 @@ nova.api.v21.extensions =
instance_actions = nova.api.openstack.compute.instance_actions:InstanceActions
ips = nova.api.openstack.compute.ips:IPs
limits = nova.api.openstack.compute.limits:Limits
migrations = nova.api.openstack.compute.migrations:Migrations
multiple_create = nova.api.openstack.compute.multiple_create:MultipleCreate
networks = nova.api.openstack.compute.networks:Networks
networks_associate = nova.api.openstack.compute.networks_associate:NetworksAssociate