5409 Commits

Author SHA1 Message Date
Stephen Finucane
1feb676469 tests: Update fake image client in tests
These clients are intended to fake out the old glanceclient client which
we no longer use. They were only "working" because we weren't actually
using any of the glancelclient-based stuff and were instead overriding
everything within the tests. Move these overrides back to the main
fake client and remove the crud.

Change-Id: I92ee74a1df72a6dd23f9d2dc04342aab0cbd3210
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-11-17 11:42:07 +00:00
Stephen Finucane
2135a9ea05 image: Remove FakeImage test helper
We're no longer creating fake versions of glanceclient's 'Resource'
object but rather openstacksdk objects. As such, there's no point
nesting things under a fake resource class.

Change-Id: I39cd5302622f4542db9eebcccfad0cb90d077441
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-11-17 11:34:42 +00:00
Stephen Finucane
690e9a13a2 image: Remove dead test helper methods
These haven't been used since we switched the image commands from
glanceclient to openstacksdk. There's more cleanup to be done here but
that can be done later.

Change-Id: I3de1f24323886b122b3a30660fb3de18eb7014e9
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-11-17 11:34:36 +00:00
Thrivikram Mudunuri
9acbd3e105
Switch server image create to SDK
Switch the server image create command from novaclient to SDK. Use the
SDK versions of test fakes to support fake Server resources. Also,
fetch updated image *after* waiting. If a user requests that we wait
(--wait) for a server image to become active before returning, then we
should probably return the final image. If we don't then the image can
appear to be in a non-active state when it fact it's active. Correct
this by fetching the image after the wait call.

Change-Id: I83a403c035add9ab041ed6d59b5b29e42267f143
2021-11-16 11:36:02 -05:00
Zuul
8b394e5641 Merge "Switch openstack server add port/network to using sdk." 2021-11-15 16:31:15 +00:00
Diwei Zhu
2183a61147 Switch openstack server add port/network to using sdk.
The old novaclient.v2.server.Server.interface_attach() method is
replaced with proxy.create_server_interface().
In swargs, 'net_id' and 'port_id' are mutual-exclusive, if one of
them is given with value, the other one cannot be None, as the
API would responde with 400 (None is not string).
In unit test, temporary method 'setup_sdk_servers_mock' is added,
because other tests are still using the old 'setup_servers_mock'.
Functional tests are added. Releasenote is generated.

Change-Id: I9899f0509febc5143560a1859ae6344d0a6d1427
2021-11-14 15:23:36 +00:00
Stephen Finucane
163cb01e46 compute: Return details of attached volumes
The API behind the 'server add volume' command returns details of the
created volume attachment, however, we were dropping these results
rather than displaying them to the user. Correct this.

Change-Id: I3f7e121220d29422ccf4e6940de2f28bb8496c83
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-11-03 11:57:31 +00:00
Stephen Finucane
442838ed15 compute: Use correct command class for 'show migration'
We should be inheriting from 'ShowOne'. Failure to do so results in a
tuple being dumped to the screen. Not what we intended.

While we're here, we update the docstring of this command to clarify the
command's intent. Nova does not provide an API to retrieve an individual
migration record for a cold migration or completed live migration. As
such, the 'server migration show' command only works for in-progress
live-migrations.

Change-Id: I2e2fe3da7d642b9e8e3d930603dcde178cd68cde
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Story: 2009658
Task: 43837
2021-11-03 10:19:52 +00:00
Stephen Finucane
8cb0a28607 compute: Don't warn if disk overcommit params unset
Due to a small logic error, we were emitting a warning about a
deprecated option when the user tried to live migrate an instance using
microversion 2.25 even though the user hadn't actually set that option.
Correct this.

Change-Id: Ib61e817bd4ced9b5533e7c7f9d8f0b45fe81c211
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Story: 2009657
Task: 43836
2021-11-03 10:17:37 +00:00
Zuul
f824e13bc5 Merge "Switch server backup to sdk." 2021-10-27 16:52:23 +00:00
Diwei Zhu
57aad01886 Switch server backup to sdk.
Switch this command from novaclient to SDK. As this is the first command
related to server that we are migrating, we need to extend our test
fakes to support fake Server resources. The extended fakes will replace
the old ones once all commands related to server are switched.

Change-Id: If476fb1614a64320ed071bbda35e941bf3290a2e
2021-10-27 09:11:27 +00:00
Cyril Roelandt
43639e1118 Fix typos
Change-Id: Idd502c8df21da79ff3b9339870f38378f5337879
2021-10-26 15:53:51 +02:00
Stephen Finucane
728401bbd7 Remove remnants of 'six'
Just one entry left. Remove it.

Change-Id: Ia12173ecb7f3fed4a1195a46ebf9b096d917b3b6
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-10-21 17:14:45 +01:00
Stephen Finucane
30612bf622 Remove 'get_osc_show_columns_for_sdk_resource' duplicates
There were a number of 'get_osc_show_columns_for_sdk_resource' defined
in-tree. However, osc-lib has provided this method for some time (since
2.2.0, June 2020 [1] - our minimum version is currently 2.3.0) so
there's no need to provide our own copies. Remove them.

[1] https://github.com/openstack/osc-lib/commit/29a0c5a5

Change-Id: I25695f4f9a379dd691b7eaa1e3247164668ae77e
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-10-21 17:14:45 +01:00
Stephen Finucane
a797c9d2a3 tox: Ignore virtualenvs for pep8 environment
Change-Id: I473d1b6c1287325566a5f5f5aadaea802c6af6f4
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-10-21 17:14:45 +01:00
Zuul
c985e0a23b Merge "Update the Nova CLI docoder document" 2021-10-21 10:23:23 +00:00
Stephen Finucane
53debe7fe1 compute: Fix filtering servers by tags
The nova API expects the 'tags' and 'not-tags' filters of the 'GET
/servers' (list servers) API to be a CSV string [1]:

  tags (Optional)
    A list of tags to filter the server list by. Servers that match all
    tags in this list will be returned. Boolean expression in this case
    is 't1 AND t2'. Tags in query must be separated by comma.

    New in version 2.26

  not-tags (Optional)
    A list of tags to filter the server list by. Servers that don’t
    match all tags in this list will be returned. Boolean expression in
    this case is 'NOT (t1 AND t2)'. Tags in query must be separated by
    comma.

    New in version 2.26

We were instead providing a Python list, which was simply being URL
encoded. Correct this.

[1] https://docs.openstack.org/api-ref/compute/?expanded=list-servers-detail#list-servers

Change-Id: Ie0251a0dccdf3385089e5bbaedf646a5e928cc48
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Closes-Bug: #1946816
2021-10-13 10:30:26 +01:00
Zuul
e0c61f0cbe Merge "Update the Nova CLI decoder document" 2021-10-08 09:06:20 +00:00
JIHOJU
e06a4f1c20 Update the Nova CLI docoder document
There are several update in CLI decoder document.
- Change flavor set/unset to flavor set/unset --property
- Update the mapping with flavor-update, interface-attach, and interface-detach

Change-Id: I1db50188b3643d3fe28689dc73b3f63806defd29
2021-10-07 21:03:25 +09:00
Zuul
30bb576d81 Merge "Fix the functional-tips tox environment" 2021-10-07 11:06:13 +00:00
choidoa-git
70fed75c85 Update the Nova CLI decoder document
In this patch, Update missing command in Mapping Guide.

List of updated commands
(Nova CLI / OSC)
- server-migration-list / server migration list
- server-migration-show / server migration show
- live-migration-abort / server migration abort
- live-migration-force-complete / server migration force complete
- migration-list / server migration list
- evacuate / server evacuate
- flavor-access-add / flavor set --project
- flavor-access-list / flavor show
- flavor-access-remove / flavor unset
- server-tag-add / server set --tag
- server-tag-delete / server unset --tag
- server-tag-delete-all / server unset --tag
- server-tag-list / server list --tag
- server-tag-set / server set --tag
- quota-class-show / quota show --class

Change-Id: Id1b4980fbc0f6e8e58bfae6f393f9336c6a7e3b1
2021-10-07 10:40:15 +00:00
Zuul
81bab3a716 Merge "Remove non-working code after method return." 2021-10-07 07:31:56 +00:00
Zuul
d79ebc5278 Merge "Add --trusted-image-cert option for server create" 2021-10-06 22:14:37 +00:00
Zuul
49d2c21366 Merge "Fix typo error in listing server's column name" 2021-10-06 17:32:24 +00:00
Zuul
5a8a3b33a1 Merge "Fix that the path of functional test" 2021-10-06 12:11:07 +00:00
Zuul
f4e4cd25c5 Merge "Replace assertItemsEqual with assertCountEqual" 2021-10-06 12:11:06 +00:00
lsmman
abed9f20f5 Remove non-working code after method return.
Delete duplicate return code.

While adding return of a new Member type, the existing return code part is not deleted.

Note the code in fakes.py in the below commit where these codes were added.
- Project: python-openstackclient
- The commit: 60e7c51df4cf061ebbb435a959ad63c7d3a296bf

Change-Id: Iae44770a784732991962cd38472095f76ab2543f
2021-10-06 19:21:51 +09:00
Pavlo Shchelokovskyy
28a376bfb0 Add --trusted-image-cert option for server create
this already exists for server rebuild, but was missing for server
create.

This option is supported from Compute API version >= 2.63, and is only
available for servers booted directly from images (not from volumes,
not from snapshots, and not from images first converted to volumes).

Additionally, this patch removes mentions of
OS_TRUSTED_IMAGE_CERTIFICATE_IDS env var from similar option help string
in server rebuild command as it is not actually implemented yet.

Change-Id: I4e9faea05c499bd91034d1d284c44fdcc8e18db5
2021-09-30 19:42:26 +03:00
ryanKor
c0a0f0f3d8 Fix that the path of functional test
before change:
$ tox -e functional -- --regex functional.tests.compute.v2.test_server
after change:
$ tox -e functional -- --regex tests.functional.compute.v2.test_server

the test unit path document should be change the above line.

(fixed wrong letter)

Change-Id: I49674fb0d56ee65c1f6328b9d960b16876173e2d
2021-09-25 21:34:47 +09:00
ff372ffdfb Add Python3 yoga unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for yoga.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I89cff43c0eb97c63deaba320e0fc63bd8ba31a2a
2021-09-22 10:42:18 +00:00
8ef9280af9 Update master for stable/xena
Add file to the reno documentation build to show release notes for
stable/xena.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/xena.

Sem-Ver: feature
Change-Id: Iedf2c908bf5a9d87effa02717eb604ee8d15ef3b
2021-09-22 10:42:16 +00:00
Alfredo Moralejo
ed5d2a37c5 Replace assertItemsEqual with assertCountEqual
Follow-up of [1]. After this patch was sent, two more assertItemsEqual
were added in [2]. This patch is fixing it.

[1] https://review.opendev.org/c/openstack/python-openstackclient/+/789410
[2] https://review.opendev.org/c/openstack/python-openstackclient/+/781637

Change-Id: Ic2276bd0ff0f5df76505f37d8994b3384d40e9a7
2021-09-09 15:50:54 +02:00
Zuul
3a0571c4df Merge "compute: Add support for microversion 2.90" 2021-09-02 20:15:11 +00:00
Lee Yarwood
51ee17a94d compute: Add support for microversion 2.89
This microversion drops the duplicate ``id`` field while adding
``attachment_id`` and ``bdm_uuid`` to the output of the
os-volume_attachments API reflected within osc by the ``openstack server
volume list $server``command.

Depends-On: https://review.opendev.org/c/openstack/nova/+/804275
Change-Id: I8a7002d8d65d7795e106b768df868198ab8b8143
2021-09-02 14:35:17 +01:00
Stephen Finucane
8e833a3ed2 compute: Add support for microversion 2.90
Allow configuring hostname when creating a new server or updating or
rebuilding an existing server.

Change-Id: Ibe603eab78bbbec43605f56de62a20493b6aa93d
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Depends-On: https://review.opendev.org/c/openstack/python-novaclient/+/806917
2021-09-01 13:18:25 +01:00
Ghanshyam Mann
6ce7da8aeb [community goal] Update contributor documentation
This patch updates/adds the contributor documentation to follow
the guidelines of the Ussuri cycle community goal[1].

[1] https://governance.openstack.org/tc/goals/selected/ussuri/project-ptl-and-contrib-docs.html

Story: #2007236
Task: #38547
Change-Id: I0afa1796d488a96160f4a7fd615920d05fe1771c
2021-08-30 17:13:12 +00:00
LEE JAE YONG
4aad7dd779 Fix typo error in listing server's column name
openstack server list -c "Created At" command doesn't work
because the wrong variable was used here.

When we receive resp data, Created At data is saved with
the name "created". But in "server.py", we append columns
as created_at. So it seems to print an empty table.

Story: 2009149
Task: 43112
Change-Id: I06de6903d5cc427a8b0fdcd168fec47192f4365b
2021-08-28 07:17:04 +00:00
Zuul
d9c556e69a Merge "L3 conntrack helper: Use singular name consistently" 2021-08-26 08:14:22 +00:00
Zuul
eca51342c3 Merge "volume: Add 'volume transfer request create --(no-)snapshots' option" 2021-08-26 08:03:53 +00:00
Zuul
6776cec809 Merge "openstack image create: honor protection/visibility flags" 2021-08-26 08:02:34 +00:00
Zuul
2c89812714 Merge "volume: Add missing 'volume list --offset' parameter" 2021-08-26 08:00:40 +00:00
Zuul
4fc1ac2ce2 Merge "Replace assertItemsEqual with assertCountEqual" 2021-08-23 21:20:16 +00:00
Zuul
2dfaf62340 Merge "Update volume create documentation" 2021-08-19 04:32:51 +00:00
melanie witt
12c93c6d5f Show "Forced Down" compute service status with --long
Currently, the unified client does not have the ability to show the
"Forced Down" field of a GET /os-services response in microversion 2.11
even though the legacy client can.

This adds a "Forced Down" column to the 'openstack compute service list
--long' command output when microversion 2.11 is used.

Story: 2009115
Task: 43011

Change-Id: I10bc2fedbf0e867a990227962b2b6e60f5681f69
2021-08-17 01:34:05 +00:00
melanie witt
ed87f7949e Correct REST API response fields for /os-migrations API
The compute APIs are unfortunately inconsistent with regard to the
response parameters for migrations.

* GET /servers/{server_id}/migrations returns server_uuid
* GET /os-migrations returns instance_uuid

Because the 'Server UUID' column is being specified for parsing the
response from GET /os-migrations, it is always showing as an empty
string to users.

There are a few other mismatches between the column names and the REST
API response fields [1]:

* 'Old Flavor' vs 'old_instance_type_id'
* 'New Flavor' vs 'new_instance_type_id'
* 'Type' vs 'migration_type'

This adds a new list containing the REST API response field names to
pass to utils.get_item_properties so that the responses are correctly
parsed and the client output contains the response data instead of
empty strings.

Story: 2009078
Task: 42890

[1] https://docs.openstack.org/api-ref/compute/?expanded=list-migrations-detail#list-migrations

Change-Id: I8aab60619e0225047f6a1c31e44917ca8fcc799e
2021-07-28 15:25:06 +00:00
Zuul
59256becc9 Merge "compute: Note that '--password' is deployment-specific" 2021-07-27 12:13:40 +00:00
Stephen Finucane
e0dc31f32e volume: Add missing 'volume list --offset' parameter
Looking at the code for the ancient v1 cinder API, we see that this
supported offset-style pagination [1][2][3]. Add this parameter,
simplifying a future patch to standardize pagination across OSC.

[1] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/v1/volumes.py#L259
[2] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/v1/volumes.py#L292
[3] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/common.py#L120

Change-Id: Ifec208ea9ed7afb4bebced6132abb96a3af034b5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-07-27 11:15:23 +01:00
melanie witt
4f6fe1c0fd Fix TestListMigrationV223 test class MIGRATION_COLUMNS
Currently only the test_server_migration_list adds the 'Id' and 'Type'
columns to the expected output, so if the
test_server_migration_list_no_options test is run by itself, it fails
as the actual response contains 'Id' and 'Type' but the reference does
not. This example run fails:

  tox -epy38 test_server_migration_list_no_options

The reason the tests pass in the gate is because
test_server_migration_list (which adds the 'Id' and 'Type' columns to
self.MIGRATION_COLUMNS) appears to always run before
test_server_migration_list_no_options, so the latter test gets the
benefit of the former test's column additions.

This changes the test class to just include the 'Id' and 'Type' columns
all the time as they are always returned in microversion 2.23 anyway.

Story: 2009079
Task: 42891

Change-Id: I2c97e9f64790b5e978e4d04230d45b8e343b53d4
2021-07-27 02:20:39 +00:00
Stephen Finucane
c1209601b4 tests: Handle removal of block-storage v2 API
Cinder recently removed their v2 API [1] which is causing the functional
tests to fail. Improve our 'is_service_enabled' test helper to use the
'versions show' command, which queries the service catalog and can give
us information about the service version as well as answer the more
general "is this service available" question. We also resolve a
long-standing TODO in the process.

[1] https://review.opendev.org/c/openstack/cinder/+/792299

Change-Id: I381069357aa008344e15327adf3a863c0c2e1f04
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-07-23 12:51:30 +01:00
Stephen Finucane
a821d6b7c5 volume: Add 'volume transfer request create --(no-)snapshots' option
This closes a gap with cinderclient's 'transfer-create' command.

Change-Id: I7386a7be15c0e3ee87abbcfc2275ba8524c10ff8
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Story: 2009054
Task: 42831
2021-07-13 20:33:35 +01:00