Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Glance Series 1: glance Foundation

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

What is glance?

Second, why should there be glance?

The function of three glance

Four two versions of glance

Five mirrored data storage

Access to six images

7 various states of mirrors and tasks

Eight components included in glance

9 the relationship between glance and other openstack services

Ten detailed explanation of glance workflow

National Day holiday Disk and Container format

Twelve common mirror properties and settings

XIII: the concept of metadata definition

What is glance?

Second, why should there be glance?

The function of three glance

Four two versions of glance

Five mirrored data storage

Access to six images

7 various states of mirrors and tasks

Eight components included in glance

9 the relationship between glance and other openstack services

Ten detailed explanation of glance workflow

National Day holiday Disk and Container format

Twelve common mirror properties and settings

XIII: the concept of metadata definition

What is glance?

Glance, or p_w_picpath service, is a service that provides mirroring for the creation of virtual machines.

Second, why should there be glance?

Based on openstack, we build a basic Iaas platform to provide virtual machines, and virtual machines must be created to choose the operating system to be installed, and glance service provides different operating system images for this choice.

The function of three glance

Glance service enables users to discover, register, and retrieve virtual machine images. It provides a REST API that can query virtual machine image metadata and retrieve real images.

Specific: the embodiment of REST API is a URI, and in glance, a URI address is used to uniquely identify a mirror as follows

/ v1/p_w_picpaths/

The location of the glance service

/ v1: use v1 version, see 4 for details

/ p_w_picpaths: the request type is mirrored

/: a uuid that is globally unique in glance

Four two versions of glance

In previous versions of Newton, glance supported two types of REST API V1 and V2, but the difference was obvious:

(1)。 V1 only provides basic p_w_picpath and member operation functions: image creation, deletion, download, list, details query, update, and creation, deletion and list of image tenant members.

(2)。 In addition to supporting all the functions of V1, V2 mainly adds the following functions:

Operations such as adding, deleting and modifying mirror location

Metadata namespace operation

P_w_picpath tag operation

(3) V1 and V2 have the same support for p_w_picpath store.

The V1 version of the implementation has two WSGI services, glance-api and glance-registry, both of which provide REST API, but it is important to emphasize that the REST API provided by glance-registry is for glance-api, namely The registry is a private internal service meant for use by OpenStack Image service. Do not expose this service to users .

The implementation of v2 integrates glance-registry into glance-api, which has the advantage of reducing an intermediate processing link.

It is particularly important to note (check the development manual https://docs.openstack.org/developer/glance/)

V1 is obsolete in the Newton version and will eventually be removed

Five mirrored data storage

The mirrored data include: 1. Mirror metadata; 2. The mirror itself is chunk.

The mirrored metadata is saved to the database through glance-registry, while the mirrored chunk data is stored in various bakcend store through Glance store Drivers.

In order to quickly understand glance, when configuring glance, we use file as the backend, that is, the image is stored in the local file system, and the directory where the image is uploaded or stored is on the machine (control node) based on the glance service. The default directory is: / var/lib/glance/p_w_picpaths/,. We should make sure that the directory has enough space to use.

It is important to emphasize that the fileh backend is usually located in the control node itself, so this backend is not suitable for multi-node deployment.

The glance service ran a lot of processes last week to support caching. When doing glance clusters, consider using replication services to ensure consistency and availability. Other periodic processes include auditors, updaters, and and reapers.

Access to six images

Refer to part 7. The Auth service after Glance Domain Controller is used to control the access permission of the image. Here, we need to know that all the access permissions of the image are:

Public public: can be used by all tenant.

Private private / project: can only be used by the tenant where p_w_picpath owner resides.

Shared shared: a non-shared p_w_picpath can be shared with another tenant, which can be achieved through member-* operations.

Protected protected: protected's p_w_picpath cannot be deleted.

7 various states of mirrors and tasks

7.1 status of the mirror:

The following figure shows how glance moves from one state to the next when processing mirrors.

Notes:

Queued: no p_w_picpath data is uploaded, only metadata in db.

Saving: uploading p_w_picpath data. When registering an image using POST / p_w_picpaths and currently carrying a x-p_w_picpath-meta-location header, the image will not enter the saving state (the data of the image is already available and cannot be retransmitted)

Active: when the image data is uploaded, the image can be used (available), and the image is in active status.

Deactivated: indicates that no non-administrator user has access to mirror data, forbids downloading images, and forbids operations such as image export and image cloning (requesting operations on mirror data).

Killed: indicates that an error occurred during upload and that the image is unreadable

Deleted:glance has saved the data for the mirror, but the mirror is no longer available, and the mirror in this state will be automatically deleted soon.

Pending_delete: similar to deleted, glance has not cleared the mirrored data, but the mirrors in this state cannot be recovered.

Summary:

'queued' = > (' saving', 'active',' deleted')

'saving' = > (' active', 'killed',' deleted', 'queued')

'active' = > (' queued', 'pending_delete',' deleted')

'killed' = > (' deleted')

'pending_delete' = > (' deleted')

'deleted' = > ()

7.2 status of the task

Pending

The task has been reserved, but it hasn't been processed yet.

Processing

In progress

Success

Successful execution

Failure

Indicates that an error occurred during the execution of the task and cannot continue

Eight components included in glance

Compared with the diagram in part 4, let's take a closer look at the components of glance.

Glance-api

Accept api requests and provide appropriate operations, including discovery, retrieval, storage

Glance-registry

Store, process, and retrieve mirrored metadata, such as mirror size, type, etc.

Database

You can choose your favorite database to store mirrored metadata, most of which use MySQL or SQLite.

Storage repository for p_w_picpath files

It refers to the repository where the image files are stored, or backend, which can be:

1. Local file system (or any file system mounted to the glance-api control node)

two。 Object Storage Object Storage (swift)

3. Block storage RADOS (ceph)

4.VMware data storage

5.HTTP

Metadata definition service

Provide a common API for vendors, administrators, and other openstack services, and users can customize their own metadata (meaningful).

This metadata is very powerful and can be used in different types of resources.

The p_w_picpath image itself

Artifacts

Volumes Volum

Flavors package

Aggregates host aggregation

You can take host aggregation as an example.

A host set is a collection of multiple physical hosts, in which physical hosts have one or more hardware advantages, such as large memory, solid-state disks, etc., specifically used to deploy database services.

We can make an image, and then define the metadata in the image: bind the above host combination. In this way, all virtual machines that use the image installation system will be assigned to the collection, and then a physical machine will be selected from the collection to create a virtual machine.

9 the relationship between glance and other openstack services

For glance, its client Glance Cli can be:

Command line tools for 1.glance

2.Horizon

3.nova

Like keystone, glance is another center of Iaas (see figure), keystone is the center of permissions, and glance is the center of mirroring. Glance can be accessed by end users or nova services: accept disk or mirrored API requests and define mirror metadata operations.

Ten detailed explanation of glance workflow

Notes:

A client

Applications that then use glance services, which can be command-line tools, horizon,nova, etc.

REST API

Glance is a client-server architecture that provides a REST API, and consumers perform various operations about mirroring through REST API.

Glance Domain Controller

Is the main middleware implementation in glance, which is equivalent to a dispatcher, whose function is to distribute the operations of glance internal services to each layer (Auth authentication, Notifier,Policy strategy, Quota,Location,DB database connection) specific tasks are implemented by each layer.

First floor: Auth

Verify that the mirror itself or its properties can be modified, and only the administrator and the owner of the mirror can perform the modification, otherwise an error is reported.

The second layer: Property protection

Seven-tier components controlled by glance domain controller

Is an optional layer that takes effect only if the property_protection_file parameter is set in the configuration file of glance, which provides two types of mirror properties:

1. Core attributes, specified in the mirror parameters; 2 metadata attributes, are any key/value that can be attached to a mirror

The function of this layer is to manage access to meta properties by calling glance's public API, and you can also restrict this access in its configuration file

The third layer: Notifier

Add the following information to the queue queue

1. Notification of all mirror modifications

two。 All exceptions and warnings that occur during use

Layer 4: Policy

Responsible for:

1. Define the access rules rules for the operation image, all of which are defined in the / etc/policy.json file

two。 Monitor the execution of rules

Layer 5: Quota

If the administrator sets a quota for the size of all the images he can upload to a user, the Quota layer here is used to detect whether the user's upload exceeds the quota limit:

1. If the quota limit is not exceeded, the operation to add the image is successful

two。 If the quota is exceeded, the operation to add the mirror fails and an error is reported.

The sixth floor: Location

Interact with Glance Store, such as upload and download, etc. Because there can be multiple storage backends, the location of different images is managed by this component.

Responsible for:

1. When a new mirror location is added, check whether the URI is correct.

two。 When a mirror location is changed, it is responsible for removing the mirror from the storage.

3. Prevent repetition of mirror location

The seventh floor: DB

1. The interaction with database API is realized.

two。 Convert the mirror to the appropriate format for recording in the database. And the information received from the database is converted into an operable mirror object.

Registry Layer

It belongs to an optional layer and is used to organize security.

Control the communication between Glance Domain Controller and Glance DB by using this separate service.

Glance DB

Glance services use a unified core library, Glance DB, which is shared by all components within glance that depend on the database.

Glance Store

It is used to organize the interaction between Glance and various storage backends.

All mirror file operations are performed by calling the Glance Store library, which is responsible for interacting with the external storage side and / or the local file system. Glance Store provides a unified interface to access back-end storage.

National Day holiday Disk and Container format

When we add an image to glance, you must specify the disk format and container format of the virtual machine. For disk format, please study kvm and other virtual formats.

The disk and container formats are the basic configurations for each deployment, and the common formats are as follows:

1.Disk Format

Different factory needles for different virtualization applications have different disk formats for virtual machine images:

Raw

This is an unstructured disk p_w_picpath format

Vhd

This is the VHD disk format, a common disk format used by virtual machine monitors from VMware, Xen, Microsoft, VirtualBox, and others

Vhdx

This is the VHDX disk format, an enhanced version of the vhd format which supports larger disk sizes among other features.

Vmdk

Another common disk format supported by many common virtual machine monitors

Vdi

A disk format supported by VirtualBox virtual machine monitor and the QEMU emulator

Iso

An archive format for the data contents of an optical disc (e.g. CDROM).

Ploop

A disk format supported and used by Virtuozzo to run OS Containers

Qcow2

A disk format supported by the QEMU emulator that can expand dynamically and supports Copy on Write

Aki

This indicates what is stored in Glance is an Amazon kernel p_w_picpath

Ari

This indicates what is stored in Glance is an Amazon ramdisk p_w_picpath

Ami

This indicates what is stored in Glance is an Amazon machine p_w_picpath

2.Container Format

The container container format refers to whether the virtual machine image contains a file format that also contains metadata about the actual virtual machine.

It is important to note that container format strings are not currently used by glance or other OpenStack components, so if you are not sure, it is safe to simply specify the container format bare.

You can set the container format as follows:

Bare

This indicates there is no container or metadata envelope for the p_w_picpath

Ovf

This is the OVF container format

Aki

This indicates what is stored in Glance is an Amazon kernel p_w_picpath

Ari

This indicates what is stored in Glance is an Amazon ramdisk p_w_picpath

Ami

This indicates what is stored in Glance is an Amazon machine p_w_picpath

Ova

This indicates what is stored in Glance is an OVA tar archive file

Docker

This indicates what is stored in Glance is a Docker tar archive of the container filesystem

Twelve common mirror properties and settings

Operating system architecture, modified as follows

Openstack p_w_picpath set IMG-UUID-property architecture=x86_64

More hits here, http://docs.openstack.org/cli-reference/glance-property-keys.html.

Instance_uuid

Is metadata that can be used to record the instances associated with this mirror. (provide information only and do not create instance snapshots. )

Kernel_id

The ID of p_w_picpath stored in Glance that should be used as the kernel when booting an AMI-style p_w_picpath.

Ramdisk_id

The ID of p_w_picpath stored in Glance that should be used as the ramdisk when booting an AMI-style p_w_picpath.

Os_distro

The release version of the operating system

For more information, click here http://docs.openstack.org/cli-reference/glance-property-keys.html

Os_version

Vendor-specified version of the operating system

XIII: the concept of metadata definition

Http://docs.openstack.org/developer/glance/metadefs-concepts.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report