このセクションでは、コントローラーノードに Image service (コード名 glance) をインストールして設定する方法を説明します。簡単のため、この設定ではイメージをローカルファイルシステムに保存します。
Image service をインストールして設定する前に、データベース、サービスクレデンシャル、API エンドポイントを作成する必要があります。
データベースを作成するには、これらの手順をすべて実行します。
データベースクライアントを使用して、データベースサーバーに root ユーザーとして接続します。
$ mysql -u root -p
glance データベースを作成します。
CREATE DATABASE glance;
glance データベースに適切なアクセス権を付与します。
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY 'GLANCE_DBPASS';
GLANCE_DBPASS を適切なパスワードに置き換えます。
データベースクライアントを終了します。
admin クレデンシャルを読み込み、管理者専用 CLI コマンドへのアクセス権を取得します。
$ source admin-openrc.sh
以下の手順を実行して、サービスクレデンシャルを作成します。
glance ユーザーを作成します。
$ openstack user create --domain default --password-prompt glance
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | e38230eeff474607805b596c91fa15d9 |
| name | glance |
+-----------+----------------------------------+
admin ロールを glance ユーザーと service プロジェクトに追加します。
$ openstack role add --project service --user glance admin
注釈
このコマンドは何も出力しません。
glance サービスエンティティーを作成します。
$ openstack service create --name glance \
--description "OpenStack Image service" image
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Image service |
| enabled | True |
| id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| name | glance |
| type | image |
+-------------+----------------------------------+
Image service の API エンドポイントを作成します。
$ openstack endpoint create --region RegionOne \
image public http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 340be3625e9b4239a6415d034e98aace |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
image internal http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | a6e4b153c2ae4c919eccfdbb7dceb5d2 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
image admin http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 0c37ed58103f4300a84ff125a539032d |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+
注釈
設定ファイルのデフォルトは、ディストリビューションにより異なります。これらの既存のセクションとオプションを編集するのではなく、追加する必要があるかもしれません。また、設定のスニペットにある 省略 (...) は、保持すべきデフォルトの設定オプションを意味します。
パッケージをインストールします。
# yum install openstack-glance python-glance python-glanceclient
/etc/glance/glance-api.conf ファイルを編集し、以下の作業をすべて行います。
[database] セクションで、データベースのアクセス方法を設定します。
[database]
...
connection = mysql://glance:GLANCE_DBPASS@controller/glance
GLANCE_DBPASS を Image service データベース用に選んだパスワードで置き換えます。
[keystone_authtoken] セクションと [paste_deploy] セクションで、Identity サービスへのアクセス方法を設定します。
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
...
flavor = keystone
GLANCE_PASS を Identity において glance ユーザー用に選択したパスワードで置き換えます。
注釈
[keystone_authtoken] セクションにある他のオプションは、コメントアウトまたは削除します。
[glance_store] セクションにおいて、ローカルファイルシステムストアおよびイメージファイルの場所を設定します。
[glance_store]
...
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[DEFAULT] セクションで、noop 通知ドライバーを設定し、通知を無効化します。これらはオプションの Telemetry サービスのみに関するものだからです。
[DEFAULT]
...
notification_driver = noop
Telemetry の章に Image service の通知を有効化する設定があります。
(オプション) トラブルシューティングしやすくするために、冗長ロギングを [DEFAULT] セクションで有効にします。
[DEFAULT]
...
verbose = True
/etc/glance/glance-registry.conf ファイルを編集し、以下の作業をすべて行います。
[database] セクションで、データベースのアクセス方法を設定します。
[database]
...
connection = mysql://glance:GLANCE_DBPASS@controller/glance
GLANCE_DBPASS を Image service データベース用に選んだパスワードで置き換えます。
[keystone_authtoken] セクションと [paste_deploy] セクションで、Identity サービスへのアクセス方法を設定します。
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
...
flavor = keystone
GLANCE_PASS を Identity において glance ユーザー用に選択したパスワードで置き換えます。
注釈
[keystone_authtoken] セクションにある他のオプションは、コメントアウトまたは削除します。
[DEFAULT] セクションで、noop 通知ドライバーを設定し、通知を無効化します。これらはオプションの Telemetry サービスのみに関するものだからです。
[DEFAULT]
...
notification_driver = noop
Telemetry の章に Image service の通知を有効化する設定があります。
(オプション) トラブルシューティングしやすくするために、冗長ロギングを [DEFAULT] セクションで有効にします。
[DEFAULT]
...
verbose = True
Image サービスデータベースを展開します。
# su -s /bin/sh -c "glance-manage db_sync" glance
Image service のサービスを起動し、システム起動時に起動するよう設定します。
# systemctl enable openstack-glance-api.service \
openstack-glance-registry.service
# systemctl start openstack-glance-api.service \
openstack-glance-registry.service
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.