Glance Store
raw JSON → 5.4.0 verified Fri May 01 auth: no python
OpenStack Image Service Store Library, providing a unified interface to store and retrieve virtual machine images in various backends (filesystem, Swift, Ceph/RBD, HTTP, etc.). Current version: 5.4.0. Python 3.10+ required. Released under Apache 2.0, maintained by the OpenStack community.
pip install glance-store Common errors
error ImportError: No module named glance_store ↓
cause glance-store not installed or installed in wrong Python environment.
fix
Run 'pip install glance-store' in the correct environment (e.g., virtualenv, system Python 3.10+).
error oslo_config.cfg.ConfigFileNotFoundError: Unable to find configuration file: /etc/glance/glance-api.conf ↓
cause GlanceStore requires a configuration file, but default path doesn't exist.
fix
Provide an alternative config file via GLANCE_CONFIG env var or pass config dict to store.configure().
error glance_store.exception.NotFound: Image not found ↓
cause Trying to access an image that doesn't exist in the backend (e.g., wrong image ID).
fix
Verify image ID is correct and the backend (filesystem/Swift/RBD) contains the image. Check store.get_locations() for valid UUIDs.
Warnings
breaking Python 2 support removed in Stein release (5.0.0). Requires Python 3.10+ from version 5.4.0. ↓
fix Upgrade to Python 3.10+. If stuck on Python 2/3.6, use glance-store 4.x.
deprecated The 'swift' store driver is deprecated in favor of 'http' store with swift authentication. Removal planned in future release. ↓
fix Migrate to http store driver with swift endpoint configuration.
gotcha Configuration must be explicitly loaded before any store operations. Forgot to call store.configure()? Common cause of 'ConfigNotFound' errors. ↓
fix Always call store.configure() with a valid configuration object or file path.
Install
pip install glance-store[rados] pip install glance-store[swift] Imports
- GlanceStore wrong
from glance.store import GlanceStorecorrectfrom glance_store import GlanceStore - BackendStore wrong
from glance_store.drivers import BackendStorecorrectfrom glance_store.backend import BackendStore
Quickstart
import os
from glance_store import GlanceStore
# Configuration: must provide a config file or dict
config_path = os.environ.get('GLANCE_CONFIG', '/etc/glance/glance-store.conf')
if not os.path.exists(config_path):
# Minimal in-memory config for testing (filesystem backend)
from oslo_config import cfg
cfg.CONF([], project='glance', default_config_files=[])
cfg.CONF.set_override('filesystem_store_datadir', '/tmp/images', group='glance_store')
store = GlanceStore()
store.configure()
# Example: get image location (assuming image ID exists)
image_id = 'some-image-uuid'
# locations = store.get_locations(image_id)
print('Store initialized, ready to use.')