summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorLin Hua Cheng <lin-hua.cheng@hp.com>2012-06-20 19:37:19 +0000
committerLin Hua Cheng <lin-hua.cheng@hp.com>2012-06-20 22:07:00 +0000
commit52fd1536a897a24ba07b5f4459edb15e581b7adc (patch)
tree533f55bdc9c198373d837fba937960482061a999 /nova/api
parentcf1854946838bf14607d05acd6f347702372b744 (diff)
downloadnova-52fd1536a897a24ba07b5f4459edb15e581b7adc.tar.gz
nova-52fd1536a897a24ba07b5f4459edb15e581b7adc.tar.xz
nova-52fd1536a897a24ba07b5f4459edb15e581b7adc.zip
Add instance_id in Usage API response.
Fixes bug 1003093. Required to fix horizon bug 1003299. Add the instance_id in the server usage response. The value of the id is the UUID of the instance. Change-Id: I77e0f64db456b4c80a03fa922dd18146b94d1187
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/simple_tenant_usage.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/api/openstack/compute/contrib/simple_tenant_usage.py b/nova/api/openstack/compute/contrib/simple_tenant_usage.py
index 0179ea75b..7879cf381 100644
--- a/nova/api/openstack/compute/contrib/simple_tenant_usage.py
+++ b/nova/api/openstack/compute/contrib/simple_tenant_usage.py
@@ -44,9 +44,9 @@ def make_usage(elem):
server_usages = xmlutil.SubTemplateElement(elem, 'server_usages')
server_usage = xmlutil.SubTemplateElement(server_usages, 'server_usage',
selector='server_usages')
- for subelem_tag in ('name', 'hours', 'memory_mb', 'local_gb', 'vcpus',
- 'tenant_id', 'flavor', 'started_at', 'ended_at',
- 'state', 'uptime'):
+ for subelem_tag in ('instance_id', 'name', 'hours', 'memory_mb',
+ 'local_gb', 'vcpus', 'tenant_id', 'flavor',
+ 'started_at', 'ended_at', 'state', 'uptime'):
subelem = xmlutil.SubTemplateElement(server_usage, subelem_tag)
subelem.text = subelem_tag
@@ -133,6 +133,7 @@ class SimpleTenantUsageController(object):
flavor = flavors[flavor_type]
+ info['instance_id'] = instance['uuid']
info['name'] = instance['display_name']
info['memory_mb'] = flavor['memory_mb']