glance.db.registry.api module

This is the Registry’s Driver API.

This API relies on the registry RPC client (version >= 2). The functions bellow work as a proxy for the database back-end configured in the registry service, which means that everything returned by that back-end will be also returned by this API.

This API exists for supporting deployments not willing to put database credentials in glance-api. Those deployments can rely on this registry driver that will talk to a remote registry service, which will then access the database back-end.

glance.db.registry.api.configure()[source]
glance.db.registry.api.image_create(client, values, v1_mode=False)[source]

Create an image from the values dictionary.

glance.db.registry.api.image_destroy(client, image_id)[source]

Destroy the image or raise if it does not exist.

glance.db.registry.api.image_get(client, image_id, force_show_deleted=False, v1_mode=False)[source]
glance.db.registry.api.image_get_all(client, filters=None, marker=None, limit=None, sort_key=None, sort_dir=None, member_status='accepted', is_public=None, admin_as_user=False, return_tag=False, v1_mode=False)[source]

Get all images that match zero or more filters.

Parameters
  • filters – dict of filter keys and values. If a ‘properties’ key is present, it is treated as a dict of key/value filters on the image properties attribute

  • marker – image id after which to start page

  • limit – maximum number of images to return

  • sort_key – image attribute by which results should be sorted

  • sort_dir – direction in which results should be sorted (asc, desc)

  • member_status – only return shared images that have this membership status

  • is_public – If true, return only public images. If false, return only private and shared images.

  • admin_as_user – For backwards compatibility. If true, then return to an admin the equivalent set of images which it would see if it were a regular user

  • return_tag – To indicates whether image entry in result includes it relevant tag entries. This could improve upper-layer query performance, to prevent using separated calls

  • v1_mode – If true, mutates the ‘visibility’ value of each image into the v1-compatible field ‘is_public’

glance.db.registry.api.image_location_delete(client, image_id, location_id, status, session=None)[source]

Delete an image location.

glance.db.registry.api.image_location_update(client, image_id, location, session=None)[source]

Update image location.

glance.db.registry.api.image_member_count(client, image_id)[source]

Return the number of image members for this image

Parameters

image_id – identifier of image entity

glance.db.registry.api.image_member_create(client, values, session=None)[source]

Create an ImageMember object

glance.db.registry.api.image_member_delete(client, memb_id, session=None)[source]

Delete an ImageMember object

glance.db.registry.api.image_member_find(client, image_id=None, member=None, status=None, include_deleted=False)[source]

Find all members that meet the given criteria.

Note, currently include_deleted should be true only when create a new image membership, as there may be a deleted image membership between the same image and tenant, the membership will be reused in this case. It should be false in other cases.

Parameters
  • image_id – identifier of image entity

  • member – tenant to which membership has been granted

Include_deleted

A boolean indicating whether the result should include the deleted record of image member

glance.db.registry.api.image_member_update(client, memb_id, values)[source]

Update an ImageMember object

glance.db.registry.api.image_property_create(client, values, session=None)[source]

Create an ImageProperty object

glance.db.registry.api.image_property_delete(client, prop_ref, image_ref, session=None)[source]

Used internally by _image_property_create and image_property_update

glance.db.registry.api.image_tag_create(client, image_id, value, session=None)[source]

Create an image tag.

glance.db.registry.api.image_tag_delete(client, image_id, value, session=None)[source]

Delete an image tag.

glance.db.registry.api.image_tag_get_all(client, image_id, session=None)[source]

Get a list of tags for a specific image.

glance.db.registry.api.image_tag_set_all(client, image_id, tags)[source]
glance.db.registry.api.image_update(client, image_id, values, purge_props=False, from_state=None, v1_mode=False)[source]

Set the given properties on an image and update it.

Raises

ImageNotFound – if image does not exist.

glance.db.registry.api.is_image_visible(context, image, status=None)[source]

Return True if the image is visible in this context.

glance.db.registry.api.metadef_namespace_create(client, values, session=None)[source]
glance.db.registry.api.metadef_namespace_delete(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_namespace_get(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_namespace_get_all(client, marker=None, limit=None, sort_key='created_at', sort_dir=None, filters=None, session=None)[source]
glance.db.registry.api.metadef_namespace_update(client, namespace_id, namespace_dict, session=None)[source]
glance.db.registry.api.metadef_object_count(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_object_create(client, namespace_name, object_dict, session=None)[source]
glance.db.registry.api.metadef_object_delete(client, namespace_name, object_name, session=None)[source]
glance.db.registry.api.metadef_object_delete_namespace_content(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_object_get(client, namespace_name, object_name, session=None)[source]
glance.db.registry.api.metadef_object_get_all(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_object_update(client, namespace_name, object_id, object_dict, session=None)[source]
glance.db.registry.api.metadef_property_count(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_property_create(client, namespace_name, property_dict, session=None)[source]
glance.db.registry.api.metadef_property_delete(client, namespace_name, property_name, session=None)[source]
glance.db.registry.api.metadef_property_delete_namespace_content(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_property_get(client, namespace_name, property_name, session=None)[source]
glance.db.registry.api.metadef_property_get_all(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_property_update(client, namespace_name, property_id, property_dict, session=None)[source]
glance.db.registry.api.metadef_resource_type_association_create(client, namespace_name, values, session=None)[source]
glance.db.registry.api.metadef_resource_type_association_delete(client, namespace_name, resource_type_name, session=None)[source]
glance.db.registry.api.metadef_resource_type_association_get(client, namespace_name, resource_type_name, session=None)[source]
glance.db.registry.api.metadef_resource_type_association_get_all_by_namespace(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_resource_type_create(client, values, session=None)[source]
glance.db.registry.api.metadef_resource_type_delete(client, resource_type_name, session=None)[source]
glance.db.registry.api.metadef_resource_type_get(client, resource_type_name, session=None)[source]
glance.db.registry.api.metadef_resource_type_get_all(client, session=None)[source]
glance.db.registry.api.metadef_tag_count(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_tag_create(client, namespace_name, tag_dict, session=None)[source]
glance.db.registry.api.metadef_tag_create_tags(client, namespace_name, tag_list, session=None)[source]
glance.db.registry.api.metadef_tag_delete(client, namespace_name, name, session=None)[source]
glance.db.registry.api.metadef_tag_delete_namespace_content(client, namespace_name, session=None)[source]
glance.db.registry.api.metadef_tag_get(client, namespace_name, name, session=None)[source]
glance.db.registry.api.metadef_tag_get_all(client, namespace_name, filters=None, marker=None, limit=None, sort_key='created_at', sort_dir=None, session=None)[source]
glance.db.registry.api.metadef_tag_update(client, namespace_name, id, tag_dict, session=None)[source]
glance.db.registry.api.task_create(client, values, session=None)[source]

Create a task object

glance.db.registry.api.task_delete(client, task_id, session=None)[source]

Delete a task object

glance.db.registry.api.task_get(client, task_id, session=None, force_show_deleted=False)[source]

Get a single task object :returns: task dictionary

glance.db.registry.api.task_get_all(client, filters=None, marker=None, limit=None, sort_key='created_at', sort_dir='desc', admin_as_user=False)[source]

Get all tasks that match zero or more filters.

Parameters
  • filters – dict of filter keys and values.

  • marker – task id after which to start page

  • limit – maximum number of tasks to return

  • sort_key – task attribute by which results should be sorted

  • sort_dir – direction in which results should be sorted (asc, desc)

  • admin_as_user – For backwards compatibility. If true, then return to an admin the equivalent set of tasks which it would see if it were a regular user

Returns

tasks set

glance.db.registry.api.task_update(client, task_id, values, session=None)[source]
glance.db.registry.api.user_get_storage_usage(client, owner_id, image_id=None, session=None)[source]