GNU/Linux >> Linux の 問題 >  >> Ubuntu

Ubuntu14.04.2上のOpenStackKilo–Glanceの構成

この投稿では、コントローラーノードでコードネームGlanceのOpenStackイメージサービスを構成する方法について説明します。コントローラノードにローカルに画像を保存するようにglanceを設定します。先に進む前に、KeyStoneサービスが構成されていることを確認してください。

KeyStoneをまだ構成していない場合は、以下の2つの投稿を確認できます。

Ubuntu14.04.2でのOpenStackKilo-KeyStone#1の構成

Ubuntu14.04.2でのOpenStackKilo-KeyStone#2の構成

管理者およびデモユーザー用のクライアント環境スクリプトを作成します。これらのスクリプトは、クライアント操作に適切なクレデンシャルをロードするのに役立ちます。

admin-openrc.shファイルを作成します。

# nano admin-openrc.sh

次のコンテンツをファイルに貼り付けます。

export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=password
export OS_AUTH_URL=http://controller:35357/v3

パスワードをKeyStone#2で管理者ユーザー用に作成したパスワードに置き換えます

demo-openrc.shファイルを作成します。

# nano demo-openrc.sh

以下のコンテンツをファイルに貼り付けます。

export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=demo
export OS_TENANT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=password
export OS_AUTH_URL=http://controller:5000/v3

パスワードを、KeyStone#2でデモユーザー用に作成したパスワードに置き換えます。

前提条件:

ルートとしてMySQLデータベースサーバーにログインします。

# mysql -u root -p

一目でわかるデータベースを作成します。

CREATE DATABASE glance;

glanceデータベースへの適切なアクセスを設定します。

GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'password';

パスワードを適切なパスワードに置き換えます。

管理者の資格情報を読み込みます。

# source admin-openrc.sh

glanceユーザーを作成します。

# openstack user create --password-prompt glance
User Password:
Repeat User Password:
+----------+----------------------------------+
| Field    | Value                            |
+----------+----------------------------------+
| email    | None                             |
| enabled  | True                             |
| id       | f4bed648d59f44bfa31d9bb670fa7bc2 |
| name     | glance                           |
| username | glance                           |
+----------+----------------------------------+

glanceユーザーおよびサービスプロジェクトに管理者の役割を追加します。

# openstack role add --project service --user glance admin
+-------+----------------------------------+
| Field | Value                            |
+-------+----------------------------------+
| id    | 33af4f957aa34cc79451c23bf014af6f |
| name  | admin                            |
+-------+----------------------------------+

Glanceサービスエンティティを作成します。

# openstack service create --name glance --description "OpenStack Image service" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image service          |
| enabled     | True                             |
| id          | f75a73447c504fceb4cdf898a9033d81 |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+

一目でわかるAPIエンドポイントを作成します。

# openstack endpoint create \
--publicurl http://controller:9292 \
--internalurl http://controller:9292 \
--adminurl http://controller:9292 \
--region RegionOne \
image

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| adminurl     | http://controller:9292           |
| id           | e38a6ecf4f9347a29026706719ef2988 |
| internalurl  | http://controller:9292           |
| publicurl    | http://controller:9292           |
| region       | RegionOne                        |
| service_id   | f75a73447c504fceb4cdf898a9033d81 |
| service_name | glance                           |
| service_type | image                            |
+--------------+----------------------------------+

glanceのインストールと構成:

パッケージをインストールします。

# apt-get install glance python-glanceclient

/etc/glance/glance-api.confを編集し、以下の設定を変更して、適切なセクションにエントリを配置してください。

[DEFAULT]
...
notification_driver = noop
verbose = True

[database]
...
connection = mysql://glance:password@controller/glance
## Replace with the password you chose for glance database

[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 = password
## Replace this with the password you chose for glance user in the identity service.

[paste_deploy]
...
flavor = keystone

[glance_store]
...
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

/etc/glance/glance-registry.confファイルを編集し、以下の設定を変更して、適切なセクションにエントリを配置してください。

[DEFAULT]
...
notification_driver = noop
verbose = True

[database]
...
connection = mysql://glance:password@controller/glance 
## Replace with the password you chose for glance database

[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 = password 
## Repalce this with the password you chose for glance user in the identity service

[paste_deploy]
...
flavor = keystone

glanceデータベースにデータを入力します。

# su -s /bin/sh -c "glance-manage db_sync" glance

サービスを再開します。

# service glance-registry restart
# service glance-api restart

SQLiteデータベースファイルを削除します。

# rm -f /var/lib/glance/glance.sqlite

操作の確認:

ここでは、Fedora 22のクラウドイメージをOpenStack環境にアップロードして、イメージサービスを検証します。

クライアント環境スクリプトでは、APIバージョン2.0を使用するようにImageServiceクライアントを構成します。

# echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh

管理者の資格情報を読み込みます。

# source admin-openrc.sh

/tmpディレクトリにFedora22クラウドイメージをダウンロードします。

# cd /tmp

# wget https://download.fedoraproject.org/pub/fedora/linux/releases/22/Cloud/x86_64/Images/Fedora-Cloud-Base-22-20150521.x86_64.qcow2

画像をアップロードします。

#  glance image-create --name "Fedora-Cloud-Base-22-20150521.x86_64" --file /tmp/Fedora-Cloud-Base-22-20150521.x86_64.qcow2 --disk-format qcow2 --container-format bare --visibility public --progress

以下の出力が得られます。

[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 18abc933d17f69d55ecea0d19f8f5c71     |
| container_format | bare                                 |
| created_at       | 2015-06-28T17:42:59Z                 |
| disk_format      | qcow2                                |
| id               | a1533d87-d6fa-4d9d-bf85-6b2ab8400712 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | Fedora-Cloud-Base-22-20150521.x86_64 |
| owner            | 9b05e6bffdb94c8081d665561d05e31e     |
| protected        | False                                |
| size             | 228599296                            |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2015-06-28T17:43:27Z                 |
| virtual_size     | None                                 |
| visibility       | public                               |
+------------------+--------------------------------------+

アップロードされた画像を一覧表示します。

# glance image-list
+--------------------------------------+--------------------------------------+
| ID                                   | Name                                 |
+--------------------------------------+--------------------------------------+
| a1533d87-d6fa-4d9d-bf85-6b2ab8400712 | Fedora-Cloud-Base-22-20150521.x86_64 |
+--------------------------------------+--------------------------------------+

それがすべてです!!!、あなたはGlanceを首尾よく混乱させました。次は、Nova(Compute)を構成します。


Ubuntu
  1. Ubuntu14.04.2でのOpenStackKilo– Neutron#1の構成

  2. Ubuntu14.04.2でのOpenStackKilo–Novaの構成

  3. Ubuntu14.04.2でのOpenStackKilo– KeyStone#2の構成

  1. Ubuntu14.04.2でのOpenStackKilo– KeyStone#1の構成

  2. Ubuntu14.04.2にOpenStackKiloをインストールします

  3. Ubuntu14.04.2でのOpenStackKilo– Swift#1の構成

  1. Ubuntu14.04.2でのOpenStackKilo– Cinder#2の構成

  2. Ubuntu14.04.2でのOpenStackKilo– Cinder#1の構成

  3. Ubuntu14.04.2上のOpenStackKilo–Horizo​​nの構成