diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2011-09-06 20:56:42 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-09-06 20:56:42 +0000 |
| commit | d01010583d5d581591c9edcf36c4da54f0c78da9 (patch) | |
| tree | 77f2054427ed9be0081e2c630dce83c9df156e6e /nova/api | |
| parent | 99e223dc231bae3d98f7979a403d97fd100f03a1 (diff) | |
| parent | 1f3856ffb92ab690b1d630deb6fa025ae74348f7 (diff) | |
| download | nova-d01010583d5d581591c9edcf36c4da54f0c78da9.tar.gz nova-d01010583d5d581591c9edcf36c4da54f0c78da9.tar.xz nova-d01010583d5d581591c9edcf36c4da54f0c78da9.zip | |
At present, the os servers.detail api does not return server.user_id or server.tenant_id. This is problematic, since the servers.detail api defaults to returning all servers for all users of a tenant, which makes it impossible to tell which user is associated with which server.
Similarly, when admin users access servers.list, all instances for all tenants are returned. Without a tenant_id field, administrators can't sift through the server list very easily.
This merge request does the following:
* add user_id and tenant_id to servers.detail
* makes it possible for admins to filter with the term 'tenant_id' (rather than project_id)
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/schemas/v1.1/server.rng | 2 | ||||
| -rw-r--r-- | nova/api/openstack/servers.py | 4 | ||||
| -rw-r--r-- | nova/api/openstack/views/servers.py | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/nova/api/openstack/schemas/v1.1/server.rng b/nova/api/openstack/schemas/v1.1/server.rng index dbd169a83..ef835e408 100644 --- a/nova/api/openstack/schemas/v1.1/server.rng +++ b/nova/api/openstack/schemas/v1.1/server.rng @@ -1,6 +1,8 @@ <element name="server" ns="http://docs.openstack.org/compute/api/v1.1" xmlns="http://relaxng.org/ns/structure/1.0"> <attribute name="name"> <text/> </attribute> + <attribute name="userId"> <text/> </attribute> + <attribute name="tenantId"> <text/> </attribute> <attribute name="id"> <text/> </attribute> <attribute name="uuid"> <text/> </attribute> <attribute name="updated"> <text/> </attribute> diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index acd2209af..d084ac360 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -873,6 +873,8 @@ class ServerXMLSerializer(wsgi.XMLDictSerializer): def _add_server_attributes(self, node, server): node.setAttribute('id', str(server['id'])) + node.setAttribute('userId', str(server['user_id'])) + node.setAttribute('tenantId', str(server['tenant_id'])) node.setAttribute('uuid', str(server['uuid'])) node.setAttribute('hostId', str(server['hostId'])) node.setAttribute('name', server['name']) @@ -1009,7 +1011,7 @@ def create_resource(version='1.0'): "attributes": { "server": ["id", "imageId", "name", "flavorId", "hostId", "status", "progress", "adminPass", "flavorRef", - "imageRef"], + "imageRef", "userId", "tenantId"], "link": ["rel", "type", "href"], }, "dict_collections": { diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py index 3a13d15f1..ac09b5864 100644 --- a/nova/api/openstack/views/servers.py +++ b/nova/api/openstack/views/servers.py @@ -66,6 +66,8 @@ class ViewBuilder(object): inst_dict = { 'id': inst['id'], 'name': inst['display_name'], + 'user_id': inst.get('user_id', ''), + 'tenant_id': inst.get('project_id', ''), 'status': common.status_from_state(vm_state, task_state)} # Return the metadata as a dictionary |
