summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-08-23 20:05:10 +0000
committerGerrit Code Review <review@openstack.org>2012-08-23 20:05:10 +0000
commit87bc968f1b0546dd131683efa7e9d1a1dfcad1e7 (patch)
treef15d5235482e98c7af34a9ab882d0f97dec750aa /nova/api
parent44512748bc6fa8dd24ae57643d368675aee29e4e (diff)
parentd034ff1cc12889d3812545a5e1a74c70f66270f5 (diff)
Merge "Let admin list instances in vm_states.DELETED"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/servers.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index 104f6ab99..229c3b5aa 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -428,6 +428,13 @@ class Controller(wsgi.Controller):
# No 'changes-since', so we only want non-deleted servers
search_opts['deleted'] = False
+ if search_opts.get("vm_state") == "deleted":
+ if context.is_admin:
+ search_opts['deleted'] = True
+ else:
+ msg = _("Only administrators may list deleted instances")
+ raise exc.HTTPBadRequest(explanation=msg)
+
# NOTE(dprince) This prevents computes' get_all() from returning
# instances from multiple tenants when an admin accounts is used.
# By default non-admin accounts are always limited to project/user