Commit Graph

128 Commits

Author SHA1 Message Date
Rajesh Tailor 1f029ce578 Fix typos
Change-Id: Iaef3767dd9e7f43503dd8287b9b2345585bd87fb
2023-11-20 17:56:01 +05:30
Takashi Natsume be9517cb02 Fix a fixture for keypairs tests
This patch is a follow-up for
I03570d0a49b73021de91dc50b65b1bbf5d4b878b.

The following file is for shell (CLI) tests,
so it does not need to be changed anymore.

* novaclient/tests/unit/v2/fakes.py

Change-Id: I3b1cf5d402b04854177265f2ba429956edb73203
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2022-08-05 23:58:30 +09: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 01c7a3aa10 tests: Add missing 'nova update' unit tests
We have functional tests for the 'nova update' commands, but no unit
tests to verify e.g. that we can't set a description for the server
before microversion 2.19. Add such tests.

Change-Id: I9af89655a7e7276446a881fd28d21ddd6581048c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-09-02 10:50:52 +01:00
Takashi Natsume 2ed34e657c Remove unused code
The code has not been used
since If0161a89877f19f24e91d780cf227fdc48e7e860 .

Change-Id: I106404f9d12814fec2ec2bf16cdd100834085912
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-07-31 11:28:24 +00:00
Takashi Natsume 7ef2c28bf3 Use unittest.mock instead of third party mock
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>
2020-04-26 10:12:09 +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
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
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
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
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
Takashi NATSUME b2cd7e12cc Microversion 2.71 - show server group
Add support microversion 2.71 which adds server group
information in the output of the following commands.

* nova show
* nova rebuild

The 'nova update' command does not output its result
when it is successful.
So there is no change for the command.

The patch for microversion 2.71 in the nova side is
I4a2a584df56ece7beb8b12c0ce9b0e6b30237120.

Change-Id: Id324486b5ef32615881085cd46772aa55c245ac6
Implements: blueprint show-server-group
2019-03-04 12:00:22 -05:00
Matt Riedemann de22cdd3c8 Add support for microversion 2.70 - expose device tags
This adds support for microversion 2.70 which exposes
the 'tag' field in the following APIs:

* GET /servers/{server_id}/os-volume_attachments
* GET /servers/{server_id}/os-volume_attachments/{volume_id}
* POST /servers/{server_id}/os-volume_attachments
* GET /servers/{server_id}/os-interface
* GET /servers/{server_id}/os-interface/{port_id}
* POST /servers/{server_id}/os-interface

Which corresponds to showing the tag in the output of
the following commands:

* nova volume-attachments
* nova volume-attach
* nova interface-list
* nova interface-attach

Depends-On: https://review.openstack.org/631948/

Part of blueprint expose-virtual-device-tags-in-rest-api

Change-Id: I5e9d7e0219605503a56d2cf745b95c6e05d01101
2019-02-28 12:07:25 -05:00
Zuul caf1f6203a Merge "Handle unicode multi-byte characters" 2019-02-25 18:32:28 +00:00
asmita singh 4450e7ba31 Handle unicode multi-byte characters
If you pass unicode multi-byte character to 'hypervisor-list'
and 'instance-usage-audit-log' commands using --matching
and --before options respectively, it returns keyerror.

This patch fixes these issues by encoding the host name and
date passed to the --matching and --before options
respectively.

Closes-Bug: #1804156

Change-Id: I9587af7e0fdd921fcaebe3e5c6c5bb40a9393e01
2019-02-22 05:32:49 +00:00
Surya Seetharaman 14a45183ee API microversion 2.69: Handles Down Cells
This patch explicitly points out the change needed while
forming the detailed lists for embedded flavor information.
In those cases where the server response for nova list
has the flavor key missing for the instances in the down cell,
the servers will be skipped.

Depends-On: https://review.openstack.org/591657/

Related to blueprint handling-down-cell

Change-Id: I007d9a68309b0d3aa85a4edf5026043154d4f42a
2019-02-20 11:58:39 -05:00
Takashi NATSUME 80b4286981 Replace MB with MiB
Change-Id: Ie5bd325d8e0f7e9af76c1ddae1d679b0e797c84b
2018-10-22 07:11:25 +00:00
Yikun Jiang 6c398058a6 Microversion 2.64 - Use new format policy in server group
Added support for microversion 2.64, which includes the
following changes:

- The ``--rule`` option is added to the
``nova server-group-create`` CLI that enables user to create
server group with specific policy rules.

- Remove ``metadata`` column in the output of
``nova server-group-create``, ``nova server-group-get``,
``nova server-group-list``.

- Remove ``policies`` column, , add ``policy`` and ``rules``
columns in the output of ``nova server-group-create``,
``nova server-group-get``, ``nova server-group-list``.

Depends-On: 3cd26f1e68b09ba7925e794ac8912566c239b6df
blueprint: complex-anti-affinity-policies

Change-Id: I903f4b5544806b9d3c8bac529448abbc9dd3cee9
2018-07-18 10:30:00 -04:00
Zuul 0cb0ffa32d Merge "Revert "Fix listing of instances above API max_limit"" 2018-06-06 03:59:06 +00:00
Matt Riedemann abaa86fd86 Revert "Fix listing of instances above API max_limit"
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
2018-06-05 19:57:49 +00:00
Takashi NATSUME 229d0df752 Microversion 2.61 - support extra_specs in flavor API
Starting from microversion 2.61, the responses of the 'Flavor' APIs
include the 'extra_specs' parameter. Therefore 'Flavors extra-specs'
(os-extra_specs) API calls have been removed in the following commands
since microversion 2.61.

* nova flavor-list
* nova flavor-show

Change-Id: I10d621d9b62764114d55cb368e720d182eaffd11
Implements: blueprint add-extra-specs-to-flavor-list
2018-04-17 10:02:35 -04:00
Jacek Tomasiak eff607ccef Fix listing of instances above API max_limit
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
2018-02-07 18:00:20 +01:00
Zuul 5de74bef5c Merge "Add CLI to show instance usage audit logs" 2018-02-05 16:53:53 +00:00
Zuul 68877e9959 Merge "Implement hypervisor hostname exact pattern match" 2018-02-05 16:47:52 +00:00
Sen Yang 9213ec2d32 Implement hypervisor hostname exact pattern match
When starting cold migration with nova command "nova host-
    servers-migrate compute-1", the migration started from all
    compute hosts starting with name "compute-1", not only from
    compute-1 host. The same thing happens to "nova host-meta",
    "nova host-evacuate", "nova host-evacuate-live" as well.

    With the "--strict" option added to these nova commands, the
    action will be applied to a single compute with the exact
    hostname string match, but not to the computes with hostname
    substring match. Error handling is also added to these nova
    commands such that when specified hostname name does not exist,
    "NotFound" will be returned.

Closes-Bug: #1667794
Change-Id: I5610efa160864b0d91cd67961883a6bec5bb8dd0
2018-01-31 08:41:07 -06:00
int32bit d418b5f245 Add CLI to show instance usage audit logs
Currently we can get instance usage audit logs via Nova API,
and the docs also update for it. It is necessary to add that
to our client and CLI.

This patch adds the following command.

nova instance-usage-audit-log [--before <before>]

Co-Authored-by: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I4ef8e40c322f1768ee1b5e01e9681cab0e2804bd
2018-01-29 07:39:27 +09:00
Yikun Jiang ad0c036fb6 Microversion 2.59 - Migrations list pagination
Add optional parameters 'limit', 'marker' and 'changes-since' to the
os-migrations endpoints for pagination.

  /os-migrations?limit={limit}&marker={migrations_uuid}
  /os-migrations?changes-since={changes-since}

Change-Id: I7437a61ee07c339b43d008204d1416044a407b68
Implement: blueprint add-pagination-and-change-since-for-migration-list
Depends-on: I7e01f95d7173d9217f76e838b3ea71555151ef56
2018-01-22 11:30:42 -05:00
Yikun Jiang 8d80a5e099 Microversion 2.58 - Instance actions list pagination
Add optional parameters 'limit', 'marker' and 'changes-since' to the
os-instance-actions endpoints for pagination.

Implement: blueprint pagination-add-changes-since-for-instance-action-list

Change-Id: Ie66d9b00c90236fdcc01aed7649dc7f163aa323e
2018-01-15 14:42:53 +08:00
Matt Riedemann 038cfdd5b3 Add support for the 2.57 microversion
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
2018-01-15 14:42:53 +08:00
Matt Riedemann 01fb16533b Remove deprecated fixedip/floatingip/virtual interface CLIs/APIs
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
2018-01-11 21:03:00 -05:00
Matt Riedemann 1d88717e75 Remove deprecated os-hosts CLIs and python API bindings
These were all deprecated in the 9.0.0 release in Pike
via change I79091edf5a2569e49e79deba312456fdcdee09e1 and
can now be removed. This will go into the 10.0.0 release.

Change-Id: I85a287ff2666c2dcdcbbc8fd6c2e285176f7a67a
2018-01-11 21:02:55 -05:00
Matt Riedemann 8c73ba4471 Remove deprecated cloudpipe CLIs and python API bindings
These were all deprecated in the 9.0.0 release in Pike
via change I329ee0e5fcf068ea7e54b99fbaf94a524647f660
and we can remove them now. This will go into 10.0.0.

Change-Id: Ia90a49112847e365fcdaf581dc9ee32f9a20fd85
2018-01-11 16:40:15 -05:00
Takashi NATSUME e5e8cebc81 Microversion 2.56 - Enable cold migration with target host
Change-Id: I4deea811ffae3e7944d5ec10ca0bbf2bfa056a7c
Implements: blueprint cold-migration-with-target-queens
2017-12-04 10:48:47 +09:00
Matt Riedemann 4f78a4217c Add support for microversion 2.55 - flavor description
This adds the support for microversion 2.55 which allows creating
a flavor with a description, showing the description in flavor details,
and updating the description on an existing flavor. Related python API
bindings are added, and the new "nova flavor-update <description>" CLI
is added.

Implements blueprint flavor-description

Change-Id: I0a09c0a63d2e91ef5aa31a8e43e28f8745faae14
2017-11-22 09:15:54 -05:00
Matt Riedemann 5745beae5c Microversion 2.53 - services and hypervisors using UUIDs
Adds support for the 2.53 microversion which changes the
os-services and os-hypervisors APIs to use a UUID for the ID
value on the resource.

Also, the PUT and GET API methods have changed a bit for
both resources in this microversion, so the pythong API
bindings and command lines have been adjusted accordingly.

Part of blueprint service-hyper-uuid-in-api

Change-Id: Ic721143cc154d91e74a8a9dd2c1e991045c94305
2017-07-26 09:04:19 -04:00
Matt Riedemann 5bfa57a433 Microversion 2.50 - fix quota class sets resource usage
This adds support for the 2.50 microversion which does the following:

* Adds the server_groups and server_groups_members resources to the output
  for the 'nova quota-class-show' and 'nova quota-class-update' CLIs.
* Removes the ability to show or update network-related resource quota class
  values, specifically floating_ips, fixed_ips, security_groups and
  security_group_members.
* Defines explicit kwargs for the update() method in the python API binding.

This also fixes a problem where the 'nova quota-class-update' CLI was
incorrectly capped at the 2.35 microversion for updating network-related
resources. That was true for the os-quota-sets API which is tenant-specific,
but not for the os-quota-class-sets API which is global.

Functional tests are added for the 2.1 and 2.50 microversion behavior for
both commands.

Part of blueprint fix-quota-classes-api

Change-Id: I2531f9094d92e1b9ed36ab03bc43ae1be5290790
2017-07-14 21:34:10 -04:00
Jenkins ef24343312 Merge "Add `instance-uuid` flag to the migration-list" 2017-04-28 14:13:08 +00:00
Matt Riedemann 603f0eae9f 2.45: createImage/createBackup image_id is in response body
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
2017-04-26 09:32:59 -04:00
He Jie Xu 59f885896a Add `instance-uuid` flag to the migration-list
The user needs to query the specific server's migration history. The
'os-migrations' support 'instance_uuid' as query filter, but that isn't
enabled in the migration-list command. This patch enable that filter.

Change-Id: I137b94f4d73836bcc163b66ab20ee2987042a40f
2017-04-25 13:19:54 +08:00
Matt Riedemann 3a03a0e10d Remove deprecated network APIs
These were deprecated in Newton:

aaebeb05a0

The 'find network' convenience helper when
booting a server only works with neutron now,
and assumes the 'network' endpoint is in the
service catalog.

The functional tests are changed to use
python-neutronclient for listing and finding
the network to use. At this point, we don't
have any nova-network CI jobs that will work
with novaclient, so the non-voting mitaka
nova-network job is also being removed in change
I63b36fb8acc5c9a273e6adcb271df16d0f71031e.

As noted in the release note, the only remaining
pure nova-network CLI/API that will work is for
listing virtual interfaces, which is only implemented
for nova-network within Nova. The functional tests
for this API are removed since we don't have any
nova-network CI jobs that will test it besides
unit tests. Long-term we'll likely deprecate the
os-virtual-interfaces API as well and replace it with
the os-interface API.

Change-Id: I8c520100a0016eed3959619c71dae037ebd72939
2017-04-03 13:17:25 -04:00
Matt Riedemann 0f46143f3b Remove deprecated floating_ips APIs
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
2017-03-20 19:26:58 -04:00
Matt Riedemann 4dbb20e5ac Remove deprecated fixed_ips APIs
These were deprecated in Newton:

aaebeb05a0

Change-Id: Iee5bc26384d2079d6a5a8eded1ce5a003439fc95
2017-03-20 19:26:58 -04:00
Matt Riedemann a298b29cc7 Remove deprecated security_groups APIs
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
2017-03-20 19:26:43 -04:00
Matt Riedemann 0896bdc52a Remove deprecated security_group_rules APIs
These were deprecated in Newton:

aaebeb05a0

Change-Id: I2ff1e97c022bc57d468947e90d536a37c65b8a7a
2017-03-20 17:43:49 -04:00
Matt Riedemann ab3315b46f Remove deprecated floating_ips_bulk API
These were deprecated in Newton in change:

aaebeb05a0

Change-Id: Idee91ca8fc4715cd952f97dafcdd5519c9bec919
2017-03-20 17:16:54 -04:00