diff --git a/nova/api/openstack/compute/assisted_volume_snapshots.py b/nova/api/openstack/compute/assisted_volume_snapshots.py index 97052e346b..b2f60933a4 100644 --- a/nova/api/openstack/compute/assisted_volume_snapshots.py +++ b/nova/api/openstack/compute/assisted_volume_snapshots.py @@ -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 [] diff --git a/nova/api/openstack/compute/extension_info.py b/nova/api/openstack/compute/extension_info.py index cd072c8e2a..952e970a6e 100644 --- a/nova/api/openstack/compute/extension_info.py +++ b/nova/api/openstack/compute/extension_info.py @@ -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.'}, diff --git a/nova/api/openstack/compute/routes.py b/nova/api/openstack/compute/routes.py index 31d564033a..fa6ec61a1c 100644 --- a/nova/api/openstack/compute/routes.py +++ b/nova/api/openstack/compute/routes.py @@ -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'] }), diff --git a/setup.cfg b/setup.cfg index 0d1ef692ca..8075ad689f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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