Commit Graph

588 Commits

Author SHA1 Message Date
Rajesh Tailor 1f029ce578 Fix typos
Change-Id: Iaef3767dd9e7f43503dd8287b9b2345585bd87fb
2023-11-20 17:56:01 +05:30
Stephen Finucane 80ee69aa30 trivial: Remove use of kwargs
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>
2022-12-12 17:43:23 +00:00
Zuul cdea416cce Merge "Add support for 2.92 : keypair import mandatory" 2022-08-02 16:03:40 +00:00
Zuul 89a76edc8d Merge "Microversion 2.91: Support specifying destination host to unshelve" 2022-08-02 15:47:54 +00:00
Sylvain Bauza 2b5d989990 Add support for 2.92 : keypair import mandatory
Now, when creating a keypair, the 'public_key' parameter is now mandatory.

Depends-On: https://review.opendev.org/c/openstack/nova/+/849133
Implements: blueprint keypair-generation-removal

Change-Id: I03570d0a49b73021de91dc50b65b1bbf5d4b878b
2022-07-28 14:59:47 +02:00
René Ribaud ee9b277c5f Microversion 2.91: Support specifying destination host to unshelve
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
2022-07-28 14:49:46 +02:00
Stephen Finucane c408db2dd9 Update pre-commit hook, hacking versions
This was done with 'pre-commit autoupdate'. An invalid message is
removed from the requirements.txt files as it no longer applies with
pip's new dependency resolver.

Change-Id: I01c3ece51f81d67c740e6faca6b77df7c9932435
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2022-04-08 17:49:08 +09:00
Stephen Finucane 8066f8c745 Microversion 2.90 - Configurable hostnames
Change-Id: Icd4362a07196e59bafcdfaff44323ce1386d4f55
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Depends-On: https://review.opendev.org/c/openstack/nova/+/778550/
2021-09-02 11:01:07 +01:00
Lee Yarwood cfa172c4fd Microversion 2.89 - os-volume_attachments
Depends-On: https://review.opendev.org/c/openstack/nova/+/804275
Change-Id: If6275dbd3795047c111ac507a12b034e60029df8
2021-08-24 19:10:41 +01:00
Takashi Natsume 935fe75a66 Refactor constructing request body
Add a private static method to construct a request body
for create requests in the
novaclient.v2.volumes.VolumeManager class.

Change-Id: I884ad4b471e3d196255901499c75a1a2f0535f65
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2021-05-06 18:00:10 +09:00
Radomir Dopieralski d4399d3d36 When creating a client, pass the default logger
When a client is created without a logger, novaclient creates a
default logger, but it's then not used, because it's not passed
to the factory function. Because of that, all novaclient calls
are getting logged as 'keystoneauth.session' instead of
'novaclient.v2.client' as they should.

Closes-bug: 1921388
Change-Id: I53caceb08667eb12e27016731868e8015dd10e34
2021-03-25 15:12:29 +01:00
Stephen Finucane 54d4da112a Add support for microversion v2.88
The key change here is that the 'GET /os-hypervisors/{id}/uptime' API
will now returns a HTTP 404 starting in 2.88. The 'GET
/os-hypervisors/{id}' will instead now include an 'uptime' value. The
'novaclient.v2.hypervisors.HypervisorManager.uptime' method is updated
to handle this.

Change-Id: Ib99fbd820a586c14527ff64b319df0b7a44e1b8b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-03-02 12:14:12 +00:00
Takashi Natsume 9b474afdb2 Deprecate agent commands and APIs
The os-agents APIs have been removed by the following change.

  I9512f605dd2b3b0e88c951ed086250d57056303d

This patch makes commands related to the APIs deprecated
in accordance with the following policy.

* https://docs.openstack.org/python-novaclient/latest/contributor/deprecation-policy.html

The API bindings related to the APIs remains as they are
because python-openstackclient depends on the API bindings.

Change-Id: I89d7877e23e8802fe77987a7b24ea247e08d5218
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2021-01-13 14:43:51 +00:00
Takashi Natsume e93a00b24e Remove future imports
These particular imports are no longer needed
in a Python 3-only world.

Change-Id: I405b32c8cdd60fb19270a8f6fe2e2728022f7c6e
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-04-26 07:19:26 +00:00
zhangbailin 4d6c70d25d Microversion 2.85: Change volume-update CLI
This commit add a new CLI
``nova volume-update [--[no-]delete-on-termination]
<server> <src_volume> <dest_volume>`` to update
'delete_on_termination' for an attached volume, that the user can
decide whether to delete attached volumes when destroying the server.

Depends-On: https://review.opendev.org/#/c/711194/

Change-Id: I1fc64fb6e6611c92c6b72265e1bf4b32e9c45f0a
Blueprint: destroy-instance-with-datavolume
2020-04-09 08:52:05 +08:00
Stephen Finucane ea092b2988 Make 'server list --config-drive' a boolean option
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>
2020-04-08 17:27:33 +01:00
Victor Coutellier 9ee74d3ac6 Microversion 2.83 - Add more filters for the nova list command
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
2020-04-07 18:34:13 +02:00
Stephen Finucane 03dca4bc82 Don't print user_data for 'nova show'
User data is a blob of data that the user can specify when they launch
an instance. It's generally binary data, which means it's not something
we should show by default on the CLI. Stop doing that.

Change-Id: If8f6cc040d0077a7902a5fd425e67d74d7925a46
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Closes-Bug: #1669140
2020-02-26 13:48:11 +00:00
Stephen Finucane 8f50f84981 Bump to hacking 2.x
This is compatible with Python 3-only syntax.

Change-Id: I462f4242b9a5f8d8cd6b0cb3d328dfd9d93ba200
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-02-21 09:48:38 +00:00
Stephen Finucane c4c44bcb2d Remove six
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>
2020-02-21 09:48:38 +00:00
Dan Smith 71c29a184b Add aggregate-cache-images command and client routines
This adds the ability to request image precache support for an aggregate
in support of the matching server feature.

Related to blueprint image-precache-support

Depends-On: https://review.opendev.org/#/c/687140
Change-Id: Id354ccfa99e500a598685e6b794c12160ea2a990
2019-10-18 10:50:01 -07:00
Dan Smith e1bb4378db Add images.GlanceManager.find_images() bulk query
This adds a bulk query method to GlanceManager that takes multiple
image names or ids and attempts to query glance for all of them
in fewer requests than one-per-image.

Change-Id: I1c6ce27b65920356df6b7001c581a2922765ce0c
2019-10-18 10:49:53 -07:00
zhangbailin 8744bea0e3 Microversion 2.80: Add user_id/project_id to migration-list API
Add ``user_id`` and ``project_id`` to the ``GET /os-migrations``
API, and it can called ``--user-id <user_id>`` and/or
``--project-id <project_id>`` by ``nova migration-list`` CLI.

Showing the ``user_id`` and ``project_id`` when using api_version>=2.80
with the server-migration-list or server-migration-show APIs.

Depends-On: https://review.opendev.org/#/c/674243/
Part of blueprint add-user-id-field-to-the-migrations-table

Change-Id: I11343ca265ab2b6b6f46877897d8223ef340c258
2019-10-16 14:07:28 +00:00
Zuul 3f286e7d8c Merge "Clarify --migration-type migration value as cold migration" 2019-10-09 22:54:21 +00:00
Takashi NATSUME 364cad4191 Remove cells v1 and extension commands and APIs
The following CLIs and their backing API bindings
which have been deprecated since 20.0.0 Train release
have now been removed.

- list-extensions
- cell-capacities
- cell-show

Change-Id: I8e6edf1e4c1bf12d51ed993363129b4f4c3aa36c
2019-10-04 10:09:31 +09:00
Stephen Finucane 6954aacd54 Stop silently ignoring invalid 'nova boot --hint' options
The '--hint' option for 'nova boot' expects a key-value pair like so:

  nova boot --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ...

However, the command doesn't complain if this isn't the case, meaning
typos like the below aren't indicated to the user:

  nova boot --hint 245e1dfe-2d0e-4139-80a9-fce124948896

Due to how we'd implemented this here, this ultimately results in us
POSTing the following as part of the body to 'os-servers':

  {
    ...
    "OS-SCH-HNT:scheduler_hints": {
      "245e1dfe-2d0e-4139-80a9-fce124948896": null
    }
    ...
  }

Which is unfortunately allowed and ignored by nova due to the use of
'additionalProperties' in the schema [1]

Do what we do for loads of other options and explicitly fail on invalid
values.

[1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146

Change-Id: I0f9f75cba68e7582d32d4aab2f8f077b4360d386
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Closes-Bug: #1845322
2019-09-27 12:06:23 +00:00
Takashi NATSUME d1c5dc61d6 Add a check for --config-drive option on nova boot
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
2019-09-18 23:08:28 +00:00
zhangbailin cd396b8b61 Microversion 2.79: Add delete_on_termination to volume-attach API
Support add 'delete_on_termination' field to the voume attach API to
support configuring whether to delete the data volume when the server
is destroyed.

* Updating the ``nova volume-attachments`` command to show the
  ``delete_on_termination`` value if 2.79 or greater is used.
* The '--delete-on-termination' option is added to the `nova volume-attach`
  CLI.

Depends-On: https://review.opendev.org/#/c/673133/
Part of blueprint support-delete-on-termination-in-server-attach-volume

Change-Id: I8dcf2fd21a2fd99ca4e05bd953fbbe026be3a619
2019-09-09 12:43:42 -04:00
Yongli He aae95dcc7a Microversion 2.78 - show server topology
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
2019-09-06 17:24:17 -04:00
Zuul e43596ca5c Merge "Microversion 2.77: Support Specifying AZ to unshelve" 2019-08-29 14:33:17 +00:00
zhangbailin ecfa521b21 Microversion 2.77: Support Specifying AZ to unshelve
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
2019-08-28 17:43:22 -04:00
Matt Riedemann 96dcf13f46 Clarify --migration-type migration value as cold migration
This is a follow up to a review discussion [1] where the
"migration" value for the --migration-type option is for
a cold migration. This change just updates docs and help
strings.

An alternative is changing "migration" as a valid value to
"cold-migration" (or accept both) and under the covers treat
"cold-migration" as "migration" for the actual API call.

[1] https://review.opendev.org/#/c/675117/3/novaclient/v2/shell.py@5430

Related to blueprint more-migration-list-filters

Change-Id: I6baa6af8731252e3c4976db06f0ca9cdfcb5e2f1
2019-08-26 11:26:18 -04:00
Matt Riedemann 0e7c99c8ea Add --migration-type and --source-compute to migration-list
The GET /os-migrations API take a migration_type and source_compute
filter parameter on the request since the v2.0 API. This adds support
for specifying those parameters in the "nova migration-list" CLI
and related MigrationManager.list() python API binding methods.

A functional test is added which will cover the new options on all
three of the decorated do_migration_list shell methods with lower
bounds on 2.1, 2.59 and 2.66. Since the only type of migration we
can safely generate in a single-node CI job is a resize the test
does a resize. As such, _pick_alternate_flavor is moved into the
base test class for re-use.

Implements blueprint more-migration-list-filters

Change-Id: I4be9a06df3e0d40d3990d067ce112247a81b45b4
2019-08-08 18:13:33 -04:00
Matt Riedemann e281368c96 docs: clarify nova migration-list --host option
The GET /os-migrations API takes both a host and
source_compute filter parameter. The former filters
on either the source or destination compute, so this
change clarifies that in the command help for the
--host option.

Change-Id: I078add63896c7455be7e3672b7172debb962a5e2
2019-08-07 09:23:45 -04:00
Andreas Jaeger acef73c9bd Update api-ref location
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
2019-07-22 20:52:18 +02:00
Zuul d354c76bd2 Merge "Deprecate cells v1 and extension commands and APIs" 2019-07-15 13:24:14 +00:00
Zuul 0b02be5743 Merge "Remove deprecated methods and properties" 2019-07-15 13:11:55 +00:00
Takashi NATSUME 3ac90a5273 Deprecate cells v1 and extension commands and APIs
The API extension has been deprecated since 12.0.0 Liberty release (*1)
and the cells v1 has been deprecated since 16.0.0 Pike release (*2)
in the nova side.
The API extension has already been removed (merged into main
controllers and schema) since 19.0.0 Stein release (*3) and
the cells v1 APIs has already been removed since
Iddb519008515f591cf1d884872a5887afbe766f2.

In the python-novaclient side,
deprecate commands and API bindings related to
the API extension and the cells v1 at first.
Then the CLIs and API bindings will be removed in the first major
release after Nova 20.0.0 Train is released.

*1: I084444b11dceda7cf8f88c157aa67d36490fce49
*2: I1a173f7ce0715e684850e030c358e8175fa8724c
*3: https://review.opendev.org/#/q/topic:bp/api-extensions-merge-stein

Change-Id: I8dc4df95ac7f6974c5280e4107e449d04cd1402e
Closes-Bug: #1835699
2019-07-10 08:54:36 +09:00
zhu.boxiang 41c25881e6 Add host and hypervisor_hostname to create servers
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
2019-07-08 19:26:01 +00:00
Takashi NATSUME 81ec72ecf8 Remove deprecated methods and properties
Remove deprecated methods, properties and unused classes.

Change-Id: I16e0b6e55a9c9da04c4582f9be672018d37bf368
2019-07-04 04:06:42 +00:00
Zuul f6ef23f806 Merge "Allow searching for hypervisors and getting back details" 2019-05-27 04:28:18 +00:00
Zuul bdc49fb621 Merge "Set the lower limit of api_version for volume_type" 2019-05-23 14:38:16 +00:00
Zuul bdbd0df064 Merge "Allow passing negative values for the locked search_opt in cs.servers.list" 2019-05-23 03:13:33 +00:00
zhangbailin 7b9d300089 Set the lower limit of api_version for volume_type
In boot server API, the volume_type is supported by microversion 2.67.
Therefore, the lower limit of the volume_type should be added to the CLI
command, otherwise an exception will occur.

Co-Authored-By: Eric Xie <eric_xiett@163.com>

Closes-Bug: #1829854
Change-Id: Ie909c16568b017ca0acc802194140da7bece76c5
2019-05-23 08:18:04 +08:00
Surya Seetharaman f78a4706d3 Allow passing negative values for the locked search_opt in cs.servers.list
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
2019-05-22 11:06:52 -04:00
Matt Riedemann 0dc6b96ec8 Allow searching for hypervisors and getting back details
The 2.53 microversion allows listing hypervisors with
details and filtering on a hypervisor_hostname substring
pattern match.

This makes the python API binding HypervisorManager.search
method allow that as well by adding a new 'detailed' boolean
kwarg which defaults to False for backward compatibility for
the /search and /servers routes before 2.53, but allows
searching and getting detailed results back as well.

Change-Id: I81fa4520af3cc7f1298c262f4fdc4e15fbc6d7ba
2019-05-18 14:47:11 -04:00
Zuul dfb84228a2 Merge "Optimize limit option docs string description for novaclient" 2019-05-17 15:24:11 +00:00
chenke 2ecb39710f Optimize limit option docs string description for novaclient
Change-Id: I85ee36b0447869771782d1059957a46447940b59
2019-05-17 11:01:30 +08:00
Surya Seetharaman f0388977c1 [Docs] Update client docs to add reason and locked options
This patch adds information about the ``locked`` filter/sorting key
and the ``reason`` options that were added in
https://review.opendev.org/#/c/648659/.

Related to blueprint add-locked-reason

Change-Id: I11cc4bd7cee0f03d4398f91bb3790c4c681061f4
2019-05-14 11:31:46 +02:00
Surya Seetharaman a1ac69c69a Microversion 2.73: Support adding the reason behind a server lock
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
2019-05-13 14:37:43 +02:00