diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index 7da0afdae997..7ac2e000db65 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -346,18 +346,6 @@ def raise_http_conflict_for_instance_invalid_state(exc, action, server_id): raise webob.exc.HTTPConflict(explanation=msg) -def check_snapshots_enabled(f): - @functools.wraps(f) - def inner(*args, **kwargs): - if not CONF.api.allow_instance_snapshots: - LOG.warning('Rejecting snapshot request, snapshots currently' - ' disabled') - msg = _("Instance snapshots are not permitted at this time.") - raise webob.exc.HTTPBadRequest(explanation=msg) - return f(*args, **kwargs) - return inner - - def url_join(*parts): """Convenience method for joining parts of a URL diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 61287bb3f35b..3cf5d17df894 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -983,7 +983,6 @@ class ServersController(wsgi.Controller): @wsgi.response(202) @wsgi.expected_errors((400, 403, 404, 409)) @wsgi.action('createImage') - @common.check_snapshots_enabled @validation.schema(schema_servers.create_image, '2.0', '2.0') @validation.schema(schema_servers.create_image, '2.1') def _action_create_image(self, req, id, body): diff --git a/nova/conf/api.py b/nova/conf/api.py index bb41c753d29a..4bdb62fb5519 100644 --- a/nova/conf/api.py +++ b/nova/conf/api.py @@ -256,25 +256,6 @@ Possible values: """), ] -allow_instance_snapshots_opts = [ - cfg.BoolOpt("allow_instance_snapshots", - default=True, - deprecated_group="DEFAULT", - deprecated_for_removal=True, - deprecated_since="16.0.0", - deprecated_reason="This option disables the createImage server action " - "API in a non-discoverable way and is thus a " - "barrier to interoperability. Also, it is not used " - "for other APIs that create snapshots like shelve " - "or createBackup. Disabling snapshots should be " - "done via policy if so desired.", - help=""" -Operators can turn off the ability for a user to take snapshots of their -instances by setting this option to False. When disabled, any attempt to -take a snapshot will result in a HTTP 400 response ("Bad Request"). -""") -] - # NOTE(edleafe): I would like to import the value directly from # nova.compute.vm_states, but that creates a circular import. Since this value # is not likely to be changed, I'm copy/pasting it here. @@ -364,7 +345,6 @@ API_OPTS = (auth_opts + metadata_opts + file_opts + osapi_opts + - allow_instance_snapshots_opts + osapi_hide_opts + fping_path_opts + os_network_opts + diff --git a/nova/tests/unit/api/openstack/compute/test_server_actions.py b/nova/tests/unit/api/openstack/compute/test_server_actions.py index 591af6a52250..23c6efa6436d 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_actions.py +++ b/nova/tests/unit/api/openstack/compute/test_server_actions.py @@ -86,9 +86,7 @@ class ServerActionsControllerTestV21(test.TestCase): fakes.stub_out_nw_api(self) fakes.stub_out_compute_api_snapshot(self) fake.stub_out_image_service(self) - self.flags(allow_instance_snapshots=True, - enable_instance_password=True, - group='api') + self.flags(enable_instance_password=True, group='api') self._image_href = '155d900f-4e14-4e4c-a73d-069cbf4541e6' self.controller = self._get_controller() @@ -1130,20 +1128,6 @@ class ServerActionsControllerTestV21(test.TestCase): self._test_create_volume_backed_image_with_metadata_from_volume( extra_metadata={'a': 'b'}) - def test_create_image_snapshots_disabled(self): - """Don't permit a snapshot if the allow_instance_snapshots flag is - False - """ - self.flags(allow_instance_snapshots=False, group='api') - body = { - 'createImage': { - 'name': 'Snapshot 1', - }, - } - self.assertRaises(webob.exc.HTTPBadRequest, - self.controller._action_create_image, - self.req, FAKE_UUID, body=body) - def test_create_image_with_metadata(self): body = { 'createImage': { diff --git a/releasenotes/notes/remove-deprecated-api-opts-d01d97fa19330e06.yaml b/releasenotes/notes/remove-deprecated-api-opts-d01d97fa19330e06.yaml new file mode 100644 index 000000000000..11e83077d204 --- /dev/null +++ b/releasenotes/notes/remove-deprecated-api-opts-d01d97fa19330e06.yaml @@ -0,0 +1,13 @@ +--- +upgrade: + - | + The following deprecated configuration options have been removed from the + ``api`` section of ``nova.conf``: + + - ``allow_instance_snapshots`` + + These were deprecated in the 16.0.0 release as they allowed inconsistent + API behavior across deployments. To disable snapshots in the + ``createImage`` server action API, change the + ``os_compute_api:servers:create_image`` and + ``os_compute_api:servers:create_image:allow_volume_backed`` policies.