summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorRick Harris <rick.harris@rackspace.com>2011-08-05 22:14:15 +0000
committerRick Harris <rick.harris@rackspace.com>2011-08-05 22:14:15 +0000
commit9633e9877c7836c18c30b51c8494abfb025e64ca (patch)
treec113fe90bbc6b57c190157bb86bf3323da2ba1d2 /nova/api
parent429b42f9fdec768a4a63ed8c2d7a92f130f90f0d (diff)
Adding flag around image-create for v1.0
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/__init__.py3
-rw-r--r--nova/api/openstack/images.py6
2 files changed, 9 insertions, 0 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py
index d6a98c2cd..4d49df2ad 100644
--- a/nova/api/openstack/__init__.py
+++ b/nova/api/openstack/__init__.py
@@ -50,6 +50,9 @@ FLAGS = flags.FLAGS
flags.DEFINE_bool('allow_admin_api',
False,
'When True, this API service will accept admin operations.')
+flags.DEFINE_bool('allow_instance_snapshots',
+ True,
+ 'When True, this API service will permit instance snapshot operations.')
class FaultWrapper(base_wsgi.Middleware):
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py
index b9bc83fde..7b738e1f3 100644
--- a/nova/api/openstack/images.py
+++ b/nova/api/openstack/images.py
@@ -108,6 +108,12 @@ class ControllerV10(Controller):
def create(self, req, body):
"""Snapshot a server instance and save the image."""
+ if not FLAGS.allow_instance_snapshots:
+ LOG.warn(_('Rejecting snapshot request, snapshots currently'
+ ' disabled'))
+ msg = _("Instance Snapshots are not permitted at this time.")
+ raise webob.exc.HTTPBadRequest(explanation=msg)
+
try:
image = body["image"]
except (KeyError, TypeError):