summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorAnthony Young <sleepsonthefloor@gmail.com>2011-08-19 10:10:51 -0700
committerAnthony Young <sleepsonthefloor@gmail.com>2011-08-19 10:10:51 -0700
commit34ef09beb3bf00fd9eb16b8517c520af24641e8c (patch)
treecfe897ee25efb8962a89a70a5f88a152f98d5730 /nova/api
parent5ef94944514c3f81e31cc60d3d63b903859dca45 (diff)
downloadnova-34ef09beb3bf00fd9eb16b8517c520af24641e8c.tar.gz
nova-34ef09beb3bf00fd9eb16b8517c520af24641e8c.tar.xz
nova-34ef09beb3bf00fd9eb16b8517c520af24641e8c.zip
add tenant_id to api. without tenant_id, admins can't tell which servers belong to which tenants when retrieving lists
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/servers.py5
-rw-r--r--nova/api/openstack/views/servers.py1
2 files changed, 6 insertions, 0 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index 41e63ec3c..57ed5f45e 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -107,6 +107,11 @@ class Controller(object):
LOG.error(reason)
raise exception.InvalidInput(reason=reason)
+ # translate tenant_id filter to internal project_id
+ if 'tenant_id' in search_opts:
+ search_opts['project_id'] = search_opts['tenant_id']
+ del search_opts['tenant_id']
+
# By default, compute's get_all() will return deleted instances.
# If an admin hasn't specified a 'deleted' search option, we need
# to filter out deleted instances by setting the filter ourselves.
diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py
index c5f1e6021..37f48b3b2 100644
--- a/nova/api/openstack/views/servers.py
+++ b/nova/api/openstack/views/servers.py
@@ -65,6 +65,7 @@ class ViewBuilder(object):
'id': inst['id'],
'name': inst['display_name'],
'user_id': inst['user_id'],
+ 'tenant_id': inst['project_id'],
'description': inst['display_description'],
'status': common.status_from_power_state(inst.get('state'))}