OpenStack Glance Documentation
repository·master·Indexed 19 days ago
https://github.com/openstack/glanceOpenStack Glance is an image service that provides the infrastructure to store, manage, and distribute bootable disk images and associated metadata for OpenStack compute resources. Documentation covers the Metadata Definitions Service (metadefs), deployment options using uWSGI and mod_wsgi, Keystone authentication configuration, and the management of the Glance Image Cache, including pruning, cleaning, and listing cached images.
What's inside OpenStack Glance
- OpenStack Glance is a service designed to store, browse, share, distribute, and manage bootable disk images. It also manages other data associated with initializing compute resources and handles metadata definitions.
Overview of the OpenStack Image service (glance)
masterThe OpenStack Image service (glance) is a central component of Infrastructure-as-a-Service (IaaS) that allows users to discover, register, and retrieve virtual machine images. It provides a REST API for querying image metadata and retrieving actual image files.
Key capabilities include:
- Image Management: Querying metadata and retrieving/storing disk or server images.
- Flexible Storage: Storing images in various locations such as local file systems, OpenStack Object Storage, RADOS block devices, VMware datastores, or via HTTP.
- Metadata Definitions: A common API for defining custom metadata (keys, descriptions, constraints) that can be associated with resources like images, artifacts, volumes, flavors, and aggregates.
- Background Processes: Includes periodic processes for caching, replication (for consistency/availability), auditors, updaters, and reapers.
What is OpenStack Glance?
masterOpenStack Glance (the Image service) is a service used to upload, discover, and retrieve data assets, primarily virtual machine (VM) images. It provides a RESTful API for querying image metadata and retrieving the actual image files.
Glance supports various storage backends, ranging from local filesystems to object-storage systems like OpenStack Swift.
Use glance-replicator to replicate images across data centers
masterThe
glance-replicatorutility is used to populate a new Glance server using images from an existing Glance server. When replicating, the images in the destination (slave) server preserve the UUIDs, metadata, and image data from the original (master) server.glance-replicator <command> [options] [args]Understand the structure of Rally job files
masterThe
rally-jobsdirectory contains Rally tasks and plugins used by OpenStack CI. The directory structure is organized as follows:plugins/: A directory for adding Rally plugins. Since Rally is highly extensible, you can add plugins here for Benchmark contexts, Benchmark scenarios, SLA checks, or Generic cleanup resources.extra/: Files in this directory are copied to the gates environment. This allows you to use absolute paths in your Rally tasks, as these files will be accessible at~/.rally/extra/*.glance.yaml: A specific task designed to be run in gates against an OpenStack (nova network) deployment provided by DevStack.
Identify Glance project deliverables
masterThe Glance project is composed of three primary deliverables. Depending on your goal (API usage, storage backend development, or client integration), you should refer to the specific repository and documentation for that component:
- glance: The core OpenStack Image service.
- glance_store: The Glance stores library (used for storage backend implementations).
- python-glanceclient: The Python client library for the OpenStack Image API, which includes a CLI shell.
What is the Glance scrub service and when to use it
masterThe
glance-scrubberis a utility used to manage the asynchronous deletion of images in Glance.When the
delayed_deleteoption is enabled inglance-api.conf, a DELETE request from a client only marks the image status aspending_deletein the database and returns immediately. This prevents client timeouts on large images, but Glance does not delete the actual image data from the storage backend whendelayed_deleteis active.Use
glance-scrubberto:- Clean up storage: Periodically delete the actual image data for images marked as
pending_deleteto prevent the storage backend from filling up. - Restore images: Revert an image's status from
pending_deleteback toactiveif it was deleted by mistake.
Warning: If you are restoring an image, ensure the
glance-scrubberis not running to avoid data inconsistency.- Clean up storage: Periodically delete the actual image data for images marked as
Configure glance-manage configuration precedence
masterThe
glance-managetool loads configuration from two files:glance-api.confglance-manage.conf
Warning: Options defined in
glance-manage.confwill override options with the same section and name inglance-api.conf. It is recommended to migrate configuration options forglance-manageintoglance-manage.confrather than relying on the API config.Understand the relationship between Images, Instances, and Volumes
masterIn OpenStack, the Image service (Glance) manages the storage and lifecycle of disk images, which serve as templates for virtual machines.
Key concepts include:
- Images: Templates containing a virtual disk with a bootable operating system. Changes made to an instance do not affect the base image.
- Instances: Individual virtual machines running on compute nodes. Each instance runs from a copy of a base image.
- Snapshots: Captures of an instance's running disk state. You can create new images based on these snapshots.
- Flavors: A set of virtual resources (vCPU count, RAM amount, and ephemeral disk size) that you must select when launching an instance.
- Ephemeral Storage: Temporary storage provided by the instance flavor. This storage is purged when the instance is deleted.
- Persistent Volumes: Provided by the Block Storage service (Cinder), these remain intact even after an instance is deleted.
How per-tenant quotas work in Glance
masterGlance implements per-tenant resource consumption quotas using Keystone's unified limits functionality. Instead of global limits, resource limits are registered in Keystone and can be overridden for specific tenants.
Key behaviors to note:
- Soft Limits: Most storage-focused quotas are 'soft limits'. Because Glance allows streaming image data of unknown size, it may not detect a quota violation until the upload or import operation is complete. A user might exceed their quota during a single operation, but subsequent operations will be denied.
- Best-Effort Enforcement: Quota checks happen per request and are not globally serialized across workers. Concurrent asynchronous operations might collectively push usage above the limit before the check catches them. Enforcement is considered best-effort.
- Legacy Limits: If per-tenant quotas are enabled, the legacy global
user_storage_quotalimit will be ignored.
How database version identifiers work during E-M-C upgrades
masterDuring a zero-downtime upgrade, the database version identifier is composite, reflecting the current stage of the E-M-C cycle. An identifier will explicitly contain
expandorcontractin its name.A database is only considered to be at a specific release version (e.g., Ocata) once both the
expandandcontractrevisions for that release are at their latest versions.Example progression for a 'bexar' release cycle:
Stage Identifier Comment E (Expand) bexar_expand01Upgrade begins E bexar_expand02E bexar_expand03M (Migrate) bexar_expand03bexar_migrate01occursM bexar_expand03bexar_migrate02occursM bexar_expand03bexar_migrate03occursC (Contract) bexar_expand03, bexar_contract01C bexar_expand03, bexar_contract02C bexar_expand03, bexar_contract03Upgrade completed Resource Type Association and Prefixes
masterMetadata definitions are linked to specific Resource Types to drive UI and CLI views. Because different services often require different prefixes for the same underlying property, the API allows you to retrieve the correct prefixed key based on the target resource type.
Examples of prefix variations:
Property Resource Type Required Prefix Virtual CPU Topology Glance Image hw_(e.g.,hw_cpu_cores=1)Virtual CPU Topology Nova Flavor hw:(e.g.,hw:cpu_cores=1)Scoped Property ( companyx:fastio)Host Aggregate (none) (e.g., companyx:fastio=true)Scoped Property ( companyx:fastio)Nova Flavor (for AggregateInstanceExtraSpecsFilter)aggregate_instance_extra_specs:(e.g.,aggregate_instance_extra_specs:companyx:fastio=true)