The glance_store._drivers.swift.store Module

The glance_store._drivers.swift.store Module

Storage backend for SWIFT

class glance_store._drivers.swift.store.BaseStore(conf)

Bases: glance_store.driver.Store

CHUNKSIZE = 65536
OPTIONS = [<oslo_config.cfg.BoolOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.IntOpt object>, <oslo_config.cfg.IntOpt object>, <oslo_config.cfg.BoolOpt object>, <oslo_config.cfg.BoolOpt object>, <oslo_config.cfg.IntOpt object>, <oslo_config.cfg.ListOpt object>, <oslo_config.cfg.BoolOpt object>, <oslo_config.cfg.IntOpt object>, <oslo_config.cfg.IntOpt object>, <oslo_config.cfg.BoolOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>, <oslo_config.cfg.StrOpt object>]
add(store, *args, **kwargs)
configure(re_raise_bsc=False)
create_location(image_id, context=None)
delete(store, *args, **kwargs)
get(store, *args, **kwargs)
get_connection(location, context=None)
get_manager(store_location, context=None, allow_reauth=False)

Return appropriate connection manager for store

The method detects store type (singletenant or multitenant) and returns appropriate connection manager (singletenant or multitenant) that allows to request swiftclient connections.

Parameters:
  • store_location – StoreLocation object that define image location
  • context – user context
  • allow_reauth – defines if we allow re-authentication when user token is expired and refresh swift connection
Returns:

connection manager for store

get_schemes()
get_size(location, connection=None, context=None)
get_store_connection(auth_token, storage_url)

Get initialized swift connection

Parameters:
  • auth_token – auth token
  • storage_url – swift storage url
Returns:

swiftclient connection that allows to request container and others

init_client(location, context=None)

Initialize and return client to authorize against keystone

The method invariant is the following: it always returns Keystone client that can be used to receive fresh token in any time. Otherwise it raises appropriate exception. :param location: swift location data :param context: user context (it is not required if user grants are specified for single tenant store) :return correctly initialized keystone client

class glance_store._drivers.swift.store.ChunkReader(fd, checksum, total, verifier=None)

Bases: object

do_read(i)
read(i)
class glance_store._drivers.swift.store.MultiTenantStore(conf)

Bases: glance_store._drivers.swift.store.BaseStore

EXAMPLE_URL = 'swift://<SWIFT_URL>/<CONTAINER>/<FILE>'
create_location(image_id, context=None)
delete(location, connection=None, context=None)
get_connection(location, context=None)
get_manager(store_location, context=None, allow_reauth=False)
init_client(location, context=None)
set_acls(location, public=False, read_tenants=None, write_tenants=None, connection=None, context=None)
class glance_store._drivers.swift.store.SingleTenantStore(conf)

Bases: glance_store._drivers.swift.store.BaseStore

EXAMPLE_URL = 'swift://<USER>:<KEY>@<AUTH_ADDRESS>/<CONTAINER>/<FILE>'
configure(re_raise_bsc=False)
configure_add()
create_location(image_id, context=None)
get_connection(location, context=None)
get_container_name(image_id, default_image_container)

Returns appropriate container name depending upon value of swift_store_multiple_containers_seed. In single-container mode, which is a seed value of 0, simply returns default_image_container. In multiple-container mode, returns default_image_container as the prefix plus a suffix determined by the multiple container seed

examples:
single-container mode: ‘glance’ multiple-container mode: ‘glance_3a1’ for image uuid 3A1xxxxxxx…
Parameters:
  • image_id – UUID of image
  • default_image_container – container name from swift_store_container
get_manager(store_location, context=None, allow_reauth=False)
init_client(location, context=None)

Initialize keystone client with swift service user credentials

glance_store._drivers.swift.store.Store(conf)
class glance_store._drivers.swift.store.StoreLocation(store_specs, conf)

Bases: glance_store.location.StoreLocation

Class describing a Swift URI. A Swift URI can look like any of the following:

swift://user:pass@authurl.com/container/obj-id swift://account:user:pass@authurl.com/container/obj-id swift+http://user:pass@authurl.com/container/obj-id swift+https://user:pass@authurl.com/container/obj-id

When using multi-tenant a URI might look like this (a storage URL):

swift+https://example.com/container/obj-id

The swift+http:// URIs indicate there is an HTTP authentication URL. The default for Swift is an HTTPS authentication URL, so swift:// and swift+https:// are the same…

get_uri(credentials_included=True)
parse_uri(uri)

Parse URLs. This method fixes an issue where credentials specified in the URL are interpreted differently in Python 2.6.1+ than prior versions of Python. It also deals with the peculiarity that new-style Swift URIs have where a username can contain a ‘:’, like so:

swift://account:user:pass@authurl.com/container/obj and for system created locations with account reference swift+config://account_reference/container/obj
process_specs()
swift_url

Creates a fully-qualified auth address that the Swift client library can use. The scheme for the auth_address is determined using the scheme included in the location field.

HTTPS is assumed, unless ‘swift+http’ is specified.

glance_store._drivers.swift.store.swift_retry_iter(resp_iter, length, store, location, manager)
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.