Use plain routes list for os-assisted-volume-snapshots endpoint

This patch adds os-assisted-volume-snapshots 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: I1dabc1021e6899d5d5c293e3af3eccfba8d245e2
This commit is contained in:
ghanshyam
2017-05-01 20:59:26 +03:00
parent 891fe89fb5
commit 564f14f4bc
4 changed files with 16 additions and 23 deletions
@@ -29,9 +29,6 @@ from nova import exception
from nova.policies import assisted_volume_snapshots as avs_policies
ALIAS = 'os-assisted-volume-snapshots'
class AssistedVolumeSnapshotsController(wsgi.Controller):
"""The Assisted volume snapshots API controller for the OpenStack API."""
@@ -96,22 +93,3 @@ class AssistedVolumeSnapshotsController(wsgi.Controller):
# microversion, which we should just do in a single microversion
# across all APIs when we fix status code wrinkles.
raise exc.HTTPBadRequest(explanation=e.format_message())
class AssistedVolumeSnapshots(extensions.V21APIExtensionBase):
"""Assisted volume snapshots."""
name = "AssistedVolumeSnapshots"
alias = ALIAS
version = 1
def get_resources(self):
res = [extensions.ResourceExtension(ALIAS,
AssistedVolumeSnapshotsController())]
return res
def get_controller_extensions(self):
"""It's an abstract function V21APIExtensionBase and the extension
will not be loaded without it.
"""
return []
@@ -177,6 +177,10 @@ hardcoded_extensions = [
'alias': 'os-aggregates',
'description': 'Admin-only aggregate administration.'
},
{'name': 'AssistedVolumeSnapshots',
'alias': 'os-assisted-volume-snapshots',
'description': 'Assisted volume snapshots.'
},
{'name': 'DiskConfig',
'alias': 'os-disk-config',
'description': 'Disk Management Extension.'},
+12
View File
@@ -21,6 +21,7 @@ from nova.api.openstack.compute import admin_actions
from nova.api.openstack.compute import admin_password
from nova.api.openstack.compute import agents
from nova.api.openstack.compute import aggregates
from nova.api.openstack.compute import assisted_volume_snapshots
from nova.api.openstack.compute import config_drive
from nova.api.openstack.compute import console_output
from nova.api.openstack.compute import create_backup
@@ -84,6 +85,11 @@ aggregates_controller = functools.partial(
_create_controller, aggregates.AggregateController, [], [])
assisted_volume_snapshots_controller = functools.partial(
_create_controller,
assisted_volume_snapshots.AssistedVolumeSnapshotsController, [], [])
keypairs_controller = functools.partial(
_create_controller, keypairs.KeypairController, [], [])
@@ -227,6 +233,12 @@ ROUTE_LIST = (
('/os-aggregates/{id}/action', {
'POST': [aggregates_controller, 'action'],
}),
('/os-assisted-volume-snapshots', {
'POST': [assisted_volume_snapshots_controller, 'create']
}),
('/os-assisted-volume-snapshots/{id}', {
'DELETE': [assisted_volume_snapshots_controller, 'delete']
}),
('/os-floating-ip-dns', {
'GET': [floating_ip_dns_controller, 'index']
}),
-1
View File
@@ -72,7 +72,6 @@ wsgi_scripts =
nova-api-wsgi = nova.api.openstack.compute.wsgi:init_application
nova.api.v21.extensions =
assisted_volume_snapshots = nova.api.openstack.compute.assisted_volume_snapshots:AssistedVolumeSnapshots
attach_interfaces = nova.api.openstack.compute.attach_interfaces:AttachInterfaces
availability_zone = nova.api.openstack.compute.availability_zone:AvailabilityZone
baremetal_nodes = nova.api.openstack.compute.baremetal_nodes:BareMetalNodes