diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json
new file mode 100644
index 000000000000..3b421b4e1ddf
--- /dev/null
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json
@@ -0,0 +1,20 @@
+{
+ "flavor": {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "ram": 512,
+ "vcpus": 1
+ }
+}
\ No newline at end of file
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml
new file mode 100644
index 000000000000..dfecff1fc35f
--- /dev/null
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json
new file mode 100644
index 000000000000..ee7696bed73b
--- /dev/null
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json
@@ -0,0 +1,94 @@
+{
+ "flavors": [
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "ram": 512,
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 20,
+ "id": "2",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/2",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/2",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.small",
+ "ram": 2048,
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 40,
+ "id": "3",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/3",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/3",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.medium",
+ "ram": 4096,
+ "vcpus": 2
+ },
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 80,
+ "id": "4",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/4",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/4",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.large",
+ "ram": 8192,
+ "vcpus": 4
+ },
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 160,
+ "id": "5",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/5",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/5",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.xlarge",
+ "ram": 16384,
+ "vcpus": 8
+ }
+ ]
+}
\ No newline at end of file
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml
new file mode 100644
index 000000000000..7b53621b7a19
--- /dev/null
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json
new file mode 100644
index 000000000000..b0e481a629ea
--- /dev/null
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json
@@ -0,0 +1,12 @@
+{
+ "flavor": {
+ "OS-FLV-EXT-DATA:ephemeral": 30,
+ "disk": 10,
+ "id": "666",
+ "name": "flavortest",
+ "ram": 1024,
+ "rxtx_factor": 2,
+ "swap": 5,
+ "vcpus": 2
+ }
+}
\ No newline at end of file
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml
new file mode 100644
index 000000000000..ec1ec2e2b07a
--- /dev/null
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml
@@ -0,0 +1,11 @@
+
+
\ No newline at end of file
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json
new file mode 100644
index 000000000000..9eb2c77ff528
--- /dev/null
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json
@@ -0,0 +1,20 @@
+{
+ "flavor": {
+ "OS-FLV-EXT-DATA:ephemeral": 30,
+ "disk": 10,
+ "id": "666",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/666",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/666",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "flavortest",
+ "ram": 1024,
+ "vcpus": 2
+ }
+}
\ No newline at end of file
diff --git a/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml
new file mode 100644
index 000000000000..c877553a1b27
--- /dev/null
+++ b/doc/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl
new file mode 100644
index 000000000000..3b421b4e1ddf
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.json.tpl
@@ -0,0 +1,20 @@
+{
+ "flavor": {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "ram": 512,
+ "vcpus": 1
+ }
+}
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl
new file mode 100644
index 000000000000..dfecff1fc35f
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-get-resp.xml.tpl
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl
new file mode 100644
index 000000000000..ee7696bed73b
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.json.tpl
@@ -0,0 +1,94 @@
+{
+ "flavors": [
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "ram": 512,
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 20,
+ "id": "2",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/2",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/2",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.small",
+ "ram": 2048,
+ "vcpus": 1
+ },
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 40,
+ "id": "3",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/3",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/3",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.medium",
+ "ram": 4096,
+ "vcpus": 2
+ },
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 80,
+ "id": "4",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/4",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/4",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.large",
+ "ram": 8192,
+ "vcpus": 4
+ },
+ {
+ "OS-FLV-EXT-DATA:ephemeral": 0,
+ "disk": 160,
+ "id": "5",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/5",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/5",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.xlarge",
+ "ram": 16384,
+ "vcpus": 8
+ }
+ ]
+}
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl
new file mode 100644
index 000000000000..7b53621b7a19
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-list-resp.xml.tpl
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json.tpl
new file mode 100644
index 000000000000..b0e481a629ea
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.json.tpl
@@ -0,0 +1,12 @@
+{
+ "flavor": {
+ "OS-FLV-EXT-DATA:ephemeral": 30,
+ "disk": 10,
+ "id": "666",
+ "name": "flavortest",
+ "ram": 1024,
+ "rxtx_factor": 2,
+ "swap": 5,
+ "vcpus": 2
+ }
+}
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml.tpl
new file mode 100644
index 000000000000..ec1ec2e2b07a
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-req.xml.tpl
@@ -0,0 +1,11 @@
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json.tpl
new file mode 100644
index 000000000000..9eb2c77ff528
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.json.tpl
@@ -0,0 +1,20 @@
+{
+ "flavor": {
+ "OS-FLV-EXT-DATA:ephemeral": 30,
+ "disk": 10,
+ "id": "666",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/666",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/666",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "flavortest",
+ "ram": 1024,
+ "vcpus": 2
+ }
+}
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml.tpl b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml.tpl
new file mode 100644
index 000000000000..c877553a1b27
--- /dev/null
+++ b/nova/tests/integrated/api_samples/OS-FLV-EXT-DATA/flavors-extra-data-post-resp.xml.tpl
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index 0c1bfdd3ff79..bc559df2d2e9 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -511,3 +511,41 @@ class ServerStartStopJsonTest(ServersSampleBase):
class ServerStartStopXmlTest(ServerStartStopJsonTest):
ctype = 'xml'
+
+
+class FlavorsExtraDataJsonTest(ApiSampleTestBase):
+ extension_name = ('nova.api.openstack.compute.contrib.flavorextradata.'
+ 'Flavorextradata')
+
+ def _get_flags(self):
+ f = super(FlavorsExtraDataJsonTest, self)._get_flags()
+ f['osapi_compute_extension'] = FLAGS.osapi_compute_extension[:]
+ # Flavorextradata extension also needs Flavormanage to be loaded.
+ f['osapi_compute_extension'].append(
+ 'nova.api.openstack.compute.contrib.flavormanage.Flavormanage')
+ return f
+
+ def test_flavors_extra_data_get(self):
+ response = self._do_get('flavors/1')
+ subs = self._get_regexes()
+ return self._verify_response('flavors-extra-data-get-resp', subs,
+ response)
+
+ def test_flavors_extra_data_list(self):
+ response = self._do_get('flavors/detail')
+ subs = self._get_regexes()
+ return self._verify_response('flavors-extra-data-list-resp', subs,
+ response)
+
+ def test_flavors_extra_data_post(self):
+ response = self._do_post('flavors',
+ 'flavors-extra-data-post-req',
+ {})
+ self.assertEqual(response.status, 200)
+ subs = self._get_regexes()
+ return self._verify_response('flavors-extra-data-post-resp',
+ subs, response)
+
+
+class FlavorsExtraDataXmlTest(FlavorsExtraDataJsonTest):
+ ctype = 'xml'