From 1a1deafcbfa7aeb367c5992b797e71aaa7c7094d Mon Sep 17 00:00:00 2001 From: Masaki Matsushita Date: Tue, 5 Jul 2016 16:37:43 +0900 Subject: [PATCH] Add vCPUs to flavor-list This commit adds vCPU colmn to flavor-list Closes-Bug: #1261876 Change-Id: I2309d00fb8b1c428a8708d8dd934ccc462fb9366 --- .../db-flavors-by-id-response-json.txt | 2 +- .../samples/db-flavors-by-id-response.json | 3 +- .../src/samples/db-flavors-response-json.txt | 2 +- apidocs/src/samples/db-flavors-response.json | 39 ++++++++++++------- .../flavor-list-vcpu-817b0f5715820377.yaml | 3 ++ trove/flavor/views.py | 1 + trove/tests/api/flavors.py | 8 ++-- 7 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 releasenotes/notes/flavor-list-vcpu-817b0f5715820377.yaml diff --git a/apidocs/src/samples/db-flavors-by-id-response-json.txt b/apidocs/src/samples/db-flavors-by-id-response-json.txt index 0a1044804f..7cf3e8a711 100644 --- a/apidocs/src/samples/db-flavors-by-id-response-json.txt +++ b/apidocs/src/samples/db-flavors-by-id-response-json.txt @@ -1,5 +1,5 @@ HTTP/1.1 200 OK Content-Type: application/json -Content-Length: 214 +Content-Length: 227 Date: Mon, 18 Mar 2013 19:09:17 GMT diff --git a/apidocs/src/samples/db-flavors-by-id-response.json b/apidocs/src/samples/db-flavors-by-id-response.json index 0fe706822a..931f06c914 100644 --- a/apidocs/src/samples/db-flavors-by-id-response.json +++ b/apidocs/src/samples/db-flavors-by-id-response.json @@ -13,6 +13,7 @@ ], "name": "m1.tiny", "ram": 512, - "str_id": "1" + "str_id": "1", + "vcpus": 10 } } diff --git a/apidocs/src/samples/db-flavors-response-json.txt b/apidocs/src/samples/db-flavors-response-json.txt index 120bc21e90..9026e13382 100644 --- a/apidocs/src/samples/db-flavors-response-json.txt +++ b/apidocs/src/samples/db-flavors-response-json.txt @@ -1,5 +1,5 @@ HTTP/1.1 200 OK Content-Type: application/json -Content-Length: 2730 +Content-Length: 2899 Date: Mon, 18 Mar 2013 19:09:17 GMT diff --git a/apidocs/src/samples/db-flavors-response.json b/apidocs/src/samples/db-flavors-response.json index 2690a90e49..29d8516c36 100644 --- a/apidocs/src/samples/db-flavors-response.json +++ b/apidocs/src/samples/db-flavors-response.json @@ -14,7 +14,8 @@ ], "name": "m1.tiny", "ram": 512, - "str_id": "1" + "str_id": "1", + "vcpus": 10 }, { "id": 2, @@ -30,7 +31,8 @@ ], "name": "m1.small", "ram": 2048, - "str_id": "2" + "str_id": "2", + "vcpus": 10 }, { "id": 3, @@ -46,7 +48,8 @@ ], "name": "m1.medium", "ram": 4096, - "str_id": "3" + "str_id": "3", + "vcpus": 10 }, { "id": 4, @@ -62,7 +65,8 @@ ], "name": "m1.large", "ram": 8192, - "str_id": "4" + "str_id": "4", + "vcpus": 10 }, { "id": 5, @@ -78,7 +82,8 @@ ], "name": "m1.xlarge", "ram": 16384, - "str_id": "5" + "str_id": "5", + "vcpus": 10 }, { "id": 6, @@ -94,7 +99,8 @@ ], "name": "m1.nano", "ram": 64, - "str_id": "6" + "str_id": "6", + "vcpus": 10 }, { "id": 7, @@ -110,7 +116,8 @@ ], "name": "m1.micro", "ram": 128, - "str_id": "7" + "str_id": "7", + "vcpus": 10 }, { "id": 8, @@ -126,7 +133,8 @@ ], "name": "m1.rd-smaller", "ram": 768, - "str_id": "8" + "str_id": "8", + "vcpus": 10 }, { "id": 9, @@ -142,7 +150,8 @@ ], "name": "tinier", "ram": 506, - "str_id": "9" + "str_id": "9", + "vcpus": 10 }, { "id": 10, @@ -158,7 +167,8 @@ ], "name": "m1.rd-tiny", "ram": 512, - "str_id": "10" + "str_id": "10", + "vcpus": 10 }, { "id": 11, @@ -174,7 +184,8 @@ ], "name": "eph.rd-tiny", "ram": 512, - "str_id": "11" + "str_id": "11", + "vcpus": 10 }, { "id": 12, @@ -190,7 +201,8 @@ ], "name": "eph.rd-smaller", "ram": 768, - "str_id": "12" + "str_id": "12", + "vcpus": 10 }, { "id": null, @@ -206,7 +218,8 @@ ], "name": "custom.small", "ram": 512, - "str_id": "custom" + "str_id": "custom", + "vcpus": 10 } ] } diff --git a/releasenotes/notes/flavor-list-vcpu-817b0f5715820377.yaml b/releasenotes/notes/flavor-list-vcpu-817b0f5715820377.yaml new file mode 100644 index 0000000000..fc705acb73 --- /dev/null +++ b/releasenotes/notes/flavor-list-vcpu-817b0f5715820377.yaml @@ -0,0 +1,3 @@ +--- +other: + - Add vCPUs column in flavor-list Bug 1261876. diff --git a/trove/flavor/views.py b/trove/flavor/views.py index b5be2494e0..1b85dfa4d9 100644 --- a/trove/flavor/views.py +++ b/trove/flavor/views.py @@ -40,6 +40,7 @@ class FlavorView(object): 'links': self._build_links(), 'name': self.flavor.name, 'ram': self.flavor.ram, + 'vcpus': self.flavor.vcpus, 'str_id': str(self.flavor.id), } diff --git a/trove/tests/api/flavors.py b/trove/tests/api/flavors.py index bda90e968c..bfeaaaa501 100644 --- a/trove/tests/api/flavors.py +++ b/trove/tests/api/flavors.py @@ -146,8 +146,8 @@ class Flavors(object): @test def test_flavor_list_attrs(self): - allowed_attrs = ['id', 'name', 'ram', 'links', 'local_storage', - 'str_id'] + allowed_attrs = ['id', 'name', 'ram', 'vcpus', 'links', + 'local_storage', 'str_id'] flavors = self.rd_client.flavors.list() attrcheck = AttrCheck() for flavor in flavors: @@ -159,8 +159,8 @@ class Flavors(object): @test def test_flavor_get_attrs(self): - allowed_attrs = ['id', 'name', 'ram', 'links', 'local_storage', - 'str_id'] + allowed_attrs = ['id', 'name', 'ram', 'vcpus', 'links', + 'local_storage', 'str_id'] flavor = self.rd_client.flavors.get(1) attrcheck = AttrCheck() flavor_dict = flavor._info