This patch adds ``host`` to novaclient api.
This can help administrators to specify a ``host``
to unshelve a shelve offloaded server from 2.91 microversion.
Depends-On: https://review.opendev.org/c/openstack/nova/+/831507
Implements: blueprint unshelve-to-host
Change-Id: I7efc8f0b0ef159e16cefee761bff5d7e90d0c427
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I4d45ae17f6f84f945f5dd049a929216ce6b6b58e
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
Add these new filters, admin-only until microversion 2.82:
- availability-zone
- config-drive
- key-name
- power-state
- task-state
- vm-state
- progress
Existing user filter will be available to non admin since microversion
2.83.
Part of blueprint non-admin-filter-instance-by-az
Change-Id: Id2b5e600c0a41790830823031b20983808cb5ace
Remove some cruft from Sphinx config files, drop the use of 'u' prefixed
strings, which are unnecessary in Python 3, and generally tidy stuff up.
Change-Id: Ib0f33576e160ec842d7fc82b4fcfee99829623d7
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Mostly a find-replace job. Let's do this now so we don't have to carry
it for the next decade.
Change-Id: I7bef9fb7c6895f746cee1aca6522786f38b9857c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Add support microversion 2.78 which adds server topology
information in the output of the following new command:
nova server-topology
Depends-on: https://review.opendev.org/#/c/621476/
Change-Id: I6467d52d2528a37348458baf4842b571a97f3ed2
Implements: blueprint show-server-numa-topology
This patch adds a new parameter ``--availability-zone`` to ``nova
unshelve`` command. This can help users to specify an ``availability_zone``
to unshelve a shelve offloaded server from 2.77 microversion.
Depends-On: https://review.opendev.org/#/c/663851/
Implements: blueprint support-specifying-az-when-restore-shelved-server
Change-Id: I8bce8f430bc54f03bacc105e37fc8b3bbf2432c2
Adds the --host and --hypervisor-hostname options to
the nova boot command and related python API bindings.
Depends-On: https://review.opendev.org/#/c/645520/
Change-Id: If16d00b75f4d5f2b96aa6e3f32a973108049d928
Blueprint: add-host-and-hypervisor-hostname-flag-to-create-server
This patch adds support for novaclient to pass the "locked" search_opts
with a "False" value upto the server side. This is required for the OSC
change[1] to support the "unlocked" filter parameter.
[1] https://review.opendev.org/#/c/659124/
Related to blueprint add-locked-reason
Change-Id: I0907f4ad2decb308c9db8b0cf9e7962bf1b517b5
This patch adds a new parameter ``--reason`` to ``nova lock``
command and ``--locked`` filtering/sorting parameter to
``nova list`` command. This can help users to provide a reason
when locking the server and to filter/sort instances based on their
locked or value from 2.73 microversion.
Implements blueprint add-locked-reason
Depends-On: https://review.opendev.org/#/c/648662/
Change-Id: I438e6db2dd5000ba388d0a0f1c8ab74b96b47a71
This changes the Server.networks property method to return
an OrderedDict where the keys (network labels) are sorted
which will allow for a predictable sort order on the resulting
networks attached to a Server resource.
This affects the output of "nova list" and "nova show" commands
so a simple release note is added to mention the change.
Change-Id: I2e9b3c6a256509c045966035da24d58628f1b33b
Add output of a result in the 'nova interface-attach'
command when it is successful.
Make the following methods return a 'NetworkInterface'
object instead of a 'Server' object.
* The 'interface_attach' method
in the 'novaclient.v2.Server' class
* The 'interface_attach' method
in the 'novaclient.v2.ServerManager' class
Remove unnecessary code in the 'nova interface-detach'
command because the response body is not returned.
Change-Id: Id5316d8ad4a4b67e8399b51e602aafc83bc128c6
Closes-Bug: #1816511
Update the commands and Python API bindings to reflect the new
microversion. The various evacuate microversion functions are DRY'd up
along the way.
Change-Id: Ibfc905292258ffde05800387e5d6bbad4823085c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Depends-On: https://review.openstack.org/#/c/634600/
Implements: blueprint remove-force-flag-from-live-migrate-and-evacuate
The 'nova get-password' command shows a passowrd as bytes
instead of string in Python 3 currently.
It should be shown as string.
So fix it.
Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: Ibcfb071fcc3c74535b800295ec95ca5ec8bc3c9b
Closes-Bug: #1794167
This adds the nova boot command and python API binding
support for creating a server with block device mappings
defined using a specific volume type.
Depends-On: https://review.openstack.org/606398/
Depends-On: https://review.openstack.org/#/c/610349/
Part of blueprint boot-instance-specific-storage-backend
Change-Id: I484ee065119b5783db212ea64efa60e87c40338c
This change adds a `--trusted-image-certificate-id` option to the
`nova boot` and `nova rebuild` commands. This option takes in a
a single trusted certificate ID. The option may be used multiple times
to specify multiple trusted certificate IDs, which will be
used to validate certificates in the image signature verification
process. If ID values are not specified using this option, the value of
the newly added OS_TRUSTED_IMAGE_CERTIFICATE_IDS environment variable
will be used instead. This value will be converted into a list before
being passed on.
The ``nova rebuild`` command also gets a new
``--trusted-image-certificates-unset`` option to unset/reset the
trusted image certificates in a server during rebuild. This is
similar to unsetting key_name and user_data during rebuild.
Corresponding `trusted_image_certificates` kwarg has been added to the
server create and rebuild Python API bindings.
Co-Authored-By: Brianna Poulos <Brianna.Poulos@jhuapl.edu>
Co-Authored-By: Matt Riedemann <mriedem.os@gmail.com>
Change-Id: I235541a689732826950c7b2a510d5835211120c3
Implements: blueprint nova-validate-certificates
This reverts commit eff607ccef.
There was no apparent need for the change being reverted since
user can list all servers by specifying --limit=1 when running
the nova list command.
The change introduced a problem whereby the first pass to
list instances from the server would get up to
[api]/max_limit (default 1000) results and then call again
with a marker. If the last instance in the list (the marker)
is corrupted in the instance_mappings table in the API DB
by not having an associated cell mapping, listing instances
will always fail with a MarkerNotFound error even though
the CLI user is not passing a marker nor specifying
--limit=-1. The corrupted instance mapping record resulting
in the MarkerNotFound error is something else that should
be fixed on the server side (and likely result in a 500) but
the change in behavior of the CLI makes it always fail
if you hit this even if you're not passing a marker.
Change-Id: Ibb43f500a74733b85bd3242592d36985bfb45856
Closes-Bug: #1773945
Output of `nova list` command contained only `max_limit` entries even
when there were more. The list needs to be obtained in multiple
requests and the paging loop was terminated prematurely.
Change-Id: I4194e6d5e34ecc0ac704851c08bb895e223aa850
Closes-Bug: 1743532
With the 2.57 microversion, we:
* Deprecate the --file option from the nova boot and
nova rebuild CLIs and API bindings.
* Add --user-data and --user-data-unset to the nova rebuild
CLI and API bindings.
* Deprecate the maxPersonality and maxPersonalitySize fields
from the nova limits and nova absolute-limits CLIs and API
bindings.
* Deprecate injected_files, injected_file_content_bytes, and
injected_file_path_bytes from the nova quota-show,
nova quota-update, nova quota-defaults, nova quota-class-show,
and nova quota-class-update CLIs and API bindings.
Part of blueprint deprecate-file-injection
Change-Id: Id13e3eac3ef87d429454042ac7046e865774ff8e
The add-fixed-ip, remove-fixed-ip, floating-ip-associate,
floating-ip-disassociate, and virtual-interface-list CLIs
and related python API bindings were deprecated in the 9.0.0
release in Pike via change Ie76283962c375b735f30ccb3053db07cf2330de2.
This removes the CLIs and related python API bindings and will go
into the 10.0.0 release.
Change-Id: Icb667973c65d26395db660b1c7b919550db66d08
Adds support for microversion 2.54 which adds resetting keypair and
unsetting keypair in rebuild operation.
Adds optional ``--key-name`` and ``--key-unset`` options
in the ``nova rebuild`` command.
The ``--key-name`` and ``--key-unset`` cannot be specified
at the same time.
Change-Id: Ie2a39bb29dd59c070adc94e79ea0f6473227a427
Implements: blueprint rebuild-keypair-reset
os-volumes_boot is an old clone of /servers and is not documented in the
API docs. POST to /servers.
Change-Id: If0161a89877f19f24e91d780cf227fdc48e7e860
`novaclient.servers.boot` accepts 'nics' argument with information about
network interfaces to attach. Originally, it accepts a list or a string.
In case if a list value, the proper method iterates over it for
processing and constructs a right structure for Nova-API. A tuple type
is similar to a list type in the processing method and can look more
logical for some developers (a tuple is a sequence of immutable python
object, which can be ideal for predefined nics) and doensn't require
anything to change in code except one validation check.
Also, this patch adds more info in the error message for validation
step.
Change-Id: Ief9d22fefb0a64afc346c56e832c6c0b2b3d8fcb
This adds support for microversion 2.45 which changes the response
on the createImage and createBackup server action APIs to return
the image_id for the created snapshot image in a json dict in the
response body rather than in a Location header (which is gone in
microversion >= 2.45).
Since the 'nova backup' command was not printing out the created
image ID before, that is also added in this microversion.
Part of blueprint remove-create-image-location-header-response
Change-Id: Id48aa7b14e2d25008287549b04db437ca9c3f548
The 2.44 microversion deprecates the addFixedIP, removeFixedIP,
addFloatingIP, removeFloatingIP server action APIs and
os-virtual-interfaces API.
This change deprecates the CLIs and python API bindings in novaclient.
Implements blueprint deprecate-multinic-proxy-api
Change-Id: Ie76283962c375b735f30ccb3053db07cf2330de2
These were deprecated in Newton:
aaebeb05a0
The floating IP fixtures and GET API methods in the
manager are still used for testing the addFloatingIP
and removeFloatingIP server operations, so the manager
is moved to the test_servers module.
Change-Id: I2138e43160772c7c896bc5e93195a8169ebfe6c3
Heat wants to use 'novaclient.v2.servers.
ServerManager._console' method to simplify the
implementation of retrieving server console.
It's better to change the method to public for
public use.
The patch changes:
1. add public method named get_console_url() for class
'novaclient.v2.servers.Server'
2. rename _console() to get_console_url() for class
'novaclient.v2.servers.ServerManager'
Change-Id: I3d1485468d1d0a79d4002981ebe05b6cdf2332e7
Closes-Bug: #1651677
In line with other clients testing we've found that having the
requests-mock fixture at self.requests can be misleading for new people
as it looks like you're calling requests itself.
Also make use of some of the new features of requests-mock like query
parsing, json handling, method names.
Change-Id: Id61b88c53478d49f91c3f880ed5b90d638051ba0
This adds support for the v2.37 microversion. The networks
part of the server create request is required in this
microversion so if nothing is specified for --nic arguments
on the command line we default to 'auto' for backward
compatibility in the CLI.
Part of blueprint get-me-a-network
Change-Id: I6636ddcd3be7bf393d2d69cc6c1ba5c7d65ff674
Set APIVersion in the base test class instead of
in every derived test class.
Change-Id: Ifbc6af6f1e42033c9ad8923cb063d345e520fb00
Co-Authored-By: Andrey Kurilin <akurilin@mirantis.com>
In order to support virtual device role tagging that was introduced in
microversion 2.32, this patch adds:
* The 'tag' key to the --nic flag when booting an instance.
* The 'tag' key to the --block-device flag when booting an instance.
Change-Id: I1866c670994254bc2849b494e318f4ff8cc44eb7
Implements: blueprint virt-device-role-tagging
Now the os-migrateLive API supports a new body argument called 'force' which
helps the operators to bypass the scheduler call in case they provide a host.
Also modifies the host_evacuate_live helper method in the contrib tree to make
sure operators also have the force flag in case they need it for a global call.
Change-Id: Id7fcd88ad060390ac6d1a21510d84363ed643957
Implements: blueprint check-destination-on-migrations-newton
Now the os-evacuate API supports a new body argument called 'force' which
helps the operators to bypass the scheduler call in case they provide a host.
Also modifies the host_evacuate helper method in the contrib tree to make sure
operators also have the force flag in case they need it for a global call.
Change-Id: I5272e9809a7d8be482e87548c6a3b11186c5d1e1
Partially-Implements: blueprint check-destination-on-migrations-newton
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 microversion allows to create/delete/update
server tags and to search servers by tags.
Implements: blueprint tag-instances
Change-Id: I66b6d4a763c507335f27a425bc3d4c2aae377c00
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
2.19 - Allow the user to set and get the server description. The user will
be able to set the description when creating, rebuilding, or updating
a server, and get the description as part of the server details.
Methods `rebuild` and `create` of novaclient.v2.servers.ServerManager were
not wrapped with `api_versions.wraps` decorator to reduce code and docsting
duplication. Version checks added inside these methods.
Change-Id: I75b804c6edd0cdf02c2cd002d0b5968fec8da545
Currently, users must use different interface to get request_ids.
1. Commonly, ListWithMeta, DictWithMeta or TupleWithMeta, etc is
returned to user. And request_ids is returned as an attribute of
*WithMeta.
For a server delete action:
result = serverManager.delete(server)
# result = TupelWithMeta
request_ids = result.request_ids
2. Some places reutrn a tuple which contains request_ids in one of
its elements.
For a server stop action:
result = serverManager.stop(server)
# result = (Response, TupleWithMeta)
request_ids = result[1].request_ids
Such kind of difference makes user confused.
This change provides a backwards compatibility solution for users
who don't care about request_ids as TupleWithMeta is subclass of
tuple.
Change-Id: I164bb95abce6dc96cf455033f02822ccb0d87b8f
Closes-Bug: 1542179
Add return-request-id-to-caller function to
'Server' resource and 'ServerManager'.
The methods in the resource class and resource manager return
a wrapper class that has 'request_ids' property.
The caller can get request ids of the callee via the property.
* novaclient/v2/servers.py
Co-authored-by: Ankit Agrawal <ankit11.agrawal@nttdata.com>
Change-Id: I8c2d3abcebba7823f42e2f27356e73bc6d7ade42
Implements: blueprint return-request-id-to-caller
Description of microversion:
Add a new API for triggering crash dump in an instance. Different operation
systems in instance may need different configurations to trigger crash dump.
Note:
- it is hard to write a functional test for this microversion, since it
requires instance in error state
- all possible failed responses already covered by novaclient.exceptions
Nova's change: I6ed777ff637254b4b79417008f9055dd19fc7405
Change-Id: If03b1864bbe7074c720b946fc2700bd5d07debc3