glance.api package

Subpackages

Submodules

glance.api.authorization module

class glance.api.authorization.ImageFactoryProxy(image_factory, context)[source]

Bases: glance.domain.proxy.ImageFactory

new_image(**kwargs)[source]
class glance.api.authorization.ImageMemberFactoryProxy(image_member_factory, context)[source]

Bases: glance.domain.proxy.ImageMembershipFactory

new_image_member(image, member_id)[source]
class glance.api.authorization.ImageMemberProxy(image_member, context)[source]

Bases: glance.domain.proxy.ImageMember

class glance.api.authorization.ImageMemberRepoProxy(member_repo, image, context)[source]

Bases: glance.domain.proxy.MemberRepo

add(image_member)[source]
get(member_id)[source]
list(*args, **kwargs)[source]
remove(image_member)[source]
save(image_member, from_state=None)[source]
class glance.api.authorization.ImageProxy(image, context)[source]

Bases: glance.domain.proxy.Image

class glance.api.authorization.ImageRepoProxy(image_repo, context)[source]

Bases: glance.domain.proxy.Repo

get(image_id)[source]
list(*args, **kwargs)[source]
class glance.api.authorization.ImmutableImageProxy(base, context)[source]

Bases: object

checksum
container_format
created_at
deactivate(*args, **kwargs)[source]
delete()[source]
disk_format
extra_properties
get_data(*args, **kwargs)[source]
image_id
locations
min_disk
min_ram
name
owner
protected
reactivate(*args, **kwargs)[source]
set_data(*args, **kwargs)[source]
size
status
tags
updated_at
virtual_size
visibility
class glance.api.authorization.ImmutableLocations[source]

Bases: list

append(*args, **kwargs)
extend(*args, **kwargs)
forbidden(*args, **kwargs)[source]
insert(*args, **kwargs)
pop(*args, **kwargs)
remove(*args, **kwargs)
reverse(*args, **kwargs)
sort(*args, **kwargs)
class glance.api.authorization.ImmutableMemberProxy(base)[source]

Bases: object

created_at
id
image_id
member_id
status
updated_at
class glance.api.authorization.ImmutableMetadefNamespaceProxy(base)[source]

Bases: object

created_at
delete()[source]
description
display_name
namespace
namespace_id
owner
protected
save()[source]
updated_at
visibility
class glance.api.authorization.ImmutableMetadefObjectProxy(base)[source]

Bases: object

created_at
delete()[source]
description
name
object_id
properties
required
save()[source]
updated_at
class glance.api.authorization.ImmutableMetadefPropertyProxy(base)[source]

Bases: object

delete()[source]
name
property_id
save()[source]
schema
class glance.api.authorization.ImmutableMetadefResourceTypeProxy(base)[source]

Bases: object

created_at
delete()[source]
name
namespace
prefix
properties_target
updated_at
class glance.api.authorization.ImmutableMetadefTagProxy(base)[source]

Bases: object

created_at
delete()[source]
name
save()[source]
tag_id
updated_at
class glance.api.authorization.ImmutableProperties[source]

Bases: dict

forbidden(*args, **kwargs)[source]
forbidden_key(key, *args, **kwargs)[source]
pop(*args, **kwargs)
popitem(*args, **kwargs)
setdefault(*args, **kwargs)
update(*args, **kwargs)
class glance.api.authorization.ImmutableTags[source]

Bases: set

add(*args, **kwargs)
clear(*args, **kwargs)
difference_update(*args, **kwargs)
forbidden(*args, **kwargs)[source]
intersection_update(*args, **kwargs)
pop(*args, **kwargs)
remove(*args, **kwargs)
symmetric_difference_update(*args, **kwargs)
update(*args, **kwargs)
class glance.api.authorization.ImmutableTaskProxy(base)[source]

Bases: object

begin_processing()[source]
created_at
expires_at
fail(message)[source]
input
message
owner
result
run(executor)[source]
status
succeed(result)[source]
task_id
type
updated_at
class glance.api.authorization.ImmutableTaskStubProxy(base)[source]

Bases: object

created_at
expires_at
owner
status
task_id
type
updated_at
class glance.api.authorization.MetadefNamespaceFactoryProxy(meta_namespace_factory, context)[source]

Bases: glance.domain.proxy.MetadefNamespaceFactory

new_namespace(**kwargs)[source]
class glance.api.authorization.MetadefNamespaceProxy(namespace)[source]

Bases: glance.domain.proxy.MetadefNamespace

class glance.api.authorization.MetadefNamespaceRepoProxy(namespace_repo, context)[source]

Bases: glance.domain.proxy.MetadefNamespaceRepo

get(namespace)[source]
list(*args, **kwargs)[source]
class glance.api.authorization.MetadefObjectFactoryProxy(meta_object_factory, context)[source]

Bases: glance.domain.proxy.MetadefObjectFactory

new_object(**kwargs)[source]
class glance.api.authorization.MetadefObjectProxy(meta_object)[source]

Bases: glance.domain.proxy.MetadefObject

class glance.api.authorization.MetadefObjectRepoProxy(object_repo, context)[source]

Bases: glance.domain.proxy.MetadefObjectRepo

get(namespace, object_name)[source]
list(*args, **kwargs)[source]
class glance.api.authorization.MetadefPropertyFactoryProxy(namespace_property_factory, context)[source]

Bases: glance.domain.proxy.MetadefPropertyFactory

new_namespace_property(**kwargs)[source]
class glance.api.authorization.MetadefPropertyProxy(namespace_property)[source]

Bases: glance.domain.proxy.MetadefProperty

class glance.api.authorization.MetadefPropertyRepoProxy(namespace_property_repo, context)[source]

Bases: glance.domain.proxy.MetadefPropertyRepo

get(namespace, object_name)[source]
list(*args, **kwargs)[source]
class glance.api.authorization.MetadefResourceTypeFactoryProxy(resource_type_factory, context)[source]

Bases: glance.domain.proxy.MetadefResourceTypeFactory

new_resource_type(**kwargs)[source]
class glance.api.authorization.MetadefResourceTypeProxy(meta_resource_type)[source]

Bases: glance.domain.proxy.MetadefResourceType

class glance.api.authorization.MetadefResourceTypeRepoProxy(meta_resource_type_repo, context)[source]

Bases: glance.domain.proxy.MetadefResourceTypeRepo

get(*args, **kwargs)[source]
list(*args, **kwargs)[source]
class glance.api.authorization.MetadefTagFactoryProxy(meta_tag_factory, context)[source]

Bases: glance.domain.proxy.MetadefTagFactory

new_tag(**kwargs)[source]
class glance.api.authorization.MetadefTagProxy(base)[source]

Bases: glance.domain.proxy.MetadefTag

class glance.api.authorization.MetadefTagRepoProxy(tag_repo, context)[source]

Bases: glance.domain.proxy.MetadefTagRepo

get(namespace, tag_name)[source]
list(*args, **kwargs)[source]
class glance.api.authorization.TaskFactoryProxy(task_factory, context)[source]

Bases: glance.domain.proxy.TaskFactory

new_task(**kwargs)[source]
class glance.api.authorization.TaskProxy(task)[source]

Bases: glance.domain.proxy.Task

class glance.api.authorization.TaskRepoProxy(task_repo, context)[source]

Bases: glance.domain.proxy.TaskRepo

get(task_id)[source]
class glance.api.authorization.TaskStubRepoProxy(task_stub_repo, context)[source]

Bases: glance.domain.proxy.TaskStubRepo

list(*args, **kwargs)[source]
glance.api.authorization.is_image_mutable(context, image)[source]

Return True if the image is mutable in this context.

glance.api.authorization.is_member_mutable(context, member)[source]

Return True if the image is mutable in this context.

glance.api.authorization.is_meta_resource_type_mutable(context, meta_resource_type)[source]

Return True if the meta_resource_type is mutable in this context.

glance.api.authorization.is_namespace_mutable(context, namespace)[source]

Return True if the namespace is mutable in this context.

glance.api.authorization.is_namespace_property_mutable(context, namespace_property)[source]

Return True if the object is mutable in this context.

glance.api.authorization.is_object_mutable(context, object)[source]

Return True if the object is mutable in this context.

glance.api.authorization.is_tag_mutable(context, tag)[source]

Return True if the tag is mutable in this context.

glance.api.authorization.is_task_mutable(context, task)[source]

Return True if the task is mutable in this context.

glance.api.authorization.is_task_stub_mutable(context, task_stub)[source]

Return True if the task stub is mutable in this context.

glance.api.authorization.proxy_image(context, image)[source]
glance.api.authorization.proxy_member(context, member)[source]
glance.api.authorization.proxy_meta_resource_type(context, meta_resource_type)[source]
glance.api.authorization.proxy_namespace(context, namespace)[source]
glance.api.authorization.proxy_namespace_property(context, namespace_property)[source]
glance.api.authorization.proxy_object(context, object)[source]
glance.api.authorization.proxy_tag(context, tag)[source]
glance.api.authorization.proxy_task(context, task)[source]
glance.api.authorization.proxy_task_stub(context, task_stub)[source]

glance.api.cached_images module

Controller for Image Cache Management API

class glance.api.cached_images.CachedImageDeserializer[source]

Bases: glance.common.wsgi.JSONRequestDeserializer

class glance.api.cached_images.CachedImageSerializer[source]

Bases: glance.common.wsgi.JSONResponseSerializer

class glance.api.cached_images.Controller[source]

Bases: glance.api.v1.controller.BaseController

A controller for managing cached images.

delete_cached_image(req, image_id)[source]

DELETE /cached_images/<IMAGE_ID>

Removes an image from the cache.

delete_cached_images(req)[source]

DELETE /cached_images - Clear all active cached images

Removes all images from the cache.

delete_queued_image(req, image_id)[source]

DELETE /queued_images/<IMAGE_ID>

Removes an image from the cache.

delete_queued_images(req)[source]

DELETE /queued_images - Clear all active queued images

Removes all images from the cache.

get_cached_images(req)[source]

GET /cached_images

Returns a mapping of records about cached images.

get_queued_images(req)[source]

GET /queued_images

Returns a mapping of records about queued images.

queue_image(req, image_id)[source]

PUT /queued_images/<IMAGE_ID>

Queues an image for caching. We do not check to see if the image is in the registry here. That is done by the prefetcher...

glance.api.cached_images.create_resource()[source]

Cached Images resource factory method

glance.api.common module

glance.api.common.check_quota(context, image_size, db_api, image_id=None)[source]

Method called to see if the user is allowed to store an image.

Checks if it is allowed based on the given size in glance based on their quota and current usage.

Parameters:
  • context
  • image_size – The size of the image we hope to store
  • db_api – The db_api in use for this configuration
  • image_id – The image that will be replaced with this new data size
Returns:

glance.api.common.get_remaining_quota(context, db_api, image_id=None)[source]

Method called to see if the user is allowed to store an image.

Checks if it is allowed based on the given size in glance based on their quota and current usage.

Parameters:
  • context
  • db_api – The db_api in use for this configuration
  • image_id – The image that will be replaced with this new data size
Returns:

The number of bytes the user has remaining under their quota. None means infinity

glance.api.common.get_thread_pool(lock_name, size=1024)[source]

Initializes eventlet thread pool.

If thread pool is present in cache, then returns it from cache else create new pool, stores it in cache and return newly created pool.

@param lock_name: Name of the lock. @param size: Size of eventlet pool.

@return: eventlet pool

glance.api.common.image_send_notification(bytes_written, expected_size, image_meta, request, notifier)[source]

Send an image.send message to the notifier.

glance.api.common.memoize(lock_name)[source]
glance.api.common.size_checked_iter(response, image_meta, expected_size, image_iter, notifier)[source]

glance.api.policy module

Policy Engine For Glance

class glance.api.policy.Enforcer[source]

Bases: oslo_policy.policy.Enforcer

Responsible for loading and enforcing rules

add_rules(rules)[source]

Add new rules to the Rules object

check(context, action, target)[source]

Verifies that the action is valid on the target in this context.

Parameters:
  • context – Glance request context
  • action – String representing the action to be checked
  • target – Dictionary representing the object of the action.
Returns:

A non-False value if access is allowed.

check_is_admin(context)[source]

Check if the given context is associated with an admin role, as defined via the ‘context_is_admin’ RBAC rule.

Parameters:context – Glance request context
Returns:A non-False value if context role is admin.
enforce(context, action, target)[source]

Verifies that the action is valid on the target in this context.

Parameters:
  • context – Glance request context
  • action – String representing the action to be checked
  • target – Dictionary representing the object of the action.
Raises:

glance.common.exception.Forbidden

Returns:

A non-False value if access is allowed.

class glance.api.policy.ImageFactoryProxy(image_factory, context, policy)[source]

Bases: glance.domain.proxy.ImageFactory

new_image(**kwargs)[source]
class glance.api.policy.ImageLocationsProxy(locations, context, policy)[source]

Bases: object

append(*args, **kwargs)
count(*args, **kwargs)
extend(*args, **kwargs)
index(*args, **kwargs)
insert(*args, **kwargs)
pop(*args, **kwargs)
remove(*args, **kwargs)
reverse(*args, **kwargs)
class glance.api.policy.ImageMemberFactoryProxy(member_factory, context, policy)[source]

Bases: glance.domain.proxy.ImageMembershipFactory

class glance.api.policy.ImageMemberProxy(image_member, context, policy)[source]

Bases: glance.domain.proxy.ImageMember

class glance.api.policy.ImageMemberRepoProxy(member_repo, image, context, policy)[source]

Bases: glance.domain.proxy.Repo

add(member)[source]
get(member_id)[source]
list(*args, **kwargs)[source]
remove(member)[source]
save(member, from_state=None)[source]
class glance.api.policy.ImageProxy(image, context, policy)[source]

Bases: glance.domain.proxy.Image

deactivate()[source]
delete()[source]
get_data(*args, **kwargs)[source]
locations
reactivate()[source]
set_data(*args, **kwargs)[source]
visibility
class glance.api.policy.ImageRepoProxy(image_repo, context, policy)[source]

Bases: glance.domain.proxy.Repo

add(image)[source]
get(image_id)[source]
list(*args, **kwargs)[source]
save(image, from_state=None)[source]
class glance.api.policy.ImageTarget(target)[source]

Bases: object

SENTINEL = <object object>
key_transforms(key)[source]
class glance.api.policy.MetadefNamespaceFactoryProxy(meta_namespace_factory, context, policy)[source]

Bases: glance.domain.proxy.MetadefNamespaceFactory

class glance.api.policy.MetadefNamespaceProxy(namespace, context, policy)[source]

Bases: glance.domain.proxy.MetadefNamespace

class glance.api.policy.MetadefNamespaceRepoProxy(namespace_repo, context, namespace_policy)[source]

Bases: glance.domain.proxy.MetadefNamespaceRepo

add(namespace)[source]
get(namespace)[source]
list(*args, **kwargs)[source]
save(namespace)[source]
class glance.api.policy.MetadefObjectFactoryProxy(meta_object_factory, context, policy)[source]

Bases: glance.domain.proxy.MetadefObjectFactory

class glance.api.policy.MetadefObjectProxy(meta_object, context, policy)[source]

Bases: glance.domain.proxy.MetadefObject

class glance.api.policy.MetadefObjectRepoProxy(object_repo, context, object_policy)[source]

Bases: glance.domain.proxy.MetadefObjectRepo

add(meta_object)[source]
get(namespace, object_name)[source]
list(*args, **kwargs)[source]
save(meta_object)[source]
class glance.api.policy.MetadefPropertyFactoryProxy(namespace_property_factory, context, policy)[source]

Bases: glance.domain.proxy.MetadefPropertyFactory

class glance.api.policy.MetadefPropertyProxy(namespace_property, context, policy)[source]

Bases: glance.domain.proxy.MetadefProperty

class glance.api.policy.MetadefPropertyRepoProxy(property_repo, context, object_policy)[source]

Bases: glance.domain.proxy.MetadefPropertyRepo

add(namespace_property)[source]
get(namespace, property_name)[source]
list(*args, **kwargs)[source]
save(namespace_property)[source]
class glance.api.policy.MetadefResourceTypeFactoryProxy(resource_type_factory, context, policy)[source]

Bases: glance.domain.proxy.MetadefResourceTypeFactory

class glance.api.policy.MetadefResourceTypeProxy(meta_resource_type, context, policy)[source]

Bases: glance.domain.proxy.MetadefResourceType

class glance.api.policy.MetadefResourceTypeRepoProxy(resource_type_repo, context, resource_type_policy)[source]

Bases: glance.domain.proxy.MetadefResourceTypeRepo

add(resource_type)[source]
get(*args, **kwargs)[source]
list(*args, **kwargs)[source]
class glance.api.policy.MetadefTagFactoryProxy(meta_tag_factory, context, policy)[source]

Bases: glance.domain.proxy.MetadefTagFactory

class glance.api.policy.MetadefTagProxy(meta_tag, context, policy)[source]

Bases: glance.domain.proxy.MetadefTag

class glance.api.policy.MetadefTagRepoProxy(tag_repo, context, tag_policy)[source]

Bases: glance.domain.proxy.MetadefTagRepo

add(meta_tag)[source]
add_tags(meta_tags)[source]
get(namespace, tag_name)[source]
list(*args, **kwargs)[source]
save(meta_tag)[source]
class glance.api.policy.TaskFactoryProxy(task_factory, context, policy)[source]

Bases: glance.domain.proxy.TaskFactory

class glance.api.policy.TaskProxy(task, context, policy)[source]

Bases: glance.domain.proxy.Task

class glance.api.policy.TaskRepoProxy(task_repo, context, task_policy)[source]

Bases: glance.domain.proxy.TaskRepo

add(task)[source]
get(task_id)[source]
save(task)[source]
class glance.api.policy.TaskStubProxy(task_stub, context, policy)[source]

Bases: glance.domain.proxy.TaskStub

class glance.api.policy.TaskStubRepoProxy(task_stub_repo, context, task_policy)[source]

Bases: glance.domain.proxy.TaskStubRepo

list(*args, **kwargs)[source]

glance.api.property_protections module

class glance.api.property_protections.ExtraPropertiesProxy(context, extra_props, property_rules)[source]

Bases: glance.domain.ExtraProperties

class glance.api.property_protections.ProtectedImageFactoryProxy(image_factory, context, property_rules)[source]

Bases: glance.domain.proxy.ImageFactory

new_image(**kwargs)[source]
class glance.api.property_protections.ProtectedImageProxy(image, context, property_rules)[source]

Bases: glance.domain.proxy.Image

class glance.api.property_protections.ProtectedImageRepoProxy(image_repo, context, property_rules)[source]

Bases: glance.domain.proxy.Repo

get(image_id)[source]
list(*args, **kwargs)[source]

glance.api.versions module

class glance.api.versions.Controller[source]

Bases: object

A wsgi controller that reports which API versions are supported.

index(req, explicit=False)[source]

Respond to a request for all OpenStack API versions.

glance.api.versions.create_resource(conf)[source]

Module contents

glance.api.root_app_factory(loader, global_conf, **local_conf)[source]