Commit graph

5988 commits

Author SHA1 Message Date
Stephen Finucane
f42ade4305 quota: Catch correct exception type for Compute quotas
There is a flaw (IMO) in the design of Nova's os-quota-sets API: despite
project IDs forming the identifier for an individual resource, we get a
HTTP 400 (Bad Request) error if you pass an ID that does not exist,
rather than the HTTP 404 (Not Found) we would expect.

Correct this, noting why we're doing what we're doing for readers from
the future (hi!). Note that HTTP 400 is unfortunately quite broad and
means we'll also catch things like invalid requests but the exception
may have been translated so we can't rely on a string match.

Change-Id: I720502930d50be8ead5f2033d9dbcab5d99a37a9
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2091086
(cherry picked from commit 99cef9354b)
2024-12-11 15:01:06 +00:00
Zuul
66a9708d77 Merge "common: Use correct argument for volume limits" into stable/2024.2 2024-11-07 12:47:41 +00:00
Stephen Finucane
d258cd03cf common: Use correct argument for volume limits
The sooner we have type hints in SDK, the better /o\

Change-Id: Iaf9596aea02f683c280ae68504a14d43dbd6134a
Closes-bug: #2077634
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
(cherry picked from commit e5ccf1eb1c)
2024-11-07 10:46:25 +00:00
Takashi Kajinami
6c9d0a55f3 Fix ignored --user-domain in role assignment list
Fix the wrong value assignment which made the --user-domain option
ignored. Unit tests are updated to verify usage of domain options to
avoid further regressions.

Also drop the redundant look up of domain id to avoid unnecessary API
call.

Closes-Bug: #2085604
Change-Id: I5112b8e831fb26eb6544615277f0d3fe4f15dc5a
(cherry picked from commit 2e491191e5)
2024-11-05 17:07:21 +00:00
Stephen Finucane
c6946f4743 clientmanager: Check for 'block-storage' service type
This is a fun one driven by two separate changes. We recently started
checking whether the volume service was available before setting quotas
in order to allow us to use quota set for other services [1]. This
merged a number of weeks ago and was included in 7.1.0. More recently,
we modified DevStack to stop publishing a service catalog entry with a
service type of 'volumev3', preferring instead to use the correct
'block-storage' service type. Taken separately, neither of these changes
would have caused issues. Together, they mean our lookups for the volume
service now fail and we can't set volume quotas.

Fix things by checking for the block-storage service type also. A future
change will raise a warning (later an error) if the volume service is
not found and you're attempting to set a quota since this is clearly a
mistake.

Change-Id: Ibbeef52225e18757cd28d0fbfb14c1ca06975b60
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2084580
(cherry picked from commit 7c6b47b451)
2024-10-17 16:23:06 +00:00
Zuul
a1ddfa4ac4 Merge "compute: Fix --host in server list for new openstacksdk" into stable/2024.2 2024-10-03 18:26:16 +00:00
Johannes Kulik
773b869323 compute: Fix --host in server list for new openstacksdk
With `openstacksdk` 3.2.0 the `host` attribute of an Instance got added
to the `Server` class [0]. With that change, listing servers with the `host`
attribute leads to a query-filter for `compute_host` as expected, but
`openstacksdk` will also filter for the `host` attribute locally after
the results are returned. Since `compute_host` being
`OS-EXT-SRV-ATTR:host` is not the same as `host, this means no results
are returned.

Since we want to keep the old behaviour of filtering by `compute_host`
i.e. the service host name, we need to switch to filter for
`compute_host`. This is already supported in older versions of
`openstacksdk`.

[0] 0f311ff3e2

Change-Id: I0cd32c5b7d6d4d21194f3efdcfb9b205dea6a91e
Closes-bug: #2074200
(cherry picked from commit ffa683ab4e)
2024-10-03 10:48:24 +00:00
Takashi Kajinami
834bd93bf5 Always resolve domain id
The --user-domain option and the --project-domain option may take id or
name. In case name is given it should be translated to id.

Closes-Bug: 2083390
Change-Id: Idf3f113a74452daabc80660574030cb9b24b1a15
2024-10-03 06:10:41 +00:00
Zuul
e648750a11 Merge "identity: in service set command, don't pass the enable option when it is None" into stable/2024.2 2024-10-02 17:26:48 +00:00
Alfredo Moralejo
25bc3bbc07 identity: in service set command, don't pass the enable option when it is None
Currently, it is passing None value which is not accepted by keystone
parameters validation:

BadRequestException: 400: Client Error for url: ... Invalid input for field 'enabled': None is not of type 'boolean'

Failed validating 'type' in schema['properties']['enabled']:
    {'enum': [True, False, None], 'type': 'boolean'}

On instance['enabled']:
    None

Closes-Bug: #2083021
Change-Id: Ia8772560deb54e71672102157659d4eb22e6ad59
2024-09-30 14:04:16 +00:00
Stephen Finucane
54b4f45829 identity: Don't pass unset options when creating user
In change I06f3848812bce60c65909f1311f36b70eba427d4, we migrated the
'user *' commands from keystoneclient to SDK. One side effect of this is
that we are no longer able to rely on keystoneclient's 'filter_none'
helper method that filters out parameters that are set to None. As such,
we now need to do this ourselves. Eventually, it would be nice if SDK
provided such functionality itself.

The same change also introduced a bug where the '--domain' argument was
being used to lookup a project rather than the '--project-domain'
argument. This is also corrected.

Change-Id: I1204ca611a74d134c879467d6c2b73f16e043213
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2080600
(cherry picked from commit 033793aa0e)
2024-09-25 08:23:59 +00:00
Sylvain Bauza
08c84454c0 evacuate SDK actually uses admin_pass param
Change I0cd86675a884e6c2cbd3a861b8e111f961f0f336 was incorrect,
the SDK param name is admin_pass.

Change-Id: Ibe22c3d7d7ba0f1a5178475143e35fee5cac2ca2
(cherry picked from commit 58d1b06fdc)
2024-09-18 09:57:08 +01:00
Dr. Jens Harbott
fb958fa5d0 evacuate: Fix password parameter name for SDK
The parameter is called admin_password on the SDK side.

Change-Id: I0cd86675a884e6c2cbd3a861b8e111f961f0f336
(cherry picked from commit 8932282952)
2024-09-16 09:36:34 +02:00
OpenStack Release Bot
f74c88560b Update TOX_CONSTRAINTS_FILE for stable/2024.2
Update the URL to the upper-constraints file to point to the redirect
rule on releases.openstack.org so that anyone working on this branch
will switch to the correct upper-constraints list automatically when
the requirements repository branches.

Until the requirements repository has as stable/2024.2 branch, tests will
continue to use the upper-constraints list on master.

Change-Id: I23254d63d6f87a11e1b633ac7f7756f46625533d
2024-09-11 16:07:18 +00:00
OpenStack Release Bot
f13a007dc9 Update .gitreview for stable/2024.2
Change-Id: Ib0377b5c9ca8ec264a81173835580d6bb6c4b3e4
2024-09-11 16:07:16 +00:00
Zuul
73e9dd1934 Merge "quota: Allow 'quota set' to function without volume service" 2024-09-06 15:46:49 +00:00
Zuul
9c5fd76d9e Merge "compute: Add 'uuid' column to aggregate list" 2024-08-27 17:21:35 +00:00
Zuul
50d1e0916b Merge "Add callback on plugin load failure" 2024-08-14 11:12:03 +00:00
Zuul
bc6cff777f Merge "compute: Make 'hypervisor show' a bit faster" 2024-08-12 16:45:25 +00:00
Zuul
6312a6f452 Merge "compute: Only pass admin_password on rebuild if set" 2024-08-12 16:44:11 +00:00
Zuul
0d570cd66a Merge "identity: Use previous naming for 'service show' fields" 2024-08-12 16:01:30 +00:00
Zuul
e97e59d22d Merge "identity: Use previous naming for 'application credential show' fields" 2024-08-12 15:49:39 +00:00
Zuul
1aa077efee Merge "Add Python 3.12 classifier" 2024-08-09 13:10:32 +00:00
Zuul
d385bd1e03 Merge "Show Created At column for volume backups" 2024-08-09 12:20:45 +00:00
Zuul
f2cf938979 Merge "Bump requests minimal version" 2024-08-08 17:18:03 +00:00
Stephen Finucane
25780e80ab identity: Use previous naming for 'service show' fields
We changed these in change I37d07a6c5cdc98680b8d65d596521cad2b049500 but
the '-c/--column' option provided by cliff currently requires an
explicit match on column names. Change them back for now. We can revert
this when cliff is a little bit smarter.

Change-Id: I9180922e9da5c22ae3d8878946d1bf1ec4b8c6e1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2076212
2024-08-08 10:54:10 +01:00
Stephen Finucane
0e731cd22f identity: Use previous naming for 'application credential show' fields
We changed these in change Iba3fee2672d32266623c6f367beaabe84bd3d24e but
the '-c/--column' option provided by cliff currently requires an
explicit match on column names. Change them back for now. We can revert
this when cliff is a little bit cleverer.

Change-Id: I6b4f1b793dc383856bfdf9a01514381be3cd2bf1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Related-bug: #2076212
2024-08-08 10:53:25 +01:00
Stephen Finucane
4a2fd82b07 compute: Make 'hypervisor show' a bit faster
In the event that a user provides a hypervisor name rather than an ID to
the 'hypervisor show' command, passing 'details=True' (the default) to
'find_hypervisor' will ensure we get the detailed response we need.
However, this comes at the cost of retrieving reams of additional
irrelevant data for all the other hypervisors. Rather than doing this,
use a summary view and then a second call to fetch only the hypervisor
we care about.

Change-Id: I92b53802e41a962c6f916c3a111dc2de7c12d0fc
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2072965
2024-08-07 13:50:28 +01:00
Stephen Finucane
04ebe0853d compute: Add 'uuid' column to aggregate list
Change-Id: I15d4a2d5980c1ba3e00f7d1bd09f11d0f42564e1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2073542
2024-08-07 13:24:23 +01:00
Stephen Finucane
b8459c57c8 compute: Only pass admin_password on rebuild if set
In SDK change I3bc3150877c6c00aa9ec4355104308d7755aa1d4, we modified the
'rebuild_server' proxy method to use a sentinel 'unset' value so that we
could distinguish between fields that were not being changed and those
that were being changed to 'null'. However, we are currently passing the
'admin_password' field to the 'rebuild_server' SDK proxy command
regardless of whether it is set or not. Resolve this conflict.

Change-Id: If7b7585aadd43cdc6d2a9358f14223e43dc21a73
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2076232
2024-08-07 13:06:13 +01:00
Stephen Finucane
6693f555bc quota: Allow 'quota set' to function without volume service
Unlike cinderclient, SDK attempts to connect to a service as soon as you
create a client. A keystoneauth1.exceptions.catalog.EndpointNotFound
exception can be raised if this service does not exist in the service
catalog. Avoid this for the quota and limits commands by first checking
if the service is enabled.

In the process, we rework the 'is_volume_endpoint_enabled' helper we are
using to check for the existence of the service to *not* require a
volume client, since this was causing a chicken and egg issue for us
(and was also pretty much unnecessary).

Change-Id: I56e68f00ea221d689eb7f668e9e5ffa7d1a20184
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #2076229
2024-08-07 11:56:07 +00:00
Zuul
a59262e44d Merge "Respect --skip-resource when deleting." 2024-08-01 13:21:54 +00:00
Joel Capitao
5238394e6a Bump requests minimal version
It's a follow-up of [1].
JSONDecodeError exception was implemented in requests
since 2.27.0 [2].

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

Change-Id: I8a6a8ac064cb0703097ed686b1fcd2983181fcfa
2024-08-01 09:38:23 +02:00
Tim Bishop
1d4aabab2e
Respect --skip-resource when deleting.
When running project cleanup and using the --skip-resource flag, this
flag is only used during the --dry-run stage. This change ensures it is
also used when deleting the resources which fixes the bug mentioned below.

Closes-Bug: #2074109
Change-Id: I8e50fd14dcde069b932cc8ec4bb4fc809f7d2eb7
2024-07-25 20:20:56 +01:00
Stephen Finucane
aa88db9448 Add callback on plugin load failure
I have seen a few cases where import errors (distutils - I am looking at you)
result in an extension not being available, but there is no indication why this
is the case. We do configure logging, but this happens too late (as part
of the 'cliff.app.App.run' call to execute a command, which calls
osc-lib's 'configure_logging' but which happens long after we've tried
to import our plugins) to be of any use. Instead, make use of a callback
to make it more obvious.

Change-Id: Id68b06161e445b79fe43f463e06cda3c4771ef02
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-24 17:00:07 +01:00
Zuul
37a22cf84c Merge "Add tests for 'default security group rule create'" 2024-07-23 15:25:51 +00:00
Zuul
965c61c90c Merge "Add volume snapshot unmanage support" 2024-07-23 12:58:03 +00:00
Zuul
e650c3eeaa Merge "Add DeleteVolumeSnapshot class to v3" 2024-07-23 12:58:02 +00:00
Zuul
c47ccb9721 Merge "Followup: Reduce LOC in volume v3 service" 2024-07-23 12:58:00 +00:00
Stephen Finucane
f885a47450 Add Python 3.12 classifier
We are testing this in CI and can support it going forward now. The
osc-tox-py310-tips job is removed in a favour of a new
osc-tox-py312-tips job.

Change-Id: I87a726cb65223cba9975d0505c13fe42dcd7fa14
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-19 12:24:47 +01:00
Zuul
b223156906 Merge "Remove python-novaclient" 2024-07-18 18:03:28 +00:00
Zuul
70fbf687cf Merge "quota: Migrate 'quota *' to SDK" 2024-07-18 17:53:24 +00:00
Zuul
2d59c675dd Merge "quota: Split up 'quota list' command" 2024-07-18 13:35:21 +00:00
Zuul
692b06dfd5 Merge "quota: Default network quotas to not force" 2024-07-18 13:35:19 +00:00
Stephen Finucane
438e40db36 Remove python-novaclient
There are a few remnants left here but this is trivial to clean up now.

Change-Id: I517d906796338e64a31afa08b9ee6909b08e0115
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-18 13:28:51 +01:00
Zuul
97bded1a3d Merge "quota: Add 'quota set --default' option" 2024-07-18 11:26:26 +00:00
Stephen Finucane
6127b44d0a quota: Migrate 'quota *' to SDK
This is done for both the compute and block storage services. The
network service was already using SDK.

Change-Id: Id7a6943b8b4d7d1330e7d7f13705f027d1b67189
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Depends-on: https://review.opendev.org/c/openstack/openstacksdk/+/923864
2024-07-15 18:19:43 +01:00
Zuul
45ac2b62fb Merge "quota: Remove deprecated quota options" 2024-07-15 16:17:47 +00:00
Zuul
cf81902402 Merge "quota: Move nova-network-related quota" 2024-07-15 16:02:25 +00:00
Zuul
716dff1052 Merge "tests: Remove references to novaclient methods" 2024-07-15 15:15:03 +00:00