stores-info --detail command fails if swift store is enabled

Bug #2061947 reported by Abhishek Kekane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Unassigned

Bug Description

If you enable swift store in multiple stores setup then glance stores-info --detail or glance stores-info command fails with 500 error "oslo_config.cfg.NoSuchOptError: no such option store_description in group [dummy]".

Note: This error only occurs when you specify "swift_store_config_file = /etc/glance/glance-swift-store.conf and swift_store_multi_tenant = True" for swift store. Ideally it is recommended not to use "swift_store_config_file" when multi tenant is enabled for swift but it should not fail with 500 error and give appropriate 400 BadRequest error to the user.

Sample configuration glance-api.conf:

[DEFAULT]
enabled_backends = dummy:swift

[dummy]
swift_store_multi_tenant = True
default_swift_reference = ref1
swift_store_config_file = /etc/glance/glance-swift-store.conf
swift_store_create_container_on_put = True
store_description = "This is swift store"

Also in second scenario if you set swift store as below in glance-api.conf then it gives 500 error "Apr 17 04:40:20 akekane-zed-dev glance-api[3389648]: ERROR glance.common.wsgi [None req-7dcd5c18-7b31-43e5-9b22-77e20505cab7 admin admin] Caught error: 'MultiTenantStore' object has no attribute 'container': AttributeError: 'MultiTenantStore' object has no attribute 'container'" fot glance stores-info --detail command

[dummy]
swift_store_multi_tenant = True
default_swift_reference = ref1
swift_store_create_container_on_put = True
store_description = "This is swift store"

Ideally in scenario 1 glance stores-info --detail command should raise 400 Bad Request and for scenario 2 we need to identify what is ideal configuration for swift multi tenant and return the response accordingly.

Changed in glance:
importance: Undecided → High
Revision history for this message
Pranali Deore (pranali-deore) wrote :

While reproducing this issue, I noticed that image-create also fails with same 500 error if "swift_store_config_file = /etc/glance/glance-swift-store.conf and swift_store_multi_tenant = True" are specified dor swift store.

$ glance image-create --name testing-swift-1 --container-format bare --disk-format qcow2 --file requirements.txt --store dummy
HTTP 500 Internal Server Error: The server has either erred or is incapable of performing the requested operation.

g-api error: "oslo_config.cfg.NoSuchOptError: no such option store_description in group [dummy]".

The fix would be common for both store-info & image-create since get_stores_detail() internally calls get_stores().

Regarding scenario 2: swift container value can be return as None if it's not set.

In case of swift multitenant enabled, swift recreates the conatiner[1] during image create if it's not set during store configuration. So incase of multitenant enabled, container value could be return None if it's not set while fetching the store details.

[1]: https://github.com/openstack/glance_store/blob/142593aaee5b34115f493a9a04aab0ec4cbf1846/glance_store/_drivers/swift/store.py#L938

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/glance/+/920170

Changed in glance:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.opendev.org/c/openstack/glance/+/920170
Committed: https://opendev.org/openstack/glance/commit/06c727cfb32db38d9d705b28236d699e1c2c2083
Submitter: "Zuul (22348)"
Branch: master

commit 06c727cfb32db38d9d705b28236d699e1c2c2083
Author: Pranali Deore <email address hidden>
Date: Wed May 22 09:51:59 2024 +0000

    Fix 500 if multi-tenant swift is used

    1. store-info --details and image-create apis fail with 500 if
       swift configuration file is set in g-api.conf when muti-tenant
       swift store is used. Fixed this by excluding the unregistered
       conf parameter and added log warning.
    2. Also, store-info --details fails with AttributeError, when
       multitenant is enabled for swift store since it doesn not set
       the container value during store configuration.
       Fixed this by returing `None` incase of multitenant swift store.

    Closes-Bug: #2061947
    Change-Id: I6cbd11fd0ee5758169a2e0e9961660edb844e65f

Changed in glance:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.