Commit Graph

212 Commits

Author SHA1 Message Date
Rajesh Tailor 1f029ce578 Fix typos
Change-Id: Iaef3767dd9e7f43503dd8287b9b2345585bd87fb
2023-11-20 17:56:01 +05:30
Takashi Kajinami 273c41574a Use Block Storage API v3 instead of API v2
Block Storage API v2 was deprecated during Pike cycle and is being
removed during Xena cycle, and current v3 API should be used instead.

Change-Id: I4b4c08d65e642866d81d7fd12a7c82162a0b979e
2021-07-27 11:00:23 +09: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 1b5f29a3a4 Fix a functional test for 'nova agent-list'
The os-agents APIs have been removed by the following change.

  I9512f605dd2b3b0e88c951ed086250d57056303d

This patch fixes a gate failure.
A subsequent patch will make things related to
the os-agents APIs deprecated.

Change-Id: I9dab95fda5902bf9619393eb2c4a22d9f395d65a
Closes-Bug: #1909899
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2021-01-03 21:46:49 +09:00
Takashi Natsume 1ce9edcd73 Add a cleanup for a server in a functional test
A VM instance is created in the following functional test.

* novaclient.tests.functional.v2.test_instance_action.
  TestInstanceActionCLIV262.test_show_actions_with_host

However the VM instance is not deleted after the functional test.
Add a cleanup for the server in the functional test.

Change-Id: I8c2a6f91739d50baa283b37b16de67c542ea691b
Closes-Bug: #1889283
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-07-28 16:36:28 +00:00
Takashi Natsume b7ae8c75cb Switch legacy Zuul jobs to native Zuul v3 jobs
Replace the 'novaclient-dsvm-functional' legacy Zuul job with
the 'python-novaclient-functional' native Zuul v3 job.

See
https://governance.openstack.org/tc/goals/selected/victoria/native-zuulv3-jobs.html
for more details.

Change-Id: I35b5699b8b0814f2d17a37e024286cd440047ec8
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
Co-Authored-By: Andrey Kurilin <andr.kurilin@gmail.com>
2020-07-08 20:33:05 +03: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
Stephen Finucane 0f7d723c46 trivial: Remove 'u' prefix from string
It looks like nova is using 'repr()' in some validation error logging.
On Python 2.7, this would result in unicode strings (which most web apps
use) being output as "u'foo'", while in Python 3 these would just be
"'foo'". Since nova only supports Python 3 now, we only have to support
the Python 3 string formatting variant in our tests too.

Change-Id: I546c06a3251e86f39e2e7db48e04ec382c8da854
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-02-21 09:43:13 +00:00
zhangbailin f420c05851 Add functional test for migration-list in v2.80
In microversion 2.80 add the functional test for the `nova migration-list`
CLI.

part of bp add-user-id-field-to-the-migrations-table
Change-Id: I3cfe37b412971dfff4b217fc7cc6cfdf1b118ce0
2019-10-17 12:52:48 +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
Takashi NATSUME 6aae5b2311 Follow up for microversion 2.75
This is a follow-up for microversion 2.75 -
Multiple API cleanup changes.

The base class of the TestFlavorNovaClientV274 class is
the TenantTestBase class.
And the base class of the TenantTestBase class is
the ClientTestBase class.
It is not necessary to use the TenantTestBase class
as the base class. So specify the ClientTestBase class
directly.

TrivialFix
Change-Id: I2cb971f46ba697d9386ca61b7f51169f02b605ab
2019-08-26 16:18:32 +09:00
Zuul a19253f857 Merge "Add --migration-type and --source-compute to migration-list" 2019-08-23 22:43:35 +00:00
Ghanshyam Mann 0e873a2d5a Microversion 2.75 - Multiple API cleanup changes
Add support microversion 2.75 which implement
multiple API cleanup changes.

1. Making server representation always consistent among all APIs
   returning the complete server representation.
 - Test cases added.

2. Change the default return value of ``swap`` field from the empty string
   to 0 (integer) in flavor APIs.
 - Test cases added.

Nova side path: https://review.opendev.org/#/c/666889/

Change-Id: Iec2cfc629dffd53178ef88a31fcd16a3f32e2e27
Partial-Implements: blueprint api-consistency-cleanup
2019-08-20 13:08:16 +00: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
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
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
Takashi NATSUME fe4138aea4 Updates for OpenDev transition
Replace 'git.openstack.org' with 'opendev.org'
in contributor/index.rst.
Update URLs in other places as well though there are redirects.

See the following URLs for more details:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Change-Id: Ifb9f4274d2fd0fa81e7501fe176eeead3acd0e3e
2019-04-23 01:18:31 +00:00
Takashi NATSUME 7e877c4fdb Fix changes-before values in an instance action test
In some DBMSs (e.g. MySQL 5.7 (*1)), fractions (millisecond and
microsecond) of DateTime column is not stored by default.

*1: https://dev.mysql.com/doc/refman/5.7/en/date-and-time-type-overview.html

Fix specifying the 'changes-before' values
in the functional test for the 'instance-action-list' command.

Change-Id: I79e80088bcbf559a58aa90a831b54017af310a26
Closes-Bug: #1817064
2019-02-27 00:44:22 +00:00
Takashi NATSUME 7e56102201 Fix output of interface-attach command
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
2019-02-19 13:22:49 +09:00
Takashi NATSUME 80b4286981 Replace MB with MiB
Change-Id: Ie5bd325d8e0f7e9af76c1ddae1d679b0e797c84b
2018-10-22 07:11:25 +00:00
Takashi NATSUME 98b088286d Fix test_instance_action functional test failure
Fix an intermittent failure of
test_list_instance_action_with_changes_before method
of the TestInstanceActionCLIV266 class.

Change-Id: Ie898d9590e1701476eadf4895bce7874d989175a
Closes-Bug: #1795392
2018-10-02 03:48:49 +00:00
zhangbailin 4464a88737 Add support changes-before for microversion 2.66
This adds the changes-before filter to the servers,
os-instance-actions and os-migrations list for
filtering resources which were last updated before
or equal to the given time. The changes-before filter,
like the changes-since filter, will return deleted
server resources.

Depends-On: https://review.openstack.org/599276/
Part of bp support-to-query-nova-resources-filter-by-changes-before

Change-Id: I7c6ea00303374d605bda8ef1b62c5de1b4567696
2018-09-24 15:14:18 -04:00
liuyamin 2d023bcb0e Replace os-client-config to openstacksdk
Since now os-client-config has been superceded by openstacksdk[1].
So need to replace the os-client-config.

[1]:https://docs.openstack.org/os-client-config/latest/

Change-Id: Ia0e0671720de4713098e9d0faa1d7dc0c4ae6147
2018-08-14 03:05:18 +00:00
Takashi NATSUME 1f75c7662d Use jsonutils of oslo.serialization
Both standard json library and jsonutils of oslo.serialization are used.
Replace standard json library with jsonutils for consistency.

Change-Id: Id6cbb4d78817ff4993b73538935cc4cc61b64a72
2018-07-31 13:19:01 +09:00
Zuul 839da6fec0 Merge "Microversion 2.64 - Use new format policy in server group" 2018-07-19 01:39:08 +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
Takashi NATSUME 2e6ef0c45a Rename --endpoint-override to --os-endpoint-override
The ``--endpoint-override`` command line argument has been deprecated.
It is renamed to ``--os-endpoint-override`` to avoid misinterpreting
command line arguments.
It defaults to the ``OS_ENDPOINT_OVERRIDE`` environment variable.

The deprecated ``--bypass-url`` command line argument has been removed.

Change-Id: Ic8a6559cd62d46b837fa9c04b482a46ceba829db
Closes-Bug: #1778536
2018-07-09 22:02:13 +09:00
zhang.lei 24bb7ea831 Fix the incorrect cirros default password
Following by https://docs.openstack.org/image-guide/obtain-images.html#cirros-test

Change-Id: Iee3b90900e238b717020c4b7f32e5a5f346bef95
2018-05-09 09:22:51 +00:00
Matt Riedemann 460638436e Make sure microversion < 2.62 does not show host(Id) for instance actions
This adds a simple assertion that when microversion < 2.62, the
"nova instance-action" CLI does not show host or hostId output.

Related to blueprint add-host-to-instance-action-events

Change-Id: I6e0866d9daff75046a5e82f57ff745d494b4b5ed
2018-04-27 12:46:58 -04:00
Yikun Jiang 5483be7fe7 Microversion 2.62 - Add host/hostId to instance action event
Adds support for microversion 2.62 which adds ``host``
(hostname) and ``hostId`` (an obfuscated hashed host id string)
fields to the instance action
``GET /servers/{server_id}/os-instance-actions/{req_id}`` API.

The event column is already included in the result of
"nova instance-action <server> <request-id>" command, therefore
does not have any CLI or python API binding impacts in the
client.

Related nova API change: I2f8b4a12a088b9ed96b428eafde2e0c478fb1db5

Part of blueprint: add-host-to-instance-action-events

Change-Id: Iee7e1a3a22249c98873aa96694fd4885916cd097
2018-04-27 15:37:39 +08:00
Andrey Kurilin 6049be67c0 [CLI] Fix token auth type
There are 2 known issues which breaks token auth method in CLI:

* The wrong check of flag (the check should be for --os-token since
  arguments are not parsed at that moment) is performed in CLI inner method
  `_append_global_identity_args`. It led to usage of "password" auth
  type by default[1] even if `--os-token` cli argument is specified.
  If `--os-auth-type` is specified to token, keystoneauth1 library makes
  the right decision[2].

* Based on an auth type, keystoneauth library registers different CLI
  arguments[3]. It means that `--os-username` argument is available only
  in password auth type, `--os-token` is available only in token auth
  type, etc.
  It also affects the way in which the python code should access such
  arguments. The arguments which are unrelated to the selected auth type
  are omitted from the parsed arguments object.
  That sounds reasonable, but unfortunately the code assumes the
  unrelated arguments are always present which leads to an
  AttributeError.

Combination of these 2 issues made token auth type broken in CLI layer.

[1] ee2221f052/novaclient/shell.py (L255-L257)
[2] 14dd37b34c/keystoneauth1/loading/cli.py (L51-L52)
[3] 14dd37b34c/keystoneauth1/loading/cli.py (L65-L73)

Closes-Bug: #1659015
Change-Id: Ibc861d396b71fe105288d8336623cc22cf92523e
2018-04-19 18:43:45 +00:00
Zuul 69d41135a0 Merge "Replace GB with GiB" 2018-04-06 18:51:16 +00:00
Takashi NATSUME be94318add Replace GB with GiB
In documents and comments, 'GB' (gigabyte) is used.
Strictly 'GiB' (gibibyte) should be used.
So replace 'GB' with 'GiB'.

Change-Id: Ic03f202d4fe357bc6400275abdccd4b37521f4a3
Closes-Bug: #1521791
2018-04-04 00:08:52 +00:00
Takashi NATSUME e044b911c2 Fix AttributeError in getting a resource ID
In the 'wait_for_resource_delete' method of the 'ClientTestBase' class,
the following statement is executed when timeout.

  self.fail("The resource '%s' still exists." % resource.id)

The 'resource' variable is passed in the argument of
the 'wait_for_resource_delete' method.
It is sometimes a string which is a resource ID.

When it is a string (a resource ID), AttributeError is raised
at the statement.
This patch fixes the issue.

Change-Id: I558026de54a5cc75359225b50054934a220f3e5c
Closes-Bug: #1704132
2018-04-03 23:59:22 +00: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 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 fefc3ba723 Remove deprecated services binary CLI arg
The services CLI 'binary' arg was deprecated in Pike
via change Idd0d2be960ca0ed59097c10c931da47a1a3e66fb
because with cells v2 support in the API, the binary
argument for the enable/disable CLIs doesn't make sense
as the only binary those work with is 'nova-compute'.
So this removes the deprecated argument and hard-codes
the value to be 'nova-compute'.

Change-Id: I60490f3d74212bb172dccc1c7d337198e1021236
2018-01-11 21:17:04 -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
Andrey Kurilin 00ffdef3d5 [ci] Use pseudo-random names for new resources
Random names of resources makes the task impossible to find a test which
doesn't clean resources after a launch.

This patch changes name_generate method to generate names including a name
of the test, which can be really helpful.

Also, the simple script that prints resources after test run is added.

Change-Id: Id3a743afb624dd4bf8ed3523a1916455fd93655a
2017-11-23 16:52:04 +00:00
Andrey Kurilin a8e4521b67 [functional] Remove duplication of boot helper
The base test class for functionl tests has an unified helper method for
booting VM and waiting for active status. This method can be easily
extended with one new argumen `flavor` to cover the case required by
`TestServersResize` test case.

This patch ports `TestServersResize` to use generic helper method.

Change-Id: I9a53066dbb8907ed87a70f207b1e41b5b8a66908
2017-11-20 14:32:45 +02:00
Dai Dang Van 4707422377 Use generic user for both zuul v2 and v3
Zuul v2 uses 'jenkins' as user, but Zuul v3 uses 'zuul'.
Using $USER solves it for both cases.

Change-Id: Ia3f2646bd3b5fa87c90c8dac57117fd29d73706b
2017-10-17 14:13:43 +07:00
Jenkins 8dd49ea229 Merge "Add 'Forced down' column in serivce-list" 2017-07-27 17:11:21 +00: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
Takashi NATSUME 6071f6f1b2 Add 'Forced down' column in serivce-list
Starting from microversion 2.11,
the 'force_down' parameter is returned in the response of
the "List Compute Services" API (GET /os-services).

But the service-list command does not show the 'forced_down' parameter
in the result table.
So add the 'Forced down' column in the table.

Change-Id: I79e3ba37bdf054604eab40452628dbf30014f6f1
Closes-Bug: #1706486
2017-07-26 12:04:56 +09:00
Matt Riedemann 617eb742ab Adjust test_resize_down_revert to account for counting quotas
Change I9269ffa2b80e48db96c622d0dc0817738854f602 in the Nova
server removes the need for reservations, which means that
once the server is resized in nova-compute and the vcpus and
memory_mb are changed on the instances record, the usage count
will also change, before the resize is confirmed. This means
we need to adjust the usage assertions in the resize down test.
Usage changes once the server is in VERIFY_RESIZE state, and
the usage will change again if the resize is reverted.

Note that if we were getting usage without the 'reserved'
query paramter to the 'limits' API, the behavior would have
been the same regardless of the change to Nova for counting
quotas.

Depends-On: I9269ffa2b80e48db96c622d0dc0817738854f602

Related to blueprint cells-count-resources-to-check-quota-in-api

Change-Id: I91ca0d204454987dcce1c68d9bf0f532b469df6d
2017-07-19 18:49:10 -04:00
Jenkins 8d6bde276b Merge "Add resize down test which also verifies quota changes" 2017-07-19 19:28:07 +00:00
Jenkins f36331a95e Merge "Add functional test for resize-confirm plus quota validation" 2017-07-19 19:27:54 +00:00