Make use of a "sentinel" object to allow us to remove the use of kwargs
and provide a more helpful docstring. With any luck, Python will support
these objects natively in a future release [1].
[1] https://www.python.org/dev/peps/pep-0661/
Change-Id: I411c0393754c8fe8a6698f0d278b73f12209ace8
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
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
Instead of passing through whatever the user provides and exposing this
bug in the REST API, simply make the opt a boolean one in expectation of
a day where the API issues have been resolved.
This also introduces machinery necessary to use more of these types of
opts in the future.
Change-Id: I9033540ac65ac0ee7337f16bdd002060652092ea
Signed-off-by: Stephen Finucane <stephenfin@redhat.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
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>
A value of the '--config-drive' option must be a boolean value
on the 'nova boot' command because nova accepts a boolean value
only for the 'config_drive' parameter.
So add a check for the '--config-drive' option on the 'nova boot'
command.
Fix a description for 'config_drive' parameter
in the 'create' method of the novaclient.v2.ServerManager class.
Change-Id: Ic6e65139302fbb662fb6ba60e73633dad8ffb72e
Closes-Bug: #1825061
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
The api documentation is now published on docs.openstack.org instead
of developer.openstack.org. Update all links that are changed to the
new location.
Note that redirects will be set up as well but let's point now to the
new location.
For details, see:
http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007828.html
Change-Id: I53120e2ff3ae337a55c4cd0904bc9ad1dd54d082
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 microversion in Nova is added to support Neutron ports having
resource request during server create to guarantee minimum bandwidth
QoS. This is a behavior-only change in the compute API, there are no
changes to the server create request or response schema.
Change-Id: I1a39390015acd8703e8bab55af13f5c75ae226db
Depends-On: https://review.openstack.org/636360
Partial-Bug: #1578989
See-Also: https://review.openstack.org/502306 (nova spec)
See-Also: https://review.openstack.org/508149 (neutron spec)
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
When creating a server (the 'nova boot' command),
it calls 'POST /servers' API.
The response does not have 'addresses' and 'flavor' attributes.
When accessing 'networks' attribute in the '_print_server' function,
it calls 'GET /servers/{server_id}' and get the 'addresses' and
'flavor' attributes.
If 'GET /servers/{server_id}' fails, the server object does not have
the 'flavor' attribute, then KeyError is raised when accessing it.
Fix the issue by making it raise a CommandError
when the 'GET /servers/{server_id}' fails.
Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I3ef096c61b0e05a637ab0c4a1027338fa87e4f09
Closes-Bug: #1781368
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
It is impossible to provide a description to update method
in versions 2.0-2.18. But the docstring of the method says
that it can update a description.
Change-Id: I832e8a752779277a045bd127e2e6c6a3ae88f840
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
Some URLs are broken, so fix them.
The other URLs are redirect to new URLs,
so replace them with new ones.
Change-Id: Ida2fd70ad0d7b029fadfe91be14d7180b9b5b8d1
Closes-Bug: #1707104
`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
Methods `get_vnc_console`, `get_rdp_console`, `get_serial_console` and
`get_spice_console` of ServersManager have complitely equal code, args spec
and docstrings for 2.0-2.5 and 2.6+ microversions. There is no reason to
duplicate those methods, so this patch removes duplicates.
Change-Id: I8c0e6f1f9138958bdb5d840cfd89e584c89895b0
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 SecurityGroup resource object is left
since the list-secgroup command and
list_security_group servers API code
still uses that object. The
/servers/{server_id}/os-security-groups API
is a proxy to Neutron but was not deprecated
in microversion 2.36 so it's not yet deprecated
here in the client.
Change-Id: I6fa14f43d48f1e035ef54bd2d0078506f0c6d6e0
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
1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: I6289f46344876d19d9a6793875f896cedc85a01c
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
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