OpenStack Glance Documentation

repository·master·Indexed 19 days ago

https://github.com/openstack/glance

OpenStack 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.

Tokens
72.9K
Snippets
217
Records
378
Agent score
65%

What's inside OpenStack Glance

  1. Overview of OpenStack Glance

    master
    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.
  2. Overview of the OpenStack Image service (glance)

    master

    The 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.
  3. What is OpenStack Glance?

    master

    OpenStack 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.

  4. Use glance-replicator to replicate images across data centers

    master

    The glance-replicator utility 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]
  5. Understand the structure of Rally job files

    master

    The rally-jobs directory 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.
  6. Identify Glance project deliverables

    master

    The 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.
  7. What is the Glance scrub service and when to use it

    master

    The glance-scrubber is a utility used to manage the asynchronous deletion of images in Glance.

    When the delayed_delete option is enabled in glance-api.conf, a DELETE request from a client only marks the image status as pending_delete in 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 when delayed_delete is active.

    Use glance-scrubber to:

    1. Clean up storage: Periodically delete the actual image data for images marked as pending_delete to prevent the storage backend from filling up.
    2. Restore images: Revert an image's status from pending_delete back to active if it was deleted by mistake.

    Warning: If you are restoring an image, ensure the glance-scrubber is not running to avoid data inconsistency.

  8. Configure glance-manage configuration precedence

    master

    The glance-manage tool loads configuration from two files:

    1. glance-api.conf
    2. glance-manage.conf

    Warning: Options defined in glance-manage.conf will override options with the same section and name in glance-api.conf. It is recommended to migrate configuration options for glance-manage into glance-manage.conf rather than relying on the API config.

  9. Understand the relationship between Images, Instances, and Volumes

    master

    In 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.
  10. How per-tenant quotas work in Glance

    master

    Glance 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_quota limit will be ignored.
  11. How database version identifiers work during E-M-C upgrades

    master

    During 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 expand or contract in its name.

    A database is only considered to be at a specific release version (e.g., Ocata) once both the expand and contract revisions for that release are at their latest versions.

    Example progression for a 'bexar' release cycle:

    StageIdentifierComment
    E (Expand)bexar_expand01Upgrade begins
    Ebexar_expand02
    Ebexar_expand03
    M (Migrate)bexar_expand03bexar_migrate01 occurs
    Mbexar_expand03bexar_migrate02 occurs
    Mbexar_expand03bexar_migrate03 occurs
    C (Contract)bexar_expand03, bexar_contract01
    Cbexar_expand03, bexar_contract02
    Cbexar_expand03, bexar_contract03Upgrade completed
  12. Resource Type Association and Prefixes

    master

    Metadata 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:

    PropertyResource TypeRequired Prefix
    Virtual CPU TopologyGlance Imagehw_ (e.g., hw_cpu_cores=1)
    Virtual CPU TopologyNova Flavorhw: (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)