When glance is configured to use swift as a glance store and not swift service is enabled then glance api service starts but image creation fails with below stack trace and image will remain in importing state forever (PS: here I am using import workflow but it will fail for normal image upload as well);
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor During handling of the above exception, another exception occurred: [222/1091]
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor Traceback (most recent call last):
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/taskflow/engines/action_engine/executor.py", line 52, in _execute_task
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor result = task.execute(**arguments)
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/async_/flows/api_image_import.py", line 640, in execute
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor self._execute(action, file_path)
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/async_/flows/api_image_import.py", line 649, in _execute
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor action.set_image_data(file_path or self.uri,
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/async_/flows/api_image_import.py", line 342, in set_image_data
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor return image_import.set_image_data(self._image, uri, task_id,
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/common/scripts/image_import/main.py", line 158, in set_image_data
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor LOG.info(_LI("Task %(task_id)s: Could not import image file"
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 227, in __exit__
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor self.force_reraise()
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor raise self.value
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/common/scripts/image_import/main.py", line 151, in set_image_data
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor image.set_data(data_iter, backend=backend, set_active=set_active)
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/notifier.py", line 497, in set_data
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor _send_notification(notify_error, 'image.upload', msg)
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 227, in __exit__
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor self.force_reraise()
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor raise self.value
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/notifier.py", line 443, in set_data
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor self.repo.set_data(data, size, backend=backend,
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/quota/__init__.py", line 322, in set_data
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor self.image.set_data(data, size=size, backend=backend,
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/location.py", line 585, in set_data
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor self._upload_to_store(data, verifier, backend, size)
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance/location.py", line 476, in _upload_to_store
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor multihash, loc_meta) = self.store_api.add_with_multihash(
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance_store/multi_backend.py", line 397, in add_with_multihash
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor return store_add_to_backend_with_multihash(
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance_store/multi_backend.py", line 479, in store_add_to_backend_with_multihash
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor (location, size, checksum, multihash, metadata) = store.add(
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance_store/driver.py", line 277, in add_adapter
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor metadata_dict) = store_add_fun(*args, **kwargs)
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance_store/capabilities.py", line 176, in op_checker
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor return store_op_fun(store, *args, **kwargs)
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance_store/_drivers/swift/store.py", line 935, in add
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor with self.get_manager(location, context,
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance_store/_drivers/swift/store.py", line 1464, in get_manager
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor return connection_manager.SingleTenantConnectionManager(self,
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance_store/_drivers/swift/connection_manager.py", line 62, in __init__
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor self.storage_url = self._get_storage_url()
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor File "/usr/lib/python3.9/site-packages/glance_store/_drivers/swift/connection_manager.py", line 168, in _get_storage_url
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor raise exceptions.BackendException(msg)
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor glance_store.exceptions.BackendException: Cannot find swift service endpoint : internalURL endpoint for object-store service not found
2024-03-19 10:52:10.536 26 ERROR glance.async_.taskflow_executor
2024-03-19 10:52:10.573 26 WARNING glance.async_.taskflow_executor [-] Task 'api_image_import-default_backend-ImportToStore-59e6059e-04c4-4fb4-b08b-4e7b3c98a0d7' (226789c7-d20e-46f7-becc-41b8239d45c1) transitioned into state 'REVERTED' f
rom state 'REVERTING'
2024-03-19 10:52:10.576 26 WARNING glance.async_.taskflow_executor [-] Task 'api_image_import-Noop-59e6059e-04c4-4fb4-b08b-4e7b3c98a0d7' (91c2b4f3-6a1f-4834-8f48-922ff17561db) transitioned into state 'REVERTED' from state 'REVERTING'
2024-03-19 10:52:10.579 26 WARNING glance.async_.taskflow_executor [-] Task 'api_image_import-ConfigureStaging-59e6059e-04c4-4fb4-b08b-4e7b3c98a0d7' (81fd4770-4c1d-4096-b6b8-bb40c6aca6ac) transitioned into state 'REVERTED' from state 'RE
VERTING'
2024-03-19 10:52:10.591 26 WARNING glance.async_.taskflow_executor [-] Task 'api_image_import-ImageLock-59e6059e-04c4-4fb4-b08b-4e7b3c98a0d7' (d858bb5b-40f6-406c-b031-8626fcafa190) transitioned into state 'REVERTED' from state 'REVERTING
'
2024-03-19 10:52:10.595 26 WARNING glance.async_.taskflow_executor [-] Flow 'api_image_import' (75b98b17-07a8-4e3d-8af8-dfaba17ef0e9) transitioned into state 'REVERTED' from state 'RUNNING'
Expected solution: Swift store has a capability to check swift is enabled or not at service startup and disable the store if it is not enabled to perform Add/DELETE operations.