Glance
仮想マシンイメージの管理88
コンポーネント
glance-api
glance-registry
Database
Storage repository for image files
Metadata definition service
install
データベースの作成
code:sql
CREATE DATABASE glance;
権限付与
code:sql
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
code:sql
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
サービス認証情報の作成
ユーザ作成
code:shell
# openstack user create --domain default --password-prompt glance
glance ユーザとサービスプロジェクトに管理者ロールを追加
code:shell
# openstack role add --project service --user glance admin
glance サービスエンティティ
code:shell
# openstack service create --name glance \
--description "OpenStack Image" image
Image サービス API エンドポイントの作成
code:shell
パッケージのインストール
code:shell
# yum install openstack-glance
/etc/glance/glance-api.conf の編集
code:shell
# diff -u /etc/glance/glance-api.conf.org /etc/glance/glance-api.conf
--- /etc/glance/glance-api.conf.org 2020-05-13 19:46:21.000000000 +0900
+++ /etc/glance/glance-api.conf 2020-07-31 22:04:29.256794546 +0900
@@ -2076,7 +2076,7 @@
# Deprecated group/name - DEFAULT/sql_connection # Deprecated group/name - DATABASE/sql_connection # Deprecated group/name - sql/connection -#connection = <None>
+connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
# The SQLAlchemy connection string to use to connect to the slave database.
# (string value)
@@ -3469,7 +3469,7 @@
#
# This option is scheduled for removal in the U development
# cycle.
-#stores = file,http
+stores = file,http
# DEPRECATED:
# The default scheme to use for storing images.
@@ -3522,7 +3522,7 @@
#
# This option is scheduled for removal in the U development
# cycle.
-#default_store = file
+default_store = file
#
# Information to match when looking for cinder in the service catalog.
@@ -3843,7 +3843,7 @@
# * filesystem_store_file_perm
#
# (string value)
-#filesystem_store_datadir = /var/lib/glance/images
+filesystem_store_datadir = /var/lib/glance/images
#
# List of directories and their priorities to which the filesystem
@@ -5044,7 +5044,8 @@
# endpoint the service user utilizes for validating tokens, because normal end
# users may not be able to reach that endpoint. (string value)
-#www_authenticate_uri = <None>
# DEPRECATED: Complete "public" Identity API endpoint. This endpoint should not
# be an "admin" endpoint, as it should be accessible by all end users.
@@ -5105,7 +5106,7 @@
# Optionally specify a list of memcached server(s) to use for caching. If left
# undefined, tokens will instead be cached in-process. (list value)
-#memcached_servers = <None>
+memcached_servers = controller:11211
# In order to prevent excessive effort spent validating tokens, the middleware
# caches previously-seen tokens for a configurable duration (in seconds). Set to
@@ -5185,7 +5186,12 @@
# Authentication type to load (string value)
-#auth_type = <None>
+auth_type = password
+project_domain_name = Default
+user_domain_name = Default
+project_name = service
+username = glance
+password = glance
# Config Section from which to load plugin specific options (string value)
@@ -5703,7 +5709,7 @@
# This option has a sample default set, which means that
# its actual default value may vary from the one documented
# below.
-#flavor = keystone
+flavor = keystone
#
# Name of the paste configuration file.
Image データベース作成
code:shell
# su -s /bin/sh -c "glance-manage db_sync" glance
自動起動設定等々
code:shell
# systemctl enable openstack-glance-api.service
# systemctl start openstack-glance-api.service
動作確認
イメージのダウンロード
code:shell
QCOW2 ディスクフォーマット、ベアコンテナフォーマットを使用して Image サービスに画像をアップロード
code:shell
# glance image-create --name "cirros" \
--file cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--visibility=public
確認
code:shell
# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 1451dfe4-5719-48e6-afb8-7dc0f4bc7a1e | cirros | active |
+--------------------------------------+--------+--------+