conf: Remove deprecated 'allow_instance_snapshots' opt
This flag was deprecated in a previous cycle. The flag and any uses of it can now be removed. Change-Id: I2224f38b9fa86b70425b25404a27c5c37d477cf3
This commit is contained in:
@@ -346,18 +346,6 @@ def raise_http_conflict_for_instance_invalid_state(exc, action, server_id):
|
|||||||
raise webob.exc.HTTPConflict(explanation=msg)
|
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):
|
def url_join(*parts):
|
||||||
"""Convenience method for joining parts of a URL
|
"""Convenience method for joining parts of a URL
|
||||||
|
|
||||||
|
@@ -983,7 +983,6 @@ class ServersController(wsgi.Controller):
|
|||||||
@wsgi.response(202)
|
@wsgi.response(202)
|
||||||
@wsgi.expected_errors((400, 403, 404, 409))
|
@wsgi.expected_errors((400, 403, 404, 409))
|
||||||
@wsgi.action('createImage')
|
@wsgi.action('createImage')
|
||||||
@common.check_snapshots_enabled
|
|
||||||
@validation.schema(schema_servers.create_image, '2.0', '2.0')
|
@validation.schema(schema_servers.create_image, '2.0', '2.0')
|
||||||
@validation.schema(schema_servers.create_image, '2.1')
|
@validation.schema(schema_servers.create_image, '2.1')
|
||||||
def _action_create_image(self, req, id, body):
|
def _action_create_image(self, req, id, body):
|
||||||
|
@@ -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
|
# NOTE(edleafe): I would like to import the value directly from
|
||||||
# nova.compute.vm_states, but that creates a circular import. Since this value
|
# 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.
|
# is not likely to be changed, I'm copy/pasting it here.
|
||||||
@@ -364,7 +345,6 @@ API_OPTS = (auth_opts +
|
|||||||
metadata_opts +
|
metadata_opts +
|
||||||
file_opts +
|
file_opts +
|
||||||
osapi_opts +
|
osapi_opts +
|
||||||
allow_instance_snapshots_opts +
|
|
||||||
osapi_hide_opts +
|
osapi_hide_opts +
|
||||||
fping_path_opts +
|
fping_path_opts +
|
||||||
os_network_opts +
|
os_network_opts +
|
||||||
|
@@ -86,9 +86,7 @@ class ServerActionsControllerTestV21(test.TestCase):
|
|||||||
fakes.stub_out_nw_api(self)
|
fakes.stub_out_nw_api(self)
|
||||||
fakes.stub_out_compute_api_snapshot(self)
|
fakes.stub_out_compute_api_snapshot(self)
|
||||||
fake.stub_out_image_service(self)
|
fake.stub_out_image_service(self)
|
||||||
self.flags(allow_instance_snapshots=True,
|
self.flags(enable_instance_password=True, group='api')
|
||||||
enable_instance_password=True,
|
|
||||||
group='api')
|
|
||||||
self._image_href = '155d900f-4e14-4e4c-a73d-069cbf4541e6'
|
self._image_href = '155d900f-4e14-4e4c-a73d-069cbf4541e6'
|
||||||
|
|
||||||
self.controller = self._get_controller()
|
self.controller = self._get_controller()
|
||||||
@@ -1130,20 +1128,6 @@ class ServerActionsControllerTestV21(test.TestCase):
|
|||||||
self._test_create_volume_backed_image_with_metadata_from_volume(
|
self._test_create_volume_backed_image_with_metadata_from_volume(
|
||||||
extra_metadata={'a': 'b'})
|
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):
|
def test_create_image_with_metadata(self):
|
||||||
body = {
|
body = {
|
||||||
'createImage': {
|
'createImage': {
|
||||||
|
@@ -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.
|
Reference in New Issue
Block a user