Microversion 2.75 - Multiple API cleanup changes
Add support microversion 2.75 which implement multiple API cleanup changes. 1. Making server representation always consistent among all APIs returning the complete server representation. - Test cases added. 2. Change the default return value of ``swap`` field from the empty string to 0 (integer) in flavor APIs. - Test cases added. Nova side path: https://review.opendev.org/#/c/666889/ Change-Id: Iec2cfc629dffd53178ef88a31fcd16a3f32e2e27 Partial-Implements: blueprint api-consistency-cleanup
This commit is contained in:
parent
e281368c96
commit
0e873a2d5a
@ -25,4 +25,4 @@ API_MIN_VERSION = api_versions.APIVersion("2.1")
|
||||
# when client supported the max version, and bumped sequentially, otherwise
|
||||
# the client may break due to server side new version may include some
|
||||
# backward incompatible change.
|
||||
API_MAX_VERSION = api_versions.APIVersion("2.74")
|
||||
API_MAX_VERSION = api_versions.APIVersion("2.75")
|
||||
|
72
novaclient/tests/functional/v2/test_flavor.py
Normal file
72
novaclient/tests/functional/v2/test_flavor.py
Normal file
@ -0,0 +1,72 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from novaclient.tests.functional import base
|
||||
|
||||
|
||||
class TestFlavorNovaClientV274(base.TenantTestBase):
|
||||
"""Functional tests for flavors"""
|
||||
|
||||
COMPUTE_API_VERSION = "2.74"
|
||||
# NOTE(gmann): Before microversion 2.75, default value of 'swap' field is
|
||||
# returned as empty string.
|
||||
SWAP_DEFAULT = ""
|
||||
|
||||
def _create_flavor(self, swap=None):
|
||||
flv_name = self.name_generate()
|
||||
cmd = 'flavor-create %s auto 512 1 1'
|
||||
if swap:
|
||||
cmd = cmd + (' --swap %s' % swap)
|
||||
out = self.nova(cmd % flv_name)
|
||||
self.addCleanup(self.nova, 'flavor-delete %s' % flv_name)
|
||||
return out, flv_name
|
||||
|
||||
def test_create_flavor_with_no_swap(self):
|
||||
out, _ = self._create_flavor()
|
||||
self.assertEqual(
|
||||
self.SWAP_DEFAULT,
|
||||
self._get_column_value_from_single_row_table(out, "Swap"))
|
||||
|
||||
def test_update_flavor_with_no_swap(self):
|
||||
_, flv_name = self._create_flavor()
|
||||
out = self.nova('flavor-update %s new-description' % flv_name)
|
||||
self.assertEqual(
|
||||
self.SWAP_DEFAULT,
|
||||
self._get_column_value_from_single_row_table(out, "Swap"))
|
||||
|
||||
def test_show_flavor_with_no_swap(self):
|
||||
_, flv_name = self._create_flavor()
|
||||
out = self.nova('flavor-show %s' % flv_name)
|
||||
self.assertEqual(self.SWAP_DEFAULT,
|
||||
self._get_value_from_the_table(out, "swap"))
|
||||
|
||||
def test_list_flavor_with_no_swap(self):
|
||||
self._create_flavor()
|
||||
out = self.nova('flavor-list')
|
||||
self.assertEqual(
|
||||
self.SWAP_DEFAULT,
|
||||
self._get_column_value_from_single_row_table(out, "Swap"))
|
||||
|
||||
def test_create_flavor_with_swap(self):
|
||||
out, _ = self._create_flavor(swap=10)
|
||||
self.assertEqual(
|
||||
'10',
|
||||
self._get_column_value_from_single_row_table(out, "Swap"))
|
||||
|
||||
|
||||
class TestFlavorNovaClientV275(TestFlavorNovaClientV274):
|
||||
"""Functional tests for flavors"""
|
||||
|
||||
COMPUTE_API_VERSION = "2.75"
|
||||
# NOTE(gmann): Since microversion 2.75, default value of 'swap' field is
|
||||
# returned as 0.
|
||||
SWAP_DEFAULT = '0'
|
@ -343,3 +343,44 @@ class TestInterfaceAttach(base.ClientTestBase):
|
||||
self.assertEqual(
|
||||
self.network.id,
|
||||
self._get_value_from_the_table(output, 'net_id'))
|
||||
|
||||
|
||||
class TestServeRebuildV274(base.ClientTestBase):
|
||||
|
||||
COMPUTE_API_VERSION = '2.74'
|
||||
REBUILD_FIELDS = ["OS-DCF:diskConfig", "accessIPv4", "accessIPv6",
|
||||
"adminPass", "created", "description",
|
||||
"flavor", "hostId", "id", "image", "key_name",
|
||||
"locked", "locked_reason", "metadata", "name",
|
||||
"progress", "server_groups", "status", "tags",
|
||||
"tenant_id", "trusted_image_certificates", "updated",
|
||||
"user_data", "user_id"]
|
||||
|
||||
def test_rebuild(self):
|
||||
server = self._create_server()
|
||||
output = self.nova("rebuild %s %s" % (server.id, self.image.name))
|
||||
for field in self.REBUILD_FIELDS:
|
||||
self.assertIn(field, output)
|
||||
|
||||
|
||||
class TestServeRebuildV275(TestServeRebuildV274):
|
||||
|
||||
COMPUTE_API_VERSION = '2.75'
|
||||
REBUILD_FIELDS_V275 = ['OS-EXT-AZ:availability_zone', 'config_drive',
|
||||
'OS-EXT-SRV-ATTR:host',
|
||||
'OS-EXT-SRV-ATTR:hypervisor_hostname',
|
||||
'OS-EXT-SRV-ATTR:instance_name',
|
||||
'OS-EXT-SRV-ATTR:hostname',
|
||||
'OS-EXT-SRV-ATTR:kernel_id',
|
||||
'OS-EXT-SRV-ATTR:launch_index',
|
||||
'OS-EXT-SRV-ATTR:ramdisk_id',
|
||||
'OS-EXT-SRV-ATTR:reservation_id',
|
||||
'OS-EXT-SRV-ATTR:root_device_name',
|
||||
'host_status',
|
||||
'OS-SRV-USG:launched_at',
|
||||
'OS-SRV-USG:terminated_at',
|
||||
'OS-EXT-STS:task_state', 'OS-EXT-STS:vm_state',
|
||||
'OS-EXT-STS:power_state', 'security_groups',
|
||||
'os-extended-volumes:volumes_attached']
|
||||
|
||||
REBUILD_FIELDS = TestServeRebuildV274.REBUILD_FIELDS + REBUILD_FIELDS_V275
|
||||
|
@ -4275,6 +4275,7 @@ class ShellTest(utils.TestCase):
|
||||
71, # There are no version-wrapped shell method changes for this.
|
||||
72, # There are no version-wrapped shell method changes for this.
|
||||
74, # There are no version-wrapped shell method changes for this.
|
||||
75, # There are no version-wrapped shell method changes for this.
|
||||
])
|
||||
versions_supported = set(range(0,
|
||||
novaclient.API_MAX_VERSION.ver_minor + 1))
|
||||
|
18
releasenotes/notes/microversion-v2_75-ea7fa3ba1396edea.yaml
Normal file
18
releasenotes/notes/microversion-v2_75-ea7fa3ba1396edea.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Added support for `microversion 2.75`_. The following changes were made:
|
||||
|
||||
- Return all fields of ``server`` in ``nova rebuild`` command which are
|
||||
returned in ``nova show``. Both command will return the same set of
|
||||
fields of ``server`` representation.
|
||||
|
||||
- Default return value of ``swap`` field will be 0 (integer) in below
|
||||
commands:
|
||||
|
||||
- ``nova flavor-list``
|
||||
- ``nova flavor-show``
|
||||
- ``nova flavor-create``
|
||||
- ``nova flavor-update``
|
||||
|
||||
.. _microversion 2.75: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id67
|
Loading…
Reference in New Issue
Block a user