use plain routes list for hypervisor endpoint instead of stevedore
This patch adds hypervisors 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: I1095e91b5ef84995b32b38445b0876b132b9627a
This commit is contained in:
@@ -32,8 +32,6 @@ from nova import servicegroup
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
ALIAS = "os-hypervisors"
|
||||
|
||||
|
||||
class HypervisorsController(wsgi.Controller):
|
||||
"""The Hypervisors API controller for the OpenStack API."""
|
||||
@@ -278,25 +276,3 @@ class HypervisorsController(wsgi.Controller):
|
||||
context.can(hv_policies.BASE_POLICY_NAME)
|
||||
stats = self.host_api.compute_node_statistics(context)
|
||||
return dict(hypervisor_statistics=stats)
|
||||
|
||||
|
||||
class Hypervisors(extensions.V21APIExtensionBase):
|
||||
"""Admin-only hypervisor administration."""
|
||||
|
||||
name = "Hypervisors"
|
||||
alias = ALIAS
|
||||
version = 1
|
||||
|
||||
def get_resources(self):
|
||||
resources = [extensions.ResourceExtension(ALIAS,
|
||||
HypervisorsController(),
|
||||
collection_actions={'detail': 'GET',
|
||||
'statistics': 'GET'},
|
||||
member_actions={'uptime': 'GET',
|
||||
'search': 'GET',
|
||||
'servers': 'GET'})]
|
||||
|
||||
return resources
|
||||
|
||||
def get_controller_extensions(self):
|
||||
return []
|
||||
|
||||
@@ -48,6 +48,7 @@ from nova.api.openstack.compute import floating_ips_bulk
|
||||
from nova.api.openstack.compute import fping
|
||||
from nova.api.openstack.compute import hide_server_addresses
|
||||
from nova.api.openstack.compute import hosts
|
||||
from nova.api.openstack.compute import hypervisors
|
||||
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
|
||||
@@ -171,6 +172,10 @@ hosts_controller = functools.partial(
|
||||
_create_controller, hosts.HostController, [], [])
|
||||
|
||||
|
||||
hypervisors_controller = functools.partial(
|
||||
_create_controller, hypervisors.HypervisorsController, [], [])
|
||||
|
||||
|
||||
instance_actions_controller = functools.partial(_create_controller,
|
||||
instance_actions.InstanceActionsController, [], [])
|
||||
|
||||
@@ -413,6 +418,27 @@ ROUTE_LIST = (
|
||||
('/os-hosts/{id}/startup', {
|
||||
'GET': [hosts_controller, 'startup']
|
||||
}),
|
||||
('/os-hypervisors', {
|
||||
'GET': [hypervisors_controller, 'index']
|
||||
}),
|
||||
('/os-hypervisors/detail', {
|
||||
'GET': [hypervisors_controller, 'detail']
|
||||
}),
|
||||
('/os-hypervisors/statistics', {
|
||||
'GET': [hypervisors_controller, 'statistics']
|
||||
}),
|
||||
('/os-hypervisors/{id}', {
|
||||
'GET': [hypervisors_controller, 'show']
|
||||
}),
|
||||
('/os-hypervisors/{id}/search', {
|
||||
'GET': [hypervisors_controller, 'search']
|
||||
}),
|
||||
('/os-hypervisors/{id}/servers', {
|
||||
'GET': [hypervisors_controller, 'servers']
|
||||
}),
|
||||
('/os-hypervisors/{id}/uptime', {
|
||||
'GET': [hypervisors_controller, 'uptime']
|
||||
}),
|
||||
('/os-instance_usage_audit_log', {
|
||||
'GET': [instance_usage_audit_log_controller, 'index']
|
||||
}),
|
||||
|
||||
@@ -79,7 +79,6 @@ nova.api.v21.extensions =
|
||||
console_auth_tokens = nova.api.openstack.compute.console_auth_tokens:ConsoleAuthTokens
|
||||
consoles = nova.api.openstack.compute.consoles:Consoles
|
||||
extension_info = nova.api.openstack.compute.extension_info:ExtensionInfo
|
||||
hypervisors = nova.api.openstack.compute.hypervisors:Hypervisors
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user