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
This commit is contained in:
Stephen Finucane 2024-10-15 17:41:50 +01:00
parent 8979c00150
commit 7c6b47b451
2 changed files with 14 additions and 1 deletions
openstackclient/common
releasenotes/notes

@ -129,10 +129,15 @@ class ClientManager(clientmanager.ClientManager):
# TODO(stephenfin): Drop volume_client argument in OSC 8.0 or later.
def is_volume_endpoint_enabled(self, volume_client=None):
"""Check if volume endpoint is enabled"""
# We check against the service type and all aliases defined by the
# Service Types Authority
# https://service-types.openstack.org/service-types.json
return (
self.is_service_available('volume') is not False
self.is_service_available('block-storage') is not False
or self.is_service_available('volume') is not False
or self.is_service_available('volumev3') is not False
or self.is_service_available('volumev2') is not False
or self.is_service_available('block-store') is not False
)

@ -0,0 +1,8 @@
---
fixes:
- |
The ``quota set`` and ``limits show`` commands will now check for the
``block-storage`` and ``block-store`` service types along with ``volume``,
``volumev2`` and ``volumev3``.
[Bug `2084580 <https://bugs.launchpad.net/python-openstackclient/+bug/2084580>`_]