v2 and v2.1 is supported now and it ask user to use v2.x API
should be what we wanted , this already deprecated for a
couple of release, so we can remove it now
Change-Id: I8de6fdbf21ccc4969297044a49590ffcd9cd27d8
The image proxy API GET/DELETE methods are deprecated
at microversion 2.36 and will return a 404 after that.
This adds the wraps decorator to those python API methods
so set the cap at 2.35 so rather than get a 404 you'll
get a more uesful VersionNotFoundForAPIMethod.
Note that set_meta and delete_meta are not decorated
because we missed deprecating the image-metadata proxy API
with the 2.36 microversion. That will be fixed in Ocata.
Related to blueprint deprecate-api-proxies
Change-Id: Ie65efadb5c65e8a624ffd0315a634accd49f1c30
Current implementation of novaclient.api_versions.wraps allow to use
versioned methods for shell functions and resource managers. As resource
managers can have versioned methods, resource objects can have it too, but
it was not implemented yet. This patch fixes this omission.
Changes:
- Add api_version property to base resource class. It is mapped to
api_version property of manager class;
- Move `novaclient.utils.generate_function_name` to
`novaclient.api_versions._generate_function_name`, since this method is
specific to microversion stuff and should not used outside api_versions
module;
- Rewrite _generate_function_name to handle class(owner) name. Previously,
it was improssible to have two classes in one module with versioned
methods with equal names.
- Remove call of generate_function_name from novaclient.shell. Shell module
should not take care about function identifiers. get_substitutions accepts
object with __id__ property now.
- Mark _add_substitution as private method, since it should not be used
outside api_versions module
- Split all versioned methods of Server resource from novaclient.v2.servers
module.
Change-Id: Icfce16bfa6f919d7f8451d592f4a8e276b1f1709
This enables the use of the OpenStack-API-Version header, in
addition to the older X-OpenStack-Nova-API-Version header.
If the client knows that it is in a version less than 2.27, it
will not send the newer header.
If the client knows that is in a version >= 2.27 if it gets a
response that does not have the expected response header (the
newer one) it will warn. If it is in an older version, it will
warn about the other one missing.
A server that is 2.27 or beyond will accept both headers and
respond with both.
Change-Id: I1f7b1ca0fe795e4ecd333de761d96fff117969c0
Skip creating the formatted log message
if the message is not going to be emitted
because of the log level.
TrivialFix
Change-Id: Ic35b67bc43c77a086409bed57b846f729300d5c0
I8d599b712b17dcfc0be940a61c537d2dfe1b715b change provides a wrong fix for
an issue with cli arguments.
_find_actions method is designed to find all action methods(do_server_list,
do_server_show and etc). Since one module can include several versions of
one action(after microversion implementation) and only the last one will
be registrated in module, _find_actions method was adopted to handle
versioned methods.
Now it checks that discovered method is related to versioning stuff and
replace it by appropriate(in terms of microversions) functions. In this case,
the substituation is used only to determine function name and that it relates
to versioning methods. That is why the change(see a change-id above) is not
help at all.
We should share list object named "arguments"(it used by all action methods to
store cli arguments) with substitution and original method(which will be used
by _find_action). It will allow to put api_versions.wraps and cliutils.arg
decorators in any order.
Change-Id: Ief316a8597555db6cb02c9f23406b9f1f09f8313
novaclient should display help message of the proper versioned method
(based on api_version value).
Closes-Bug: #1523649
Closes-Bug: #1523651
Change-Id: I67f7fc2befde9d312400e9a1569e590bd763156e
There is a lot of H404/405 violations in novaclient, and it is better
to fix those to have a better doc string for class/methods.
This patch fixes these violations for below files-
-api_versions.py
-base.py
-client.py
As there are lot of violations and cannot be fixed in single patches,
So separating those in multiple patches for easy review.
Change-Id: I30a714fc3b0b317f7ffa4a99fbb224b4d5f5477b
Partial-Bug: #1521899
novaclient provides version negotiation on CLI layer. In case of usage
novaclient as a lib, user can specify api_version with microversion part
and can try communicate with Nova endpoint which doesn't support
microversions. Nova endpoint will not check X-OpenStack-Nova-API-Version
header and will execute request(it can be correct or not). It this case
we should warn user about his mistake and about "incorrect" response.
Change-Id: I7a5ab964b7b2b2a49cc80c22bf67ad5548afb30b
novaclient.api_versions.wraps decorator can be used in shell. Most of shell
function has cli arguments which are added via another decorator.
Currently, to keep this cli arguments, novaclient.api_versions.wraps
decorator should be used in the top of decorators. Something like:
@api_versions.wraps("123.456")
@cliutils.arg("name", help="Name of the something")
@cliutils.arg("action", help="Some action")
def do_something(cs, args):
pass
This patch adds ability to put api_versions.wraps decorator everywhere:
@api_versions.wraps("123.456")
@cliutils.arg("name", help="Name of the something")
@cliutils.arg("action", help="Some action")
def do_something_1(cs, args):
pass
@cliutils.arg("name", help="Name of the something")
@cliutils.arg("action", help="Some action")
@api_versions.wraps("123.456")
def do_something_2(cs, args):
pass
Related to bp api-microversion-support
Change-Id: I8d599b712b17dcfc0be940a61c537d2dfe1b715b
This patch adds version discovery when user request with latest version.
The latest version means the most recently version between server and
client.
Related to bp api-microversion-support
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I0b7a95e77371aef6e349bf54b5dd6ce6c6d2732c
New decorator "novaclient.api_versions.wraps" replaces original method with
substitution. This substitution searches for methods which desire specified
api version.
Also, this patch updates novaclient shell to discover versioned methods and
arguments.
Related to bp api-microversion-support
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I1939c19664e58e2def684380d64c465dc1cfc132
Compute API version will be transmitted to API side via
X-OpenStack-Nova-API-Version header, if minor part of version is presented.
New module "novaclient.api_versions" was added as storage for all api versions
related functions, classes, variables and etc.
`novaclient.api_versions.APIVersion` class is similar to
`nova.api.openstack.api_version_request.APIVersionRequest`. The main
difference relates to compare methods(method `cmp` is missed from Py3) and
processing "latest" version.
Related to bp api-microversion-support
Change-Id: I0e6574ddaec11fdd053a49adb6b9de9056d0fbac