diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json
new file mode 100644
index 000000000000..63eaddeb6754
--- /dev/null
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json
@@ -0,0 +1,20 @@
+{
+ "flavor": {
+ "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,
+ "rxtx_factor": 1.0,
+ "vcpus": 1
+ }
+}
\ No newline at end of file
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml
new file mode 100644
index 000000000000..78b430ecaf4f
--- /dev/null
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json
new file mode 100644
index 000000000000..81e9c993cc62
--- /dev/null
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json
@@ -0,0 +1,94 @@
+{
+ "flavors": [
+ {
+ "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,
+ "rxtx_factor": 1.0,
+ "vcpus": 1
+ },
+ {
+ "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,
+ "rxtx_factor": 1.0,
+ "vcpus": 1
+ },
+ {
+ "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,
+ "rxtx_factor": 1.0,
+ "vcpus": 2
+ },
+ {
+ "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,
+ "rxtx_factor": 1.0,
+ "vcpus": 4
+ },
+ {
+ "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,
+ "rxtx_factor": 1.0,
+ "vcpus": 8
+ }
+ ]
+}
\ No newline at end of file
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml
new file mode 100644
index 000000000000..05192e3f9c2f
--- /dev/null
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json
new file mode 100644
index 000000000000..b86a63df694a
--- /dev/null
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json
@@ -0,0 +1,10 @@
+{
+ "flavor": {
+ "name": "flavortest",
+ "ram": 1024,
+ "vcpus": 2,
+ "disk": 10,
+ "id": "100",
+ "rxtx_factor": 2.0
+ }
+}
\ No newline at end of file
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.xml b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.xml
new file mode 100644
index 000000000000..7038e1b88202
--- /dev/null
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json
new file mode 100644
index 000000000000..5129dbeb834e
--- /dev/null
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json
@@ -0,0 +1,20 @@
+{
+ "flavor": {
+ "disk": 10,
+ "id": "100",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/flavors/100",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/flavors/100",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "flavortest",
+ "ram": 1024,
+ "rxtx_factor": 2.0,
+ "vcpus": 2
+ }
+}
\ No newline at end of file
diff --git a/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.xml b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.xml
new file mode 100644
index 000000000000..8fb4f46be55d
--- /dev/null
+++ b/doc/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl
new file mode 100644
index 000000000000..a7f3a1993caf
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.json.tpl
@@ -0,0 +1,20 @@
+{
+ "flavor": {
+ "disk": 0,
+ "id": "%(flavor_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/flavors/%(flavor_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/flavors/%(flavor_id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "%(flavor_name)s",
+ "ram": 512,
+ "rxtx_factor": 1.0,
+ "vcpus": 1
+ }
+}
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml.tpl
new file mode 100644
index 000000000000..4feec740c772
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-get-resp.xml.tpl
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl
new file mode 100644
index 000000000000..5b27e1385e3f
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.json.tpl
@@ -0,0 +1,94 @@
+{
+ "flavors": [
+ {
+ "disk": 0,
+ "id": "1",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/flavors/1",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/flavors/1",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.tiny",
+ "ram": 512,
+ "rxtx_factor": 1.0,
+ "vcpus": 1
+ },
+ {
+ "disk": 20,
+ "id": "2",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/flavors/2",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/flavors/2",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.small",
+ "ram": 2048,
+ "rxtx_factor": 1.0,
+ "vcpus": 1
+ },
+ {
+ "disk": 40,
+ "id": "3",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/flavors/3",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/flavors/3",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.medium",
+ "ram": 4096,
+ "rxtx_factor": 1.0,
+ "vcpus": 2
+ },
+ {
+ "disk": 80,
+ "id": "4",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/flavors/4",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/flavors/4",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.large",
+ "ram": 8192,
+ "rxtx_factor": 1.0,
+ "vcpus": 4
+ },
+ {
+ "disk": 160,
+ "id": "5",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/flavors/5",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/flavors/5",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "m1.xlarge",
+ "ram": 16384,
+ "rxtx_factor": 1.0,
+ "vcpus": 8
+ }
+ ]
+}
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml.tpl
new file mode 100644
index 000000000000..fb2ee09e0a75
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-list-resp.xml.tpl
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json.tpl
new file mode 100644
index 000000000000..70d0a57de878
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.json.tpl
@@ -0,0 +1,10 @@
+{
+ "flavor": {
+ "name": "%(flavor_name)s",
+ "ram": 1024,
+ "vcpus": 2,
+ "disk": 10,
+ "id": "%(flavor_id)s",
+ "rxtx_factor": 2.0
+ }
+}
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.xml.tpl
new file mode 100644
index 000000000000..a87b47670e86
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-req.xml.tpl
@@ -0,0 +1,9 @@
+
+
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json.tpl
new file mode 100644
index 000000000000..abf652fae33b
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.json.tpl
@@ -0,0 +1,20 @@
+{
+ "flavor": {
+ "disk": 10,
+ "id": "%(flavor_id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/flavors/%(flavor_id)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/flavors/%(flavor_id)s",
+ "rel": "bookmark"
+ }
+ ],
+ "name": "%(flavor_name)s",
+ "ram": 1024,
+ "rxtx_factor": 2.0,
+ "vcpus": 2
+ }
+}
diff --git a/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.xml.tpl b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.xml.tpl
new file mode 100644
index 000000000000..d24623c5558f
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-flavor-rxtx/flavor-rxtx-post-resp.xml.tpl
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index 1802998445eb..22c105dc664f 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -364,7 +364,6 @@ class ApiSamplesTrap(ApiSampleTestBase):
do_not_approve_additions.append('os-create-server-ext')
do_not_approve_additions.append('os-flavor-access')
do_not_approve_additions.append('os-flavor-extra-specs')
- do_not_approve_additions.append('os-flavor-rxtx')
do_not_approve_additions.append('os-flavor-swap')
do_not_approve_additions.append('os-floating-ip-dns')
do_not_approve_additions.append('os-floating-ip-pools')
@@ -979,6 +978,55 @@ class FlavorsExtraDataXmlTest(FlavorsExtraDataJsonTest):
ctype = 'xml'
+class FlavorRxtxJsonTest(ApiSampleTestBase):
+ extension_name = ('nova.api.openstack.compute.contrib.flavor_rxtx.'
+ 'Flavor_rxtx')
+
+ def _get_flags(self):
+ f = super(FlavorRxtxJsonTest, self)._get_flags()
+ f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
+ # FlavorRxtx extension also needs Flavormanage to be loaded.
+ f['osapi_compute_extension'].append(
+ 'nova.api.openstack.compute.contrib.flavormanage.Flavormanage')
+ return f
+
+ def test_flavor_rxtx_get(self):
+ flavor_id = 1
+ response = self._do_get('flavors/%s' % flavor_id)
+ self.assertEqual(response.status, 200)
+ subs = {
+ 'flavor_id': flavor_id,
+ 'flavor_name': 'm1.tiny'
+ }
+ subs.update(self._get_regexes())
+ return self._verify_response('flavor-rxtx-get-resp', subs,
+ response)
+
+ def test_flavors_rxtx_list(self):
+ response = self._do_get('flavors/detail')
+ self.assertEqual(response.status, 200)
+ subs = self._get_regexes()
+ return self._verify_response('flavor-rxtx-list-resp', subs,
+ response)
+
+ def test_flavors_rxtx_create(self):
+ subs = {
+ 'flavor_id': 100,
+ 'flavor_name': 'flavortest'
+ }
+ response = self._do_post('flavors',
+ 'flavor-rxtx-post-req',
+ subs)
+ self.assertEqual(response.status, 200)
+ subs.update(self._get_regexes())
+ return self._verify_response('flavor-rxtx-post-resp',
+ subs, response)
+
+
+class FlavorRxtxXmlTest(FlavorRxtxJsonTest):
+ ctype = 'xml'
+
+
class SecurityGroupsSampleJsonTest(ServersSampleBase):
extension_name = "nova.api.openstack.compute.contrib" + \
".security_groups.Security_groups"