glance.common.store_utils module

glance.common.store_utils.check_reserved_stores(enabled_stores)[source]
glance.common.store_utils.delete_image_location_from_backend(context, image_id, location)[source]

Given a location, immediately or schedule the deletion of an image location and update location status to db.

Parameters:
  • context – The request context

  • image_id – The image identifier

  • location – The image location entry

glance.common.store_utils.get_dir_separator()[source]
glance.common.store_utils.get_updated_store_location(locations, context=None)[source]
glance.common.store_utils.safe_delete_from_backend(context, image_id, location)[source]

Given a location, delete an image from the store and update location status to db.

This function try to handle all known exceptions which might be raised by those calls on store and DB modules in its implementation.

Parameters:
  • context – The request context

  • image_id – The image identifier

  • location – The image location entry

glance.common.store_utils.schedule_delayed_delete_from_backend(context, image_id, location)[source]

Given a location, schedule the deletion of an image location and update location status to db.

Parameters:
  • context – The request context

  • image_id – The image identifier

  • location – The image location entry

glance.common.store_utils.update_store_in_locations(context, image, image_repo)[source]
glance.common.store_utils.validate_external_location(uri)[source]

Validate if URI of external location are supported.

Only over non-local store types are OK, i.e. Swift, HTTP. Note the absence of ‘file://’ for security reasons, see LP bug #942118, 1400966, ‘swift+config://’ is also absent for security reasons, see LP bug #1334196.

Parameters:

uri – The URI of external image location.

Returns:

Whether given URI of external image location are OK.