Use plain routes list for instance actions endpoint
This patch adds instance actions 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: I1ae0797ac8ca1cd64bb0d92d4c14aa96d4a59d62
This commit is contained in:
@@ -23,8 +23,6 @@ from nova.i18n import _
|
||||
from nova.policies import instance_actions as ia_policies
|
||||
from nova import utils
|
||||
|
||||
ALIAS = "os-instance-actions"
|
||||
|
||||
ACTION_KEYS = ['action', 'instance_uuid', 'request_id', 'user_id',
|
||||
'project_id', 'start_time', 'message']
|
||||
EVENT_KEYS = ['event', 'start_time', 'finish_time', 'result', 'traceback']
|
||||
@@ -87,25 +85,3 @@ class InstanceActionsController(wsgi.Controller):
|
||||
action_id)
|
||||
action['events'] = [self._format_event(evt) for evt in events_raw]
|
||||
return {'instanceAction': action}
|
||||
|
||||
|
||||
class InstanceActions(extensions.V21APIExtensionBase):
|
||||
"""View a log of actions and events taken on an instance."""
|
||||
|
||||
name = "InstanceActions"
|
||||
alias = ALIAS
|
||||
version = 1
|
||||
|
||||
def get_resources(self):
|
||||
ext = extensions.ResourceExtension(ALIAS,
|
||||
InstanceActionsController(),
|
||||
parent=dict(
|
||||
member_name='server',
|
||||
collection_name='servers'))
|
||||
return [ext]
|
||||
|
||||
def get_controller_extensions(self):
|
||||
"""It's an abstract function V21APIExtensionBase and the extension
|
||||
will not be loaded without it.
|
||||
"""
|
||||
return []
|
||||
|
||||
@@ -46,6 +46,7 @@ from nova.api.openstack.compute import floating_ip_pools
|
||||
from nova.api.openstack.compute import floating_ips
|
||||
from nova.api.openstack.compute import floating_ips_bulk
|
||||
from nova.api.openstack.compute import hide_server_addresses
|
||||
from nova.api.openstack.compute import instance_actions
|
||||
from nova.api.openstack.compute import instance_usage_audit_log
|
||||
from nova.api.openstack.compute import ips
|
||||
from nova.api.openstack.compute import keypairs
|
||||
@@ -160,6 +161,10 @@ floating_ips_bulk_controller = functools.partial(_create_controller,
|
||||
floating_ips_bulk.FloatingIPBulkController, [], [])
|
||||
|
||||
|
||||
instance_actions_controller = functools.partial(_create_controller,
|
||||
instance_actions.InstanceActionsController, [], [])
|
||||
|
||||
|
||||
instance_usage_audit_log_controller = functools.partial(_create_controller,
|
||||
instance_usage_audit_log.InstanceUsageAuditLogController, [], [])
|
||||
|
||||
@@ -472,6 +477,12 @@ ROUTE_LIST = (
|
||||
('/servers/{server_id}/migrations/{id}/action', {
|
||||
'POST': [server_migrations_controller, 'action']
|
||||
}),
|
||||
('/servers/{server_id}/os-instance-actions', {
|
||||
'GET': [instance_actions_controller, 'index']
|
||||
}),
|
||||
('/servers/{server_id}/os-instance-actions/{id}', {
|
||||
'GET': [instance_actions_controller, 'show']
|
||||
}),
|
||||
('/servers/{server_id}/os-interface', {
|
||||
'GET': [server_os_interface_controller, 'index'],
|
||||
'POST': [server_os_interface_controller, 'create']
|
||||
|
||||
@@ -85,7 +85,6 @@ nova.api.v21.extensions =
|
||||
images = nova.api.openstack.compute.images:Images
|
||||
image_metadata = nova.api.openstack.compute.image_metadata:ImageMetadata
|
||||
image_size = nova.api.openstack.compute.image_size:ImageSize
|
||||
instance_actions = nova.api.openstack.compute.instance_actions:InstanceActions
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user