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
microversion 2.28 now returns a dict instead of a string for cpu_info item
returned by GET /os-hypervisors/<id>
Fortunately, the utils.flatten_dict() method checks whether it's a JSON field
so the behaviour keeps to be the same for the CLI output of nova hypervisor-show.
That said, the novaclient API call to HypervisorManager.get() will of course
be returning either a dict or a string for the keyed cpu_info given the
microversion.
Co-Authored-By: Andrey Kurilin <andr.kurilin@gmail.com>
Change-Id: I3a8bfcb7672005430ca99bab0d20e25f48a7e0f6
Implements: blueprint nova-api-hypervsor-cpu-info
Add the function to log 'x-openstack-request-id' or
'x-compute-request-id' in each API call.
If the caller (e.g. heat) uses oslo.log,
the caller's request id in oslo.context and
the callee's request id can be output in the same
log message (same line).
Change-Id: I29312ce278ecfae41a688a0ddf76c24cfa0eaf6b
Implements: blueprint log-request-id
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
From API micro version 2.14, evacuate does not need onSharedStorage
flag. This patch check the API micro version and set/ignore the
onSharedStorage flag before call evacuate for each instance.
Closes-Bug: #1581336
Change-Id: I825653d66f94d36a945b8240ec52285827423375
The --tenant option in the flavor-access-list command was
never implemented and filtering by tenant is not supported
in the REST API for os-flavor-access, so to avoid confusion
this change deprecates the command line option.
It also removes the cruft that was in the python API code
so that only 'flavor' is allowed. This it not a backward
incompatible change since list() still takes kwargs and still
raises a NotImplementedError for anything in kwargs but
'flavor'.
Change-Id: I2c36376674f3a7caf5967a16ac0152f17d9fc906
Closes-Bug: #1582284
This microversion allows to create/delete/update
server tags and to search servers by tags.
Implements: blueprint tag-instances
Change-Id: I66b6d4a763c507335f27a425bc3d4c2aae377c00
'name' should be an optional parameter not required
on aggregate-update, so we can update 'availability_zone' only.
Change-Id: I778ab7ec54a376c60f19dcc89fe62fcab6e59e42
Closes-bug: #1280118
If we specify --fields with default columns name, then there will
be an additional column which is absolutely redundant, we need to
check for such case.
Also do the same for "nova list"
Co-Authored-By: ZhiQiang Fan <aji.zqfan@gmail.com>
Change-Id: Ife0a62d2d77aee261ce39c30d3a89ba97a253dae
Closes-Bug: #1574424
Remove api_version check from get_servers_1234_migrations method
and substitute it by api_version.wraps decorator.
Change-Id: Iea780ae92bece4e2013778485d244123251e9dcc
This deprecates all of the image CLIs/python API bindings that use
the Nova os-images API which is a proxy to the Glance v1 API.
This will emit a warning each time a deprecated CLI/API is used and also
updates the help docs for the deprecated CLIs and docstrings for APIs.
The plan is to do a release once this is merged so people start seeing
it and then we'll actually remove the deprecated CLIs/APIs in the first
python-novaclient release after the Nova server 15.0.0 'O' release.
Depends-On: Iff5fb3180855de7adb3399f6be16bedc8543b4ec
Change-Id: I3f60cc7f4c6e27861c4a84b925d573f35f1a1848
The os-baremetal-nodes compute API does not proxy
baremetal node create/delete or interface add/remove
requests to Ironic, so there is no point in even
having CLIs or python bindings for these operations
in the client.
There isn't a point in deprecating these since they
are already unusable, so let's just remove them.
Change-Id: Id5dd7fbddff87e506460904e352713ae777a8073
Closes-Bug: #1566535
23f13437dd64496fcbc138bbaa9b0ac615a3cf23 deprecated the
purely volume or volume-snapshot related CLIs and python
API bindings during Kilo. python-cinderclient should be
used for the python API bindings now, and python-openstackclient
should be used for the CLI for those operations.
The alternate_service_type context manager is also removed
since it was only used for proxying through to the volume API
endpoint.
Since the proxy for creating volumes is removed, we have to
add python-cinderclient for testing the volume attachment
CLIs/APIs that are left intact.
Change-Id: I09a6501603667350f49b1b1fa130353a6d5272a2
All tests from contrib dir inizialize fakeclient at module level.
It is bad practice and we should do preparatory steps at setUp method.
Change-Id: I2dd2988cd015d1dfb576fe004cb9461b02b55db3
Finding by specify server group name failed in ServerGroupsManager.find(),
ServerGroup.NAME_ATTR is "server_group_name" currently, but NAME_ATTR
should be "name", because only "name" attribute exists in ServerGroup
object, not "server_group_name".
Change-Id: Id6b7676d14e6283d856a069da5ff287dc3228386
Closes-Bug: #1563301
Change I01b22593724616bc0a7793c509ecabf095d6927d made the
live_migrate() method in the ServerManager conditional on the
API version requested. This broke the host-evacuate-live
command which is calling ServerManager.live_migrate() directly
with one too many arguments for the v2.25 version of the method.
This updates the host-evacuate-live shell to behave like the
live-migration method and be aware of the API version when
calling the live_migrate() method.
Related to blueprint making-live-migration-api-friendly
Change-Id: I4dbeb6ebe03f03799b706be2d787d21484b5c664
Closes-Bug: #1561938
To show details of aggregate, we have
aggregate-details command. But all other
commands to show details of any resource
is *-show like flavor-show, keypair-show etc.
So changed the command to aggregate-show.
Change-Id: If4875833a27382a6f3193ec55d6d4cb1852249fd
Closes-Bug: #1552646
WebOb change https://github.com/Pylons/webob/pull/230 changed
the way in which the error response body is formatted such that
it's no longer a nested dict. So we have to handle both the
old convention of an error message key to the response body error
dict and the new way with just the error body dict.
This was reported upstream:
https://github.com/Pylons/webob/issues/235
But given this was apparently implemented as a long-overdue change
in WebOb the behavior is not likely to change.
Change-Id: If653a247d842786d2824b4b3a5c0cde1383ed7ab
Closes-Bug: #1559072
The shutdown value of the --block-device parameter was stated to
to be either 'remove' or 'preserve' but the code only coverted
everything to False that was not equal to 'remove'.
This patch adds strict validation that rejects values other than
'remove' or 'preserve'.
Closes-bug: #1558157
Change-Id: I89a6c4fe90ec4d8155f4a7b93006d1972654a223
Getting the access list of a public flavor bails out with a dramatic
error message, suggesting that something is broken. This changes the
message to an unagitated "Access list not available for public
flavors."
Change-Id: I432496c24b23de8fa58de93f2cbed8bed1d540b1
base.Resource's get function will call its manager's get() function
with one parameter. However UsageManager's get function takes three
parameters.
Change-Id: I958a55c4d52cec4d1177371b788b3cf788098a6c
Closes-bug: 1552616
We can use novaclient/utils directly and get rid
of openstack/common folder.
This is the first part.
Change-Id: Iaec234fbcf4d0f8c7e8f2175eae11d3083a62090
Partial-Bug: #1551603
microversion v2.25 will change parameter of os-migrateLive, this patch
adds supports to that changes.
os-migrateLive will abandon disk_over_commit and the default value of
block_migration will be set to `auto`
Depends-on: Ibb0d50f0f7444028ef9d0c294aea41edf0024b31
Implements: blueprint making-live-migration-api-friendly
Change-Id: I01b22593724616bc0a7793c509ecabf095d6927d
In Nova API microversion 2.24 there is a new operation which allows to
abort a running live migration.
This change is to enable this feature at the client side implementing a
new method to call the new nova API:
nova live-migration-abort <server_id> <migration_id>
Implements blueprint: abort-live-migration
Depends-On: I1ff861e54997a069894b542bd764ac3ef1b3dbb2
Change-Id: Ic2ead126e0cf48aa54a083e97cb9d1303a5a9bbd
1. Add two new commands
Add nova client server-migration-list and server-migration-show
2. Bump and old command
Add migration_type field for migration-list command
Partially implements blueprint live-migration-progress-report
Depends-On: Ia92ecbe3c99082e3a34adf4fd29041b1a95ef21e
Change-Id: I071198fa9ba0699383bdebf4fab54714a435e6c3
In API microversion 2.22 in Nova there is new ServerMigrations resource
that allows opertators to force on-going live migration to complete:
https://review.openstack.org/#/c/245921/
This patch implements new method in python-novaclient to take advantage
of the new API:
nova live-migration-force-complete <instance_id/name> <migration_id>
Change-Id: I823c20b4e0c7b63e905f564a7dff13d3fb314a26
Implements blueprint pause-vm-during-live-migration