[proxy-api] microversion 2.39 deprecates image-metadata proxy API
Almost all proxy APIs were deprecated in microversion 2.36. But the sub-resource image-metadata of image was forgotten to deprecate. This patch deprecates the image-metdata API from 2.39. Image commands were already deprecated since 2.36 in I450917f7fcbfe0a3ea7921c82af9863e80cb40a1 Implements blueprint deprecate-image-meta-proxy-api Change-Id: Idd4cd1d1fec13f9e5f89dc419b57e094c9ad4b3b
This commit is contained in:
parent
56bb3dae5f
commit
75052a7afc
@ -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.38")
|
||||
API_MAX_VERSION = api_versions.APIVersion("2.39")
|
||||
|
40
novaclient/tests/functional/v2/test_image_meta.py
Normal file
40
novaclient/tests/functional/v2/test_image_meta.py
Normal file
@ -0,0 +1,40 @@
|
||||
# Copyright 2016 Mirantis, Inc.
|
||||
# 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 TestImageMetaV239(base.ClientTestBase):
|
||||
"""Functional tests for image-meta proxy API."""
|
||||
|
||||
# 'image-metadata' proxy API was deprecated in 2.39 but the CLI should
|
||||
# fallback to 2.35 and emit a warning.
|
||||
COMPUTE_API_VERSION = "2.39"
|
||||
|
||||
def test_command_deprecation(self):
|
||||
output = self.nova('image-meta %s set test_key=test_value' %
|
||||
self.image.id, merge_stderr=True)
|
||||
self.assertIn('is deprecated', output)
|
||||
|
||||
output = self.nova('image-meta %s delete test_key' %
|
||||
self.image.id, merge_stderr=True)
|
||||
self.assertIn('is deprecated', output)
|
||||
|
||||
def test_limits(self):
|
||||
"""Tests that 2.39 won't return 'maxImageMeta' resource limit and
|
||||
the CLI output won't show it.
|
||||
"""
|
||||
output = self.nova('limits')
|
||||
# assert that MaxImageMeta isn't in the table output
|
||||
self.assertRaises(ValueError, self._get_value_from_the_table,
|
||||
output, 'maxImageMeta')
|
@ -105,3 +105,19 @@ class ImagesTest(utils.FixturedTestCase):
|
||||
self.cs.api_version = api_versions.APIVersion('2.36')
|
||||
self.assertRaises(exceptions.VersionNotFoundForAPIMethod,
|
||||
self.cs.images.find, name="CentOS 5.2")
|
||||
|
||||
def test_delete_meta_2_39(self):
|
||||
"""Tests that 'delete_meta' method fails after microversion 2.39.
|
||||
"""
|
||||
self.cs.api_version = api_versions.APIVersion('2.39')
|
||||
self.assertRaises(exceptions.VersionNotFoundForAPIMethod,
|
||||
self.cs.images.delete_meta, 1,
|
||||
{'test_key': 'test_value'})
|
||||
|
||||
def test_set_meta_2_39(self):
|
||||
"""Tests that 'set_meta' method fails after microversion 2.39.
|
||||
"""
|
||||
self.cs.api_version = api_versions.APIVersion('2.39')
|
||||
self.assertRaises(exceptions.VersionNotFoundForAPIMethod,
|
||||
self.cs.images.set_meta, 1,
|
||||
{'test_key': 'test_value'})
|
||||
|
@ -1127,8 +1127,9 @@ class ShellTest(utils.TestCase):
|
||||
{'metadata': {'test_key': 'test_value'}})
|
||||
|
||||
def test_image_meta_del(self):
|
||||
self.run_command('image-meta %s delete test_key=test_value' %
|
||||
FAKE_UUID_1)
|
||||
_out, err = self.run_command('image-meta %s delete test_key' %
|
||||
FAKE_UUID_1)
|
||||
self.assertIn('Command image-meta is deprecated', err)
|
||||
self.assert_called('DELETE', '/images/%s/metadata/test_key' %
|
||||
FAKE_UUID_1)
|
||||
|
||||
@ -3097,6 +3098,7 @@ class ShellTest(utils.TestCase):
|
||||
34, # doesn't require any changes in novaclient
|
||||
37, # There are no versioned wrapped shell method changes for this
|
||||
38, # doesn't require any changes in novaclient
|
||||
39, # There are no versioned wrapped shell method changes for this
|
||||
])
|
||||
versions_supported = set(range(0,
|
||||
novaclient.API_MAX_VERSION.ver_minor + 1))
|
||||
|
@ -156,6 +156,7 @@ class ImageManager(base.ManagerWithFind):
|
||||
'or python-openstacksdk instead.', DeprecationWarning)
|
||||
return self._delete("/images/%s" % base.getid(image))
|
||||
|
||||
@api_versions.wraps('2.0', '2.38')
|
||||
def set_meta(self, image, metadata):
|
||||
"""
|
||||
DEPRECATED: Set an images metadata
|
||||
@ -171,6 +172,7 @@ class ImageManager(base.ManagerWithFind):
|
||||
return self._create("/images/%s/metadata" % base.getid(image),
|
||||
body, "metadata")
|
||||
|
||||
@api_versions.wraps('2.0', '2.38')
|
||||
def delete_meta(self, image, keys):
|
||||
"""
|
||||
DEPRECATED: Delete metadata from an image
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- Starting from microversion 2.39 'image-metadata' proxy API in Nova is
|
||||
deprecated and python API bindings will not work, although 'image-meta'
|
||||
CLI commands will still work, because of the fallback on the CLI to
|
||||
version 2.35.
|
Loading…
Reference in New Issue
Block a user