summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorAlex Meade <alex.meade@rackspace.com>2011-07-13 16:22:55 -0400
committerAlex Meade <alex.meade@rackspace.com>2011-07-13 16:22:55 -0400
commit38f949608fc3faaae855bf91719a074c1c545a1d (patch)
tree7fa0a27919554057d26549542386cede436b8329 /nova
parent5392355f8de673eb357724c27e64f5eff83b9742 (diff)
updated to support and check for flavor links in server detail response
Diffstat (limited to 'nova')
-rw-r--r--nova/api/openstack/views/servers.py11
-rw-r--r--nova/tests/api/openstack/test_servers.py31
2 files changed, 27 insertions, 15 deletions
diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py
index 7fb180246..e17edd6b6 100644
--- a/nova/api/openstack/views/servers.py
+++ b/nova/api/openstack/views/servers.py
@@ -163,8 +163,19 @@ class ViewBuilderV11(ViewBuilder):
if "instance_type" in dict(inst):
flavor_id = inst["instance_type"]['flavorid']
flavor_ref = self.flavor_builder.generate_href(flavor_id)
+ flavor_bookmark = self.flavor_builder.generate_bookmark(flavor_id)
response["flavor"] = {
"id": common.get_uuid_from_href(flavor_ref),
+ "links": [
+ {
+ "rel": "self",
+ "href": flavor_ref,
+ },
+ {
+ "rel": "bookmark",
+ "href": flavor_bookmark,
+ },
+ ]
}
def _build_extra(self, response, inst):
diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py
index 0d122762b..ab24b328a 100644
--- a/nova/tests/api/openstack/test_servers.py
+++ b/nova/tests/api/openstack/test_servers.py
@@ -124,11 +124,12 @@ def instance_addresses(context, instance_id):
def stub_instance(id, user_id=1, private_address=None, public_addresses=None,
host=None, power_state=0, reservation_id="",
- uuid=FAKE_UUID, image_ref="10", flavor_ref="1"):
+ uuid=FAKE_UUID, image_ref="10", flavor_id="1"):
metadata = []
metadata.append(InstanceMetadata(key='seq', value=id))
- inst_type = instance_types.get_instance_type_by_flavor_id(int(flavor_ref))
+
+ inst_type = instance_types.get_instance_type_by_flavor_id(int(flavor_id))
if public_addresses is None:
public_addresses = list()
@@ -280,8 +281,8 @@ class ServersTest(test.TestCase):
self.maxDiff = None
image_ref = "http://localhost/v1.1/images/10"
image_bookmark = "http://localhost/images/10"
- #flavor_ref = "http://localhost/v1.1/flavors/1"
- flavor_ref = "1"
+ flavor_ref = "http://localhost/v1.1/flavors/1"
+ flavor_id = "1"
flavor_bookmark = "http://localhost/flavors/1"
private = "192.168.0.3"
public = ["1.2.3.4"]
@@ -292,7 +293,7 @@ class ServersTest(test.TestCase):
public_addresses=public,
power_state=0,
image_ref=image_ref,
- flavor_ref=flavor_ref,
+ flavor_id=flavor_id,
)
self.stubs.Set(nova.db.api, 'instance_get', _return_server)
@@ -322,16 +323,16 @@ class ServersTest(test.TestCase):
},
"flavor": {
"id": "1",
- #"links": [
- #{
- #"rel": "self",
- #"href": flavor_ref,
- #},
- #{
- #"rel": "bookmark",
- #"href": flavor_bookmark,
- #},
- #],
+ "links": [
+ {
+ "rel": "self",
+ "href": flavor_ref,
+ },
+ {
+ "rel": "bookmark",
+ "href": flavor_bookmark,
+ },
+ ],
},
"addresses": {
"public": [