summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-02-02 00:01:58 +0000
committerGerrit Code Review <review@openstack.org>2012-02-02 00:01:58 +0000
commit11f26257407a68cd73ff4474ed10fb45b480836a (patch)
treede02703e364e0cc3fd518b257767458270daf681 /nova/api
parent7e078d915c85236550d5a787f5406432a913c99e (diff)
parent6e35b5785d12513dc0076145f4de5e1f98034250 (diff)
downloadnova-11f26257407a68cd73ff4474ed10fb45b480836a.tar.gz
nova-11f26257407a68cd73ff4474ed10fb45b480836a.tar.xz
nova-11f26257407a68cd73ff4474ed10fb45b480836a.zip
Merge "Add 'all_tenants' filter to GET /servers."
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/servers.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index 925c6d42c..8f9ee01df 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -450,6 +450,17 @@ class Controller(wsgi.Controller):
# No 'changes-since', so we only want non-deleted servers
search_opts['deleted'] = False
+ # 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
+ # both here and in the compute API.
+ if not context.is_admin or (context.is_admin and 'all_tenants'
+ not in search_opts):
+ if context.project_id:
+ search_opts['project_id'] = context.project_id
+ else:
+ search_opts['user_id'] = context.user_id
+
instance_list = self.compute_api.get_all(context,
search_opts=search_opts)