summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/api/openstack/views/flavors.py13
-rw-r--r--nova/tests/api/openstack/test_flavors.py50
2 files changed, 62 insertions, 1 deletions
diff --git a/nova/api/openstack/views/flavors.py b/nova/api/openstack/views/flavors.py
index 19ac8f114..be7e68763 100644
--- a/nova/api/openstack/views/flavors.py
+++ b/nova/api/openstack/views/flavors.py
@@ -76,10 +76,21 @@ class ViewBuilder_1_1(ViewBuilder):
return flavor_obj
def _build_links(self, flavor_obj):
+ href = self.generate_href(flavor_obj["id"])
links = [
{
"rel": "self",
- "href": self.generate_href(flavor_obj["id"]),
+ "href": href,
+ },
+ {
+ "rel": "bookmark",
+ "type": "application/json",
+ "href": href,
+ },
+ {
+ "rel": "bookmark",
+ "type": "application/xml",
+ "href": href,
},
]
return links
diff --git a/nova/tests/api/openstack/test_flavors.py b/nova/tests/api/openstack/test_flavors.py
index 197e907c4..8dfcfe293 100644
--- a/nova/tests/api/openstack/test_flavors.py
+++ b/nova/tests/api/openstack/test_flavors.py
@@ -143,6 +143,16 @@ class FlavorsTest(test.TestCase):
"rel": "self",
"href": "http://localhost/v1.1/flavors/12",
},
+ {
+ "rel": "bookmark",
+ "type": "application/json",
+ "href": "http://localhost/v1.1/flavors/12",
+ },
+ {
+ "rel": "bookmark",
+ "type": "application/xml",
+ "href": "http://localhost/v1.1/flavors/12",
+ },
],
}
self.assertEqual(flavor, expected)
@@ -162,6 +172,16 @@ class FlavorsTest(test.TestCase):
"rel": "self",
"href": "http://localhost/v1.1/flavors/1",
},
+ {
+ "rel": "bookmark",
+ "type": "application/json",
+ "href": "http://localhost/v1.1/flavors/1",
+ },
+ {
+ "rel": "bookmark",
+ "type": "application/xml",
+ "href": "http://localhost/v1.1/flavors/1",
+ },
],
},
{
@@ -172,6 +192,16 @@ class FlavorsTest(test.TestCase):
"rel": "self",
"href": "http://localhost/v1.1/flavors/2",
},
+ {
+ "rel": "bookmark",
+ "type": "application/json",
+ "href": "http://localhost/v1.1/flavors/2",
+ },
+ {
+ "rel": "bookmark",
+ "type": "application/xml",
+ "href": "http://localhost/v1.1/flavors/2",
+ },
],
},
]
@@ -194,6 +224,16 @@ class FlavorsTest(test.TestCase):
"rel": "self",
"href": "http://localhost/v1.1/flavors/1",
},
+ {
+ "rel": "bookmark",
+ "type": "application/json",
+ "href": "http://localhost/v1.1/flavors/1",
+ },
+ {
+ "rel": "bookmark",
+ "type": "application/xml",
+ "href": "http://localhost/v1.1/flavors/1",
+ },
],
},
{
@@ -206,6 +246,16 @@ class FlavorsTest(test.TestCase):
"rel": "self",
"href": "http://localhost/v1.1/flavors/2",
},
+ {
+ "rel": "bookmark",
+ "type": "application/json",
+ "href": "http://localhost/v1.1/flavors/2",
+ },
+ {
+ "rel": "bookmark",
+ "type": "application/xml",
+ "href": "http://localhost/v1.1/flavors/2",
+ },
],
},
]