Skip to content

Commit

Permalink
Use plain routes list for os-assisted-volume-snapshots endpoint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gmannos committed May 1, 2017
1 parent 891fe89 commit 564f14f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
22 changes: 0 additions & 22 deletions nova/api/openstack/compute/assisted_volume_snapshots.py
Expand Up @@ -29,9 +29,6 @@
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."""

Expand Down Expand Up @@ -96,22 +93,3 @@ def delete(self, req, id):
# 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 []
4 changes: 4 additions & 0 deletions nova/api/openstack/compute/extension_info.py
Expand Up @@ -177,6 +177,10 @@
'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.'},
Expand Down
12 changes: 12 additions & 0 deletions nova/api/openstack/compute/routes.py
Expand Up @@ -21,6 +21,7 @@
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
Expand Down Expand Up @@ -84,6 +85,11 @@ def _create_controller(main_controller, controller_list,
_create_controller, aggregates.AggregateController, [], [])


assisted_volume_snapshots_controller = functools.partial(
_create_controller,
assisted_volume_snapshots.AssistedVolumeSnapshotsController, [], [])


keypairs_controller = functools.partial(
_create_controller, keypairs.KeypairController, [], [])

Expand Down Expand Up @@ -227,6 +233,12 @@ def _create_controller(main_controller, controller_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']
}),
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Expand Up @@ -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
Expand Down

0 comments on commit 564f14f

Please sign in to comment.