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

This commit is contained in:
Jenkins 2017-05-04 12:21:01 +00:00 committed by Gerrit Code Review
commit 2746402350
4 changed files with 16 additions and 23 deletions

View File

@ -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 []

View File

@ -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.'},

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
@ -85,6 +86,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, [], [])
@ -231,6 +237,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']
}),

View File

@ -72,7 +72,6 @@ wsgi_scripts =
nova-metadata-wsgi = nova.api.metadata.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