103
OpenStack構築手順書 Icehouse日本仮想化技術 1 OpenStack構築手順書 Icehouseバージョン:1.1 2014710日作成 日本仮想化技術株式会社

OpenStack Icehouse構築手順書

Embed Size (px)

Citation preview

Page 1: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 1

OpenStack構築手順書 Icehouse版

バージョン:1.1

2014年7月10日作成

日本仮想化技術株式会社

Page 2: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 2

変更履歴

バージョン 更新日 更新内容

1.0 2014/06/04 Icehouse版初版

1.1 2014/07/10 Swift、Heat構築手順追加

Page 3: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 3

目次1. 構築する環境について

1–1 環境構築に使用するOS

1–2 作成するノード1–3 仮想マシンの設定1–4 ネットワーク全体の設定1–5 各ノードのネットワーク設定1–6 Ubuntuのインストール1–7 Ubuntuへのログインとroot権限1–8 設定ファイル等の記述について

2. インストール前設定2–1 ネットワークデバイスの設定2–2 静的名前解決の設定2–3 sysctlによるシステムの設定2–4 aptのアップデート2–5 NTPのインストール2–6 Python用MySQLクライアントのインストール

3. controllerノードのインストール前設定3–1 MySQLサーバーのインストール3–2 RabbitMQのインストール3–3 環境変数設定ファイル作成

4. Keystoneインストールと設定(controllerノード)4–1 パッケージのインストール4–2 データベースの作成・確認4–3 設定の変更4–4 使用しないデータベースファイルの削除4–5 データベースに表を作成4–6 サービスの再起動4–7 ログの確認4–8 認証情報の設定4–9 Keystone設定確認

5. Glanceのインストールと設定5–1 パッケージのインストール5–2 データベースの作成・確認5–3 認証情報の設定5–4 設定の変更5–5 データベースに表を作成5–6 サービス再起動5–7 ログ確認5–8 イメージの取得と登録

6. Novaのインストール・設定(controllerノード)6–1 パッケージインストール

Page 4: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 4

6–2 データベースの作成・確認6–3 認証情報の設定6–4 設定変更6–5 使用しないデータベースファイル削除6–6 データベースに表を作成6–7 サービス再起動6–8 ログ確認6–9 Glanceとの通信確認

7. Novaのインストール・設定(compute1ノード)7–1 パッケージインストール7–2 カーネル設定変更7–3 設定の変更7–4 使用しないデータベースファイル削除7–5 サービス再起動7–6 ログ確認7–7 controllerノードとの疎通確認

8. Neutronのインストール・設定(controllerノード)8–1 パッケージインストール8–2 データベース作成・確認8–3 認証情報の設定8–4 設定の変更8–5 使用しないデータベースファイル削除8–6 サービス再起動8–7 ログ確認

9. Neutronのインストール・設定(networkノード)9–1 パッケージインストール9–2 設定の変更9–3 Open vSwitchサービス再起動9–4 ブリッジデバイス設定9–5 ブリッジデバイス設定確認9–6 ネットワークインタフェースの設定変更9–7 networkノード再起動9–8 ブリッジ設定確認9–9 サービス再起動9–10 ログ確認

10. Neutornのインストール・設定(compute1ノード)10–1 パッケージインストール10–2 設定の変更10–3 Open vSwitchサービス再起動10–4 ブリッジ作成10–5 サービス再起動10–6 ログ確認

11. 仮想ネットワーク設定(controllerノード)11–1 外部接続ネットワークの設定

Page 5: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 5

11–2 インスタンス用ネットワーク設定11–3 仮想ネットワークルーター設定

12. 仮想ネットワーク設定確認(networkノード)12–1 仮想ネットワークルーターの確認12–2 仮想ルーターのネームスペースのIPアドレスを確認12–3 仮想ゲートウェイの疎通確認

13. Cinderインストール(controllerノード)13–1 パッケージインストール13–2 データベース作成・確認13–3 認証情報の設定13–4 設定の変更13–5 使用しないデータベースファイル削除13–6 データベースに表を作成13–7 サービス再起動13–8 ログ確認13–9 イメージ格納用ボリューム作成

14. Ceilometerインストール・設定(controllerノード)14–1 パッケージインストール14–2 デフォルトのデータベースファイル削除14–3 mongodb データベース設定14–4 mongodbサービス再起動14–5 mongodbデータベース作成14–6 認証情報の設定14–7 設定の変更14–8 使用しないデータベースファイル削除14–9 サービス再起動14–10 ログ確認

15. Ceilometerインストール・設定(compute1ノード)15–1 パッケージインストール15–2 設定の変更15–3 サービス再起動15–4 ログ確認15–5 計測項目取得確認

16. フロントエンドインストール・確認(controllerノード)16–1 パッケージインストール16–2 フロントエンドアクセス確認

17. セキュリティグループ設定(controllerノード)17–1 demo環境変数設定ファイル読み込み17–2 ICMPパケット透過設定17–3 SSHパケット透過設定17–4 設定確認

18. Swiftのインストールと設定18–1 共通設定(controllerノード、compute1ノード)18–2 認証情報の設定(controllerノード)

Page 6: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 6

18–3 Swiftストレージノード設定(compute1ノード)18–4 Swiftプロキシ設定(controllerノード)18–5 リングファイル作成・設定(controllerノード)18–6 リング設定反映(compute1ノード)

19. Heat 動作確認(controllerノード)19–1 admin環境変数設定ファイル読み込み19–2 Swift状態確認19–3 テスト用ファイル作成19–4 テスト用ファイルアップロード19–5 テスト用ファイルダウンロード19–6 ダウンロード確認

20. Heat のインストールと設定(controllerノード)20–1 パッケージのインストール20−2 データベースの作成・確認20–3 認証情報の設定20–4 設定の変更20–5 使用しないデータベースファイルの削除20–6 データベースに表を作成20–7 サービス再起動20–8 ログ確認

21. Heat 動作確認(controllerノード)21–1 demo環境変数読み込み21–2 テンプレートファイル作成21–3 スタック作成21–4 スタック作成確認

Page 7: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 7

1. 構築する環境について

1–1 環境構築に使用するOS

今回構築するOpenStack環境はUbuntu Server 14.04LTS上に構築します、以下からイメージをダウンロードしてインストールします。

http://releases.ubuntu.com/14.04/ubuntu–14.04-server-amd64.iso

※Ubuntu Server 12.04LTSを使用して構築を行う場合、The Ubuntu Cloud Archiveのリポジトリを使用する必要があります。

1–2 作成するノード今回構築するOpenStack環境は、以下の3ノードで構成します。

controllerノードOpenStack環境全体を管理するコントローラーとして機能します。networkノード外部ネットワークとインスタンスの間のネットワークを制御します。compute1ノード仮想マシンインスタンスを実行します。

1–3 仮想マシンの設定本手順書はMac OS X上で動作するParallels Desktop 9を使用した環境での構築手順を解説しています。その他の仮想マシンソフトウェアを使用する場合は、適宜用語、設定などを読み替えて下さい。

controllerノードにゲストOSのイメージを配置するので、仮想ハードディスクを別途追加しておきます。Linuxからは/dev/sdbとして認識されます。compute1ノードはCPU仮想化機能を有効にしておきます。ネットワークインターフェースを2つ作成します。1つ目をホストオンリーネットワーク、2つ目を共有ネットワークに接続します。

※Parallels Desktopの仕様上、外部に接続できる共有ネットワーク(NAT)が1つしか作成できないため、このような設定となっています。外部へNATできる仮想ネットワークを複数作成できる仮想マシンソフトウェアの場合には、両方のネットワークを共有ネットワークに接続しても構いません。

Page 8: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 8

1–4 ネットワーク全体の設定

内部ネットワークノード間の通信のために使用するネットワーク。インターネットへの接続は行えなくても構いません。外部ネットワーク外部との接続に使用するネットワーク。OpenStackのFloating IPを利用して、クライアントからcompute1ノード上のインスタンスへと接続できます。aptコマンドを使って外部リポジトリからパッケージなどをダウンロードするため、外部接続が必要となります。今回はeth1から外部インターネット接続を行っています。各種APIを外部公開する際にも使用できますが、今回は公開は行っていません。

内部ネットワーク 外部ネットワーク

インターフェース eth0 eth1

仮想化ソフト ホストオンリーネットワーク 共有ネットワーク

ネットワーク 192.168.0.0/24 10.0.0.0/24

ゲートウェイ なし 10.0.0.1

ネームサーバー なし 10.0.0.1

1–5 各ノードのネットワーク設定

controllerノード

インターフェース eth0 eth1

IPアドレス 192.168.0.10 10.0.0.10

ネットマスク 255.255.255.0 255.255.255.0

ゲートウェイ なし 10.0.0.1

ネームサーバー なし 10.0.0.1

networkノード

インターフェース eth0 eth1

IPアドレス 192.168.0.9 10.0.0.9

ネットマスク 255.255.255.0 255.255.255.0

ゲートウェイ なし 10.0.0.1

ネームサーバー なし 10.0.0.1

compute1ノード

Page 9: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 9

インターフェース eth0 eth1

IPアドレス 192.168.0.11 10.0.0.11

ネットマスク 255.255.255.0 255.255.255.0

ゲートウェイ なし 10.0.0.1

ネームサーバー なし 10.0.0.1

Page 10: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 10

1–6 Ubuntuのインストール

優先ネットワークインターフェースの指定インストール時は優先ネットワークインターフェース(Primary networkinterface)に選択したインターフェースのみDHCPで設定されるので、外部インターネットに接続できる側のネットワークインターフェースを選択します。今回の環境ではeth1を選択します。OpenSSH serverをインストールするcompute1ノードでKVMを実行するが、Virtual machine hostはインストールしないこと。インストール時の設定パラメータ例

設定項目 設定例

初期起動時のLanguage English

起動 Install Ubuntu Server

Language English - English

Country location other→Asia→Japan

Country locale United States - en_US.UTF–8

Detect keyboard layout No

Keyboard Japanese→Japanese

Primary network interface eth1: Ethernet

Hostname それぞれのノード名

ユーザ名 フルネームで入力

アカウント名 ユーザ名のファーストネームで設定される

パスワード 任意のパスワード

Weak password(出ない場合も) Yesを選択

ホームの暗号化 任意

タイムゾーン Asia/Tokyoであることを確認

パーティション設定 Guided - use entire disk and set up LVM

パーティション選択 sdaを選択

パーティション書き込み Yesを選択

パーティションサイズ デフォルトのまま

変更の書き込み Yesを選択

HTTP proxy 環境に合わせて任意

アップグレード 任意

ソフトウェア OpenSSH serverのみ選択

GRUB Yesを選択

インストール完了 Continueを選択

Page 11: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 11

1–7 Ubuntuへのログインとroot権限インストールしたUbuntuはセキュリティの設定が行われているため、root権限が必要となる作業は以下のように行ってください。

rootで直接ログインできないので、インストール時に作成したアカウントでログインする。root権限が必要な場合には、sudoコマンドを使用する。rootで連続して作業したい場合には、sudo -sコマンドでシェルを起動する。

1–8 設定ファイル等の記述について

設定ファイルは特別な記述が無い限り、必要な設定を抜粋したものです。特に変更が必要ない設定項目は省略されています。[見出し]が付いている場合、その見出しから次の見出しまでの間に設定を記述します。コメントアウトされていない設定項目が存在する場合には、値を変更してください。多くの設定項目は記述が存在しているため、エディタの検索機能で検索することをお勧めします。既存の設定を記述に含む場合には、値の変更が不要であることを示すために斜体にしている場合があります。

設定ファイルの記述例

[database] ←この見出しから次の見出しまでの間に以下を記述#connection = sqlite:////var/lib/glance/glance.sqlite ← 既存設定をコメントアウトconnection = mysql://glance:password@controller/glance ← 追記

[keystone_authtoken] ← 見出し#auth_host = 127.0.0.1 ← 既存設定をコメントアウトauth_host = controller ← 追記

auth_port = 35357 ← 既存のまま

auth_protocol = http ← 既存のまま

auth_uri = http://controller:5000/v2.0 ← 追記

admin_tenant_name = service ← 変更

admin_user = glance ← 変更

admin_password = password ← 変更

Page 12: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 12

2. インストール前設定OpenStackパッケージのインストール前に各々のノードで以下の設定を行います。

ネットワークデバイスの設定静的名前解決の設定sysctlによるシステムの設定aptの設定NTPのインストールPython用MySQLクライアントのインストールMySQLサーバーのインストール(controllerノードのみ)RabbitMQのインストール(controllerノードのみ)

2–1 ネットワークデバイスの設定各ノードの/etc/network/interfacesを編集し、IPアドレスの設定を行います。

2–1–1 controllerノードのIPアドレスの設定

/etc/network/interfaces

auto eth0

iface eth0 inet static

address 192.168.0.10

netmask 255.255.255.0

auto eth1

iface eth1 inet static

address 10.0.0.10

netmask 255.255.255.0

gateway 10.0.0.1

dns-nameservers 10.0.0.1

Page 13: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 13

2–1–2 networkノードのIPアドレスの設定

/etc/network/interfaces

auto eth0

iface eth0 inet static

address 192.168.0.9

netmask 255.255.255.0

auto eth1

iface eth1 inet static

address 10.0.0.9

netmask 255.255.255.0

gateway 10.0.0.1

dns-nameservers 10.0.0.1

2–1–3 compute1ノードのIPアドレスの設定

/etc/network/interfaces

auto eth0

iface eth0 inet static

address 192.168.0.11

netmask 255.255.255.0

auto eth1

iface eth1 inet static

address 10.0.0.11

netmask 255.255.255.0

gateway 10.0.0.1

dns-nameservers 10.0.0.1

2–1–4 ネットワーク設定反映

各ノードで変更した設定をネットワークデバイスに反映します。

※Ubuntu Server 14.04LTSはserviceコマンドや/etc/init.d/でのネットワークデバイスの再起動を行えないので、直接ネットワークデバイスの停止・起動を行って設定を反映させます。

# ifdown eth0 eth1;ifup eth0 eth1

Page 14: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 14

2–2 静的名前解決の設定各ノードの/etc/hostsに各ノードのIPアドレスとホスト名を記述し、静的名前解決の設定を行います。127.0.1.1の行はコメントアウトします。

2–2–1 controllerノードの/etc/hostsの設定

/etc/hosts

127.0.0.1 localhost

#127.0.1.1 controller ← 既存設定をコメントアウト192.168.0.10 controller

192.168.0.9 network

192.168.0.11 compute1

2–2–2 networkノードの/etc/hostsの設定

/etc/hosts

127.0.0.1 localhost

#127.0.1.1 network ← 既存設定をコメントアウト192.168.0.9 network

192.168.0.10 controller

192.168.0.11 compute1

2–2–3 compute1ノードの/etc/hostsの設定

/etc/hosts

127.0.0.1 localhost

#127.0.1.1 compute1 ← 既存設定をコメントアウト192.168.0.11 compute1

192.168.0.9 network

192.168.0.10 controller

Page 15: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 15

2–3 sysctlによるシステムの設定Linuxのネットワークパケット処理について設定を行います。

2–3–1 controllerノードの/etc/sysctl.confの設定

/etc/sysctl.conf

net.ipv4.conf.default.rp_filter=0

net.ipv4.conf.all.rp_filter=0

sysctlコマンドで設定を適用します。

controller# sysctl -p

net.ipv4.conf.default.rp_filter = 0

net.ipv4.conf.all.rp_filter = 0

2–3–2 networkノードの/etc/sysctl.confの設定

/etc/sysctl.conf

net.ipv4.conf.default.rp_filter=0

net.ipv4.conf.all.rp_filter=0

net.ipv4.ip_forward=1

sysctlコマンドで設定を適用します。

network# sysctl -p

net.ipv4.conf.default.rp_filter = 0

net.ipv4.conf.all.rp_filter = 0

net.ipv4.ip_forward=1

2–3–3 compute1ノードの/etc/sysctl.confの設定

/etc/sysctl.conf

net.ipv4.conf.default.rp_filter=0

net.ipv4.conf.all.rp_filter=0

sysctlコマンドで設定を適用します。

compute1# sysctl -p

net.ipv4.conf.default.rp_filter = 0

net.ipv4.conf.all.rp_filter = 0

Page 16: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 16

2–4 aptのアップデート各ノードでパッケージの更新を行い、再起動を行います。

# apt-get update && apt-get dist-upgrade

# reboot

2–5 NTPのインストール時刻合わせを正確にするために各ノードでNTPをインストールします。

# apt-get install -y ntp

2–6 Python用MySQLクライアントのインストール各ノードでPython用のMySQLクライアントをインストールします。

# apt-get install -y python-mysqldb

Page 17: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 17

3. controllerノードのインストール前設定

3–1 MySQLサーバーのインストールMySQLサーバーをインストールします。

3–1–1 パッケージのインストール

インストール中にMySQLのrootパスワードを設定する必要があります。パスワードはpasswordに設定します。

controller# apt-get install -y mysql-server

3–1–2 バインドアドレスの変更

別のノードからMySQLへアクセスできるよう、バインドアドレスを変更します。加えて使用する文字コードをutf8に変更します。

※文字コードをutf8に変更しないとOpenStackモジュールとデータベース間の通信でエラーが発生します。

/etc/mysql/my.cnf

[mysqld]

#bind-address = 127.0.0.1 ← 既存設定をコメントアウトbind-address = 192.168.0.10 ← 追記default-storage-engine = innodb ← 追記collation-server = utf8_general_ci ← 追記init-connect = 'SET NAMES utf8' ← 追記character-set-server = utf8 ← 追記

3–1–3 サービスの再起動

変更後、サービスを再起動します。

controller# service mysql restart

3–2 RabbitMQのインストールRabbitMQをインストールします。

3–2–1 パッケージのインストール

controller# apt-get install -y rabbitmq-server

3–2–2 guestユーザーのパスワード変更

rabbitmqctlのパスワードをguestからpasswordへ変更します。

Page 18: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 18

controller# rabbitmqctl change_password guest password

Changing password for user "guest" ...

...done.

3–3 環境変数設定ファイル作成

3–3–1 admin環境変数設定ファイル作成

admin環境変数設定ファイルを作成します。

admin-openrc

export OS_USERNAME=admin

export OS_PASSWORD=password

export OS_TENANT_NAME=admin

export OS_AUTH_URL=http://controller:35357/v2.0

3–3–2 demo環境変数設定ファイル作成

demo環境変数設定ファイルを作成します。

demo-openrc

export OS_USERNAME=demo

export OS_PASSWORD=password

export OS_TENANT_NAME=demo

export OS_AUTH_URL=http://controller:35357/v2.0

Page 19: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 19

4. Keystoneインストールと設定(controllerノード)Keystoneのインストールと設定を行います。

4–1 パッケージのインストール

controller# apt-get install -y keystone

4–2 データベースの作成・確認

4–2–1 データベースの作成

MySQLのデータベースにKeystoneのデータベースを作成します。

controller# mysql -u root -p << EOF

CREATE DATABASE keystone;

GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \

IDENTIFIED BY 'password';

EOF

Enter password: ← MySQLのrootパスワードpasswordを入力

4–2–2 データベースの確認

MySQLにKeystoneのデータベースが作成されたか確認します。

Page 20: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 20

controller# mysql -u keystone -p

Enter password: ← MySQLのkeystoneパスワードpasswordを入力Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 71

Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| keystone |

+--------------------+

2 rows in set (0.00 sec)

※ユーザーkeystoneでログイン可能でデータベースの閲覧が可能なら問題ありません。

4–3 設定の変更/etc/keystone/keystone.conf

[DEFAULT]

admin_token = password ← 追記log_dir=/var/log/keystone ← 追記

[database]

#connection = sqlite:////var/lib/keystone/keystone.db ← 既存設定をコメントアウトconnection = mysql://keystone:password@controller/keystone ← 追記

4–4 使用しないデータベースファイルの削除

controller# rm /var/lib/keystone/keystone.db

4–5 データベースに表を作成

controller# keystone-manage db_sync

Page 21: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 21

4–6 サービスの再起動

controller# rm /var/log/keystone/*

controller# service keystone restart

4–7 ログの確認

controller# grep "ERROR\|WARNING" /var/log/keystone/*

2014-05-16 14:01:28.074 28051 WARNING keystone.openstack.common.versionutils [-]

Deprecated: keystone.middleware.core.XmlBodyMiddleware is deprecated as of

Icehouse in favor of support for "application/json" only and may be removed in K.

※上記WARNING以外、特に何も表示されなければ問題ありません。

Page 22: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 22

4–8 認証情報の設定以下コマンドで認証情報を設定します。

controller# export OS_SERVICE_TOKEN=password

controller# export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0

controller# keystone user-create --name=admin --pass=password [email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | 9b6f2e4f6e074566937119a05a26e01e |

| name | admin |

| username | admin |

+----------+----------------------------------+

controller# keystone role-create --name=admin

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| id | 9d34e8df7bc04bf3b16abc8a09238499 |

| name | admin |

+----------+----------------------------------+

controller# keystone tenant-create --name=admin --description="Admin Tenant"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | Admin Tenant |

| enabled | True |

| id | 07e06d1d7f35430e8906e6fb5badd893 |

| name | admin |

+-------------+----------------------------------+

controller# keystone user-role-add --user=admin --tenant=admin --role=admin

controller# keystone user-role-add --user=admin --role=_member_ --tenant=admin

controller# keystone user-create --name=demo --pass=password [email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | 7d0a62a5abf7445688b2fd223e1a9a1f |

| name | demo |

| username | demo |

+----------+----------------------------------+

Page 23: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 23

controller# keystone tenant-create --name=demo --description="Demo Tenant"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | Demo Tenant |

| enabled | True |

| id | 6d19304a59b3456bbe2552a9080d1301 |

| name | demo |

+-------------+----------------------------------+

controller# keystone user-role-add --user=demo --role=_member_ --tenant=demo

controller# keystone tenant-create --name=service --description="Service Tenant"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | Service Tenant |

| enabled | True |

| id | 0571e304708f4cdcb4ecedc363547acb |

| name | service |

+-------------+----------------------------------+

controller# keystone service-create --name=keystone --type=identity \

--description="OpenStack Identity"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | OpenStack Identity |

| enabled | True |

| id | c315a41214b84597af88ab11bb5a089d |

| name | keystone |

| type | identity |

+-------------+----------------------------------+

controller# keystone endpoint-create \

--service=keystone \

--publicurl=http://controller:5000/v2.0 \

--internalurl=http://controller:5000/v2.0 \

--adminurl=http://controller:35357/v2.0

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| adminurl | http://controller:35357/v2.0 |

| id | 1f1746a1b9204bf297d4c599767fc6bd |

| internalurl | http://controller:5000/v2.0 |

| publicurl | http://controller:5000/v2.0 |

| region | regionOne |

| service_id | c315a41214b84597af88ab11bb5a089d |

Page 24: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 24

+-------------+----------------------------------+

4–9 Keystone設定確認

4–9–1 Keystoneトークン確認

Keystoneの認証に問題ないか確認するために、トークンを取得してみます。

controller# keystone --os-username=admin --os-password=password \

--os-tenant-name=admin \

--os-auth-url=http://controller:35357/v2.0 token-get

+-----------+---------------------------------------+

| Property | Value |

+-----------+---------------------------------------+

| expires | 2014-05-18T02:51:48Z |

| id | MIIMYAYJKoZIhvcNAQcbWsNz2gqLtB6dfg== |

| tenant_id | b348b47155884978af344b84db561865 |

| user_id | 6ca7845a6d554ef8ab737a777dd0a7cb |

+-----------+---------------------------------------+

controller# keystone --os-username=demo --os-password=password \

--os-tenant-name=demo \

--os-auth-url=http://controller:35357/v2.0 token-get

-+-----------+---------------------------------------+

| Property | Value |

-+-----------+---------------------------------------+

| expires | 2014-05-18T02:53:09Z |

| id | MIIMJQYJKoZIhvcfso3dfgcJ+I7J40KS9fo= |

| tenant_id | 6803ec4cf70f43ed8cfdbd060c1a2293 |

| user_id | 7605b233fede4f958c121e31b508eeac |

-+-----------+---------------------------------------+

※トークンのid情報等が出力されていれば問題ありません。(実際のトークン情報は一行が長いので、コマンド例では省略して記述してます)

4–9–2 Keystoneユーザー確認

Keystoneにユーザーが登録されているかを確認します。

Page 25: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 25

controller# source admin-openrc

controller# keystone user-list

+----------------------------------+-------+---------+-------------------+

| id | name | enabled | email |

+----------------------------------+-------+---------+-------------------+

| 6ca7845a6d554ef8ab737a777dd0a7cb | admin | True | [email protected] |

| 7605b233fede4f958c121e31b508eeac | demo | True | [email protected] |

+----------------------------------+-------+---------+-------------------+

※一覧にadminとdemoユーザーが登録されていれば問題ありません。

Page 26: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 26

5. Glanceのインストールと設定

5–1 パッケージのインストール

controller# apt-get install -y glance python-glanceclient sheepdog

sheepdogのインストールで次回ログイン時にメッセージが複数表示されるのを抑制するために設定ファイルを削除します。

controller# rm -f /etc/bash_completion.d/sheepdog

5–2 データベースの作成・確認

5–2–1 データベース作成

MySQLのデータベースにGlanceのデータベースを作成します。

controller# mysql -u root -p << EOF

CREATE DATABASE glance;

GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \

IDENTIFIED BY 'password';

EOF

Enter password: ← MySQLのrootパスワードpasswordを入力

Page 27: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 27

5–2–2 データベースの確認

MySQLにGlanceのデータベースが作成されたか確認します。

controller# mysql -u glance -p

Enter password: ← MySQLのglanceパスワードpasswordを入力Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 72

Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| glance |

+--------------------+

2 rows in set (0.00 sec)

※ユーザーglanceでログイン可能でデータベースの閲覧が可能なら問題ありません。

Page 28: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 28

5–3 認証情報の設定以下コマンドで認証情報を設定します。

controller# source admin-openrc

controller# keystone user-create --name=glance --pass=password \

[email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | 4731656ea2604725873be52d08ad3a26 |

| name | glance |

| username | glance |

+----------+----------------------------------+

controller# keystone user-role-add --user=glance --tenant=service --role=admin

controller# keystone service-create --name=glance --type=image \

--description="OpenStack Image Service"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | OpenStack Image Service |

| enabled | True |

| id | b9a5d0e108474d928a29b896658897ef |

| name | glance |

| type | image |

+-------------+----------------------------------+

controller# keystone endpoint-create \

--service=glance \

--publicurl=http://controller:9292 \

--internalurl=http://controller:9292 \

--adminurl=http://controller:9292

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| adminurl | http://controller:9292 |

| id | db113425a5b740428b970925bde913f8 |

| internalurl | http://controller:9292 |

| publicurl | http://controller:9292 |

| region | regionOne |

| service_id | b9a5d0e108474d928a29b896658897ef |

+-------------+----------------------------------+

Page 29: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 29

5–4 設定の変更/etc/glance/glance-api.conf

[DEFAULT]

rpc_backend = rabbit

rabbit_host = controller ← 追記rabbit_password = password ← 追記

[database]

#sqlite_db = /var/lib/glance/glance.sqlite ← 既存設定をコメントアウトconnection = mysql://glance:password@controller/glance ← 追記

[keystone_authtoken]

#auth_host = 127.0.0.1 ← 既存設定をコメントアウトauth_uri = http://controller:5000 ← 追記auth_host = controller ← 追記auth_port = 35357

auth_protocol = http

#admin_tenant_name = %SERVICE_TENANT_NAME% ← 既存設定をコメントアウト#admin_user = %SERVICE\_USER% ← 既存設定をコメントアウト#admin_password = %SERVICE_PASSWORD% ← 既存設定をコメントアウトadmin_tenant_name = service ← 追記admin_user = glance ← 追記admin_password = password ← 追記

[paste_deploy]

flavor = keystone ← 追記

Page 30: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 30

/etc/glance/glance-registry.conf

[database]

#sqlite_db = /var/lib/glance/glance.sqlite ← 既存設定をコメントアウトconnection = mysql://glance:password@controller/glance ← 追記

[keystone_authtoken]

#auth_host = 127.0.0.1 ← 既存設定をコメントアウトauth_uri = http://controller:5000 ← 追記auth_host = controller ← 追記auth_port = 35357

auth_protocol = http

#admin_tenant_name = %SERVICE_TENANT_NAME% ← 既存設定をコメントアウト#admin_user = %SERVICE_USER% ← 既存設定をコメントアウト#admin_password = %SERVICE_PASSWORD% ← 既存設定をコメントアウトadmin_tenant_name = service ← 追記admin_user = glance ← 追記admin_password = password ← 追記

[paste_deploy]

flavor = keystone ← 追記

5–5 データベースに表を作成

controller# glance-manage db_sync

5–6 サービス再起動

controller# rm /var/log/glance/*

controller# service glance-registry restart && service glance-api restart

Page 31: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 31

5–7 ログ確認

controller# grep "ERROR\|WARNING" /var/log/glance/*

/var/log/glance/api.log:2014-05-18 12:10:04.528 8459 ERROR glance.store.sheepdog [-] Error in store configurat

ion: Unexpected error while running command.

/var/log/glance/api.log:2014-05-18 12:10:04.531 8459 WARNING glance.store.base [-] Failed to configure store c

orrectly: Store sheepdog could not be configured correctly. Reason: Error in store configuration: Unexpected e

rror while running command.

/var/log/glance/api.log:2014-05-26 12:10:04.532 8459 WARNING glance.store [-] Deprecated: glance.store.sheepdo

g.Store not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 12:10:04.541 8459 WARNING glance.store [-] Deprecated: glance.store.rbd.Sto

re not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 12:10:04.545 8459 WARNING glance.store.base [-] Failed to configure store c

orrectly: Store gridfs could not be configured correctly. Reason: Missing dependencies: pymongo Disabling add

method.

/var/log/glance/api.log:2014-05-18 12:10:04.546 8459 WARNING glance.store [-] Deprecated: glance.store.gridfs.

Store not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 12:10:04.645 8459 WARNING glance.store.base [-] Failed to configure store c

orrectly: Store cinder could not be configured correctly. Reason: Cinder storage requires a context. Disabling

add method.

/var/log/glance/api.log:2014-05-18 12:10:04.646 8459 WARNING glance.store [-] Deprecated: glance.store.cinder.

Store not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 12:10:04.669 8459 WARNING glance.store [-] Deprecated: glance.store.swift.S

tore not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 12:10:04.719 8459 WARNING glance.store [-] Deprecated: glance.store.vmware_

datastore.Store not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 12:10:04.721 8459 WARNING glance.store [-] Deprecated: glance.store.s3.Stor

e not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

※上記ERRORとWARNING以外が出力されていなければ問題ありません。

5–8 イメージの取得と登録

5–8–1 イメージ取得

CirrOSがインストールされたイメージをダウンロード取得します。

controller# wget http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img

5–8–2 イメージ登録

ダウンロードしたCirrOSのイメージをGlanceに登録します。

Page 32: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 32

controller# glance image-create --name="CirrOS 0.3.2" --disk-format=qcow2 --container-format=bare

--is-public=true <cirros-0.3.2-x86_64-disk.img

+------------------+--------------------------------------+

| Property | Value |

+------------------+--------------------------------------+

| checksum | 64d7c1cd2b6f60c92c14662941cb7913 |

| container_format | bare |

| created_at | 2014-04-28T01:23:57 |

| deleted | False |

| deleted_at | None |

| disk_format | qcow2 |

| id | 1cdc90ca-fc4b-4064-8514-21aac275729f |

| is_public | True |

| min_disk | 0 |

| min_ram | 0 |

| name | CirrOS 3.2 |

| owner | 261110e97ca143c091d8c82c50f5291c |

| protected | False |

| size | 13167616 |

| status | active |

| updated_at | 2014-04-28T01:23:58 |

| virtual_size | None |

+------------------+--------------------------------------+

5–8–3 イメージ登録確認

controller# glance image-list

+--------------------------------------+--------------+-------------+------------------+----------+

| ID | Name | Disk Format | Container Format | Size |

+--------------------------------------+--------------+-------------+------------------+----------+

| 1cdc90ca-fc4b-4064-8514-21aac275729f | CirrOS 0.3.2 | qcow2 | bare | 13167616 |

+--------------------------------------+--------------+-------------+------------------+----------+

※登録したCirrOSのイメージが一覧に表示されれば問題ありません。

Page 33: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 33

6. Novaのインストール・設定(controllerノード)

6–1 パッケージインストール

controller# apt-get install -y nova-api nova-cert nova-conductor nova-consoleauth nova-novncproxy

nova-scheduler python-novaclient

6–2 データベースの作成・確認

6–2–1 データベースの作成

MySQLのデータベースにNovaのデータベースを作成します。

controller# mysql -u root -p << EOF

CREATE DATABASE nova;

GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \

IDENTIFIED BY 'password';

EOF

Enter password: ← MySQLのrootパスワードpasswordを入力

6–2–2 データベースの作成確認

MySQLにNovaのデータベースが作成されたか確認します。

Page 34: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 34

controller# mysql -u nova -p

Enter password: ← MySQLのnovaパスワードpasswordを入力Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 74

Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| nova |

+--------------------+

2 rows in set (0.00 sec)

※ユーザーnovaでログイン可能でデータベースの閲覧が可能なら問題ありません。

6–3 認証情報の設定以下コマンドで認証情報を設定します。

Page 35: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 35

controller# source admin-openrc

controller# keystone user-create --name=nova --pass=password [email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | 60d2a224d82449c2b087a0f0b4b9e0a3 |

| name | nova |

| username | nova |

+----------+----------------------------------+

controller# keystone user-role-add --user=nova --tenant=service --role=admin

controller# keystone service-create --name=nova --type=compute \

--description="OpenStack Compute"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | OpenStack Compute |

| enabled | True |

| id | 247c48a462b94870920631626d7f9d23 |

| name | nova |

| type | compute |

+-------------+----------------------------------+

controller# keystone endpoint-create \

--service=nova \

--publicurl=http://controller:8774/v2/%\(tenant_id\)s \

--internalurl=http://controller:8774/v2/%\(tenant_id\)s \

--adminurl=http://controller:8774/v2/%\(tenant_id\)s

+-------------+-----------------------------------------+

| Property | Value |

+-------------+-----------------------------------------+

| adminurl | http://controller:8774/v2/%(tenant_id)s |

| id | 6a25dd781e5043f7af621eae43a4448d |

| internalurl | http://controller:8774/v2/%(tenant_id)s |

| publicurl | http://controller:8774/v2/%(tenant_id)s |

| region | regionOne |

| service_id | 247c48a462b94870920631626d7f9d23 |

+-------------+-----------------------------------------+

6–4 設定変更/etc/nova/nova.conf

Page 36: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 36

[DEFAULT]

※既にある記述はそのままにして、以下の記述を追加します。rpc_backend = rabbit

rabbit_host = controller

rabbit_password = password

auth_strategy = keystone

my_ip = controller

vncserver_listen = controller

vncserver_proxyclient_address = controller

# Networking

network_api_class = nova.network.neutronv2.api.API

neutron_url = http://controller:9696

neutron_auth_strategy = keystone

neutron_admin_tenant_name = service

neutron_admin_username = neutron

neutron_admin_password = password

neutron_admin_auth_url = http://controller:35357/v2.0

linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver

# Security Groups

firewall_driver = nova.virt.firewall.NoopFirewallDriver

security_group_api = neutron

# Metadata

neutron_metadata_proxy_shared_secret = password

service_neutron_metadata_proxy = true

metadata_listen = controller

metadata_listen_port = 8775

[keystone_authtoken]

auth_uri = http://controller:5000

auth_host = controller

auth_port = 35357

auth_protocol = http

admin_tenant_name = service

admin_user = nova

admin_password = password

[database]

connection = mysql://nova:password@controller/nova

Page 37: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 37

6–5 使用しないデータベースファイル削除

controller# rm /var/lib/nova/nova.sqlite

6–6 データベースに表を作成

controller# nova-manage db sync

6–7 サービス再起動

controller# rm /var/log/nova/*

controller# service nova-api restart && service nova-cert restart && service nova-consoleauth restart && \

service nova-scheduler restart && service nova-conductor restart && \

service nova-novncproxy restart

6–8 ログ確認

controller# grep "ERROR\|WARNING" /var/log/nova/*

※特に何も表示されなければ問題ありません。

6–9 Glanceとの通信確認NovaのコマンドラインインターフェースでGlanceと通信してGlanceと相互に通信できているかを確認します。

controller# nova image-list

+--------------------------------------+--------------+--------+--------+

| ID | Name | Status | Server |

+--------------------------------------+--------------+--------+--------+

| 1cdc90ca-fc4b-4064-8514-21aac275729f | CirrOS 0.3.2 | ACTIVE | |

+--------------------------------------+--------------+--------+--------+

※glanceで登録したCirrOSイメージが表示できていれば問題ありません。

Page 38: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 38

7. Novaのインストール・設定(compute1ノード)

7–1 パッケージインストール

compute1# apt-get install -y nova-compute-kvm python-guestfs

7–2 カーネル設定変更デフォルトのカーネルパーミッションでは、仮想化機能を使用する場合にユーザーがカーネルを読み込めないためカーネルのパーミッションを変更します。

7–2–1 設定変更

compute1# dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-$(uname -r)

7–2–2 設定変更ファイル作成・設定

上記のみではcomputeノード再起動時にカーネルのパーミッション変更が必要となるので、カーネル設定変更ファイル作成を作成してノード起動時に変更を読み込むようにします。

/etc/kernel/postinst.d/statoverride

#!/bin/sh

version="$1"

# passing the kernel version is required

[ -z "${version}" ] && exit 0

dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-${version}

実行権限を付与します。

compute1# chmod +x /etc/kernel/postinst.d/statoverride

7–3 設定の変更/etc/nova/nova.conf

Page 39: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 39

[DEFAULT]

※既にある記述はそのままにして、以下の記述を追加します。rpc_backend = rabbit

rabbit_host = controller

rabbit_password = password

auth_strategy = keystone

my_ip = compute1

vnc_enabled = True

vncserver_listen = 0.0.0.0

vncserver_proxyclient_address = compute1

novncproxy_base_url = http://controller:6080/vnc_auto.html

glance_host = controller

# Networking

network_api_class = nova.network.neutronv2.api.API

neutron_url = http://controller:9696

neutron_auth_strategy = keystone

neutron_admin_tenant_name = service

neutron_admin_username = neutron

neutron_admin_password = password

neutron_admin_auth_url = http://controller:35357/v2.0

linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver

# Security Groups

firewall_driver = nova.virt.firewall.NoopFirewallDriver

security_group_api = neutron

[keystone_authtoken]

auth_uri = http://controller:5000

auth_host = controller

auth_port = 35357

auth_protocol = http

admin_tenant_name = service

admin_user = nova

admin_password = password

[database]

connection = mysql://nova:password@controller/nova

※日本語キーボードを使用する場合は[DEFAULT]に以下を追加します。

Page 40: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 40

vnc_keymap = ja

7–4 使用しないデータベースファイル削除

compute1# rm /var/lib/nova/nova.sqlite

7–5 サービス再起動

compute1# rm /var/log/nova/*

compute1# service nova-compute restart

7–6 ログ確認

compute1# grep "ERROR\|WARNING" /var/log/nova/*

※何も表示されなければ問題ありません。

7–7 controllerノードとの疎通確認疎通確認はcontrollerノード上にて、admin環境変数設定ファイルを読み込んで行います。

controller# source admin-openrc

7–7–1 ホストリストの確認

controllerノードとcomputeノードが相互に接続できているか確認します。

controller# nova host-list

+------------+-------------+----------+

| host_name | service | zone |

+------------+-------------+----------+

| controller | cert | internal |

| controller | consoleauth | internal |

| controller | scheduler | internal |

| controller | conductor | internal |

| compute1 | compute | nova |

+------------+-------------+----------+

※host_name一覧にcompute1が表示されていれば問題ありません。

7–7–2 ハイパーバイザの確認

controllerノードよりcomputeノードのハイパーバイザが取得可能か確認します。

Page 41: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 41

controller# nova hypervisor-list

+----+---------------------+

| ID | Hypervisor hostname |

+----+---------------------+

| 1 | compute1 |

+----+---------------------+

※Hypervisor hostname一覧にcompute1が表示されていれば問題ありません。

Page 42: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 42

8. Neutronのインストール・設定(controllerノード)

8–1 パッケージインストール

controller# apt-get install -y neutron-server neutron-plugin-ml2

8–2 データベース作成・確認

8–2–1 データベース作成

MySQLのデータベースにNeutronのデータベースを作成します。

controller# mysql -u root -p << EOF

CREATE DATABASE neutron;

GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \

IDENTIFIED BY 'password';

EOF

Enter password: ← MySQLのrootパスワードpasswordを入力

8–2–2 データベースの確認

MySQLにNeutronのデータベースが登録されたか確認します。

Page 43: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 43

controller# mysql -u neutron -p

Enter password: ← MySQLのneutronパスワードpasswordを入力Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 75

Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| neutron |

+--------------------+

2 rows in set (0.00 sec)

※ユーザーneutronでログイン可能でデータベースが閲覧可能なら問題ありません。

8–3 認証情報の設定以下コマンドで認証情報を設定します。

Page 44: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 44

controller# source admin-openrc

controller# keystone user-create --name neutron --pass password --email [email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | 23f88938cbd94deb95b4c2c3caec2c60 |

| name | neutron |

| username | neutron |

+----------+----------------------------------+

controller# keystone user-role-add --user neutron --tenant service --role admin

controller# keystone service-create --name neutron --type network --description "OpenStack Networking"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | OpenStack Networking |

| enabled | True |

| id | 6c36ba679b16402aaed73c0e032f0d02 |

| name | neutron |

| type | network |

+-------------+----------------------------------+

controller# keystone endpoint-create \

--service=neutron \

--publicurl http://controller:9696 \

--adminurl http://controller:9696 \

--internalurl http://controller:9696

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| adminurl | http://controller:9696 |

| id | f9c6285e5242428ba5fb80a2b88535fb |

| internalurl | http://controller:9696 |

| publicurl | http://controller:9696 |

| region | regionOne |

| service_id | 6c36ba679b16402aaed73c0e032f0d02 |

+-------------+----------------------------------+

Page 45: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 45

8–4 設定の変更設定変更時にSERVICE_TENANT_IDを求められるファイルがあるので予めSERVICE_TENANT_IDを取得します。

controller# source admin-openrc

controller# keystone tenant-get serivce

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | Service Tenant |

| enabled | True |

| id | f727b5ec2ceb4d71bad86dfc414449bf |

| name | service |

+-------------+----------------------------------+

/etc/neutron/neutron.conf

Page 46: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 46

[DEFAULT]

#core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin ← 既存設定をコメントアウトcore_plugin = ml2 ← 追記service_plugins = router ← 追記auth_strategy = keystone ← 追記allow_overlapping_ips = True ← 追記

rpc_backend = neutron.openstack.common.rpc.impl_kombu ← 追記rabbit_host = controller ← 追記rabbit_password = password ← 追記notify_nova_on_port_status_changes = True ← 追記notify_nova_on_port_data_changes = True ← 追記nova_url = http://controller:8774/v2 ← 追記nova_admin_username = nova ← 追記nova_admin_tenant_id = SERVICE_TENANT_ID ← 追記

※SERVICE_TENANT_IDは先程の作業で表示されたIDを使用します。

nova_admin_password = password ← 追記nova_admin_auth_url = http://controller:35357/v2.0 ← 追記

[keystone_authtoken]

#auth_host = 127.0.0.1 ← 既存設定をコメントアウトauth_uri = http://controller:5000 ← 追記auth_host = controller ← 追記auth_protocol = http

auth_port = 35357

#admin_tenant_name = %SERVICE_TENANT_NAME% ← 既存設定をコメントアウト#admin_user = %SERVICE_USER% ← 既存設定をコメントアウト#admin_password = %SERVICE_PASSWORD% ← 既存設定をコメントアウトadmin_tenant_name = service ← 追記admin_user = neutron ← 追記admin_password = password ← 追記

Page 47: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 47

[database]

#connection = sqlite:////var/lib/neutron/neutron.sqlite ← 既存設定をコメントアウトconnection = mysql://neutron:password@controller/neutron ← 追記

/etc/neutron/plugins/ml2/ml2_conf.ini

[ml2]

type_drivers = gre ← 追記tenant_network_types = gre ← 追記mechanism_drivers = openvswitch ← 追記

[ml2_type_gre]

tunnel_id_ranges = 1:1000 ← 追記

[securitygroup]

firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver ← 追記enable_security_group = True ← 追記

8–5 使用しないデータベースファイル削除

controller# rm /var/lib/neutron/neutron.sqlite

8–6 サービス再起動

controller# rm /var/log/neutron/*

controller# service nova-api restart && \

service nova-scheduler restart && \

service nova-conductor restart && \

service neutron-server restart

Page 48: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 48

8–7 ログ確認

controller# grep "ERROR\|WARNING" /var/log/neutron/*

2014-05-16 18:41:24.106 2331 ERROR neutron.openstack.common.rpc.common [-] AMQP server on localhost:5672 is un

reachable: Socket closed. Trying again in 30 seconds.

2014-05-16 18:41:34.119 2708 WARNING neutron.openstack.common.db.sqlalchemy.session [-] This application has n

ot enabled MySQL traditional mode, which means silent data corruption may occur. Please encourage the applicat

ion developers to enable this mode.

2014-05-16 18:41:36.423 2708 WARNING neutron.api.extensions [-] Extension fwaas not supported by any of loaded

plugins

2014-05-16 18:41:36.429 2708 WARNING neutron.api.extensions [-] Extension flavor not supported by any of loade

d plugins

2014-05-16 18:41:36.484 2708 WARNING neutron.api.extensions [-] Extension lbaas_agent_scheduler not supported

by any of loaded plugins

2014-05-16 18:41:36.502 2708 WARNING neutron.api.extensions [-] Extension lbaas not supported by any of loaded

plugins

2014-05-16 18:41:36.528 2708 WARNING neutron.api.extensions [-] Extension metering not supported by any of loa

ded plugins

2014-05-16 18:41:36.558 2708 WARNING neutron.api.extensions [-] Extension port-security not supported by any of

loaded plugins

2014-05-16 18:41:36.593 2708 WARNING neutron.api.extensions [-] Extension routed-service-insertion not support

ed by any of loaded plugins

2014-05-16 18:41:36.601 2708 WARNING neutron.api.extensions [-] Extension router-service-type not supported by

any of loaded plugins

2014-05-16 18:41:36.630 2708 WARNING neutron.api.extensions [-] Extension service-type not supported by any of

loaded plugins

2014-05-16 18:41:36.653 2708 WARNING neutron.api.extensions [-] Extension vpnaas not supported by any of loade

d plugins

※上記ERRORとWARNING以外が出力されなければ問題ありません。

Page 49: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 49

9. Neutronのインストール・設定(networkノード)

9–1 パッケージインストール

network# apt-get install -y neutron-plugin-ml2 neutron-plugin-openvswitch-agent \

openvswitch-datapath-dkms neutron-l3-agent neutron-dhcp-agent

9–2 設定の変更/etc/neutron/neutron.conf

[DEFAULT]

#core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin ← 既存設定をコメントアウトcore_plugin = ml2 ← 追記

service_plugins = router ← 追記auth_strategy = keystone ← 追記allow_overlapping_ips = True ← 追記rpc_backend = neutron.openstack.common.rpc.impl_kombu ← 追記rabbit_host = controller ← 追記rabbit_password = password ← 追記

[keystone_authtoken]

#auth_host = 127.0.0.1 ← 既存設定をコメントアウトauth_uri = http://controller:5000 ← 追記auth_host = controller ← 追記auth_protocol = http

auth_port = 35357

#admin_tenant_name = %SERVICE_TENANT_NAME% ← 既存設定をコメントアウト#admin_user = %SERVICE_USER% ← 既存設定をコメントアウト#admin_password = %SERVICE_PASSWORD% ← 既存設定をコメントアウトadmin_tenant_name = service ← 追記admin_user = neutron ← 追記admin_password = password ← 追記

[database]

#connection = sqlite:////var/lib/neutron/neutron.sqlite ← 既存設定をコメントアウトconnection = mysql://neutron:password@controller/neutron ← 追記

/etc/neutron/l3_agent.ini

Page 50: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 50

[DEFAULT]

interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver ← 追記use_namespaces = True ← 追記

/etc/neutron/dhcp_agent.ini

[DEFAULT]

interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver ← 追記dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq ← 追記use_namespaces = True ← 追記

/etc/neutron/metadata_agent.ini

[DEFAULT]

#auth_url = http://localhost:5000/v2.0 ← 既存設定をコメントアウトauth_url = http://controller:5000/v2.0 ← 追記auth_region = RegionOne

#admin_tenant_name = %SERVICE_TENANT_NAME% ← 既存設定をコメントアウト#admin_user = %SERVICE_USER% ← 既存設定をコメントアウト#admin_password = %SERVICE_PASSWORD% ← 既存設定をコメントアウトadmin_tenant_name = service ← 追記admin_user = neutron ← 追記admin_password = password ← 追記

# nova_metadata_ip = 127.0.0.1 ← 既存設定をコメントアウトnova_metadata_ip = controller ← 追記# metadata_proxy_shared_secret =

metadata_proxy_shared_secret = password ← 追記

/etc/neutron/plugins/ml2/ml2_conf.ini

Page 51: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 51

[ml2]

type_drivers = gre ← 追記tenant_network_types = gre ← 追記mechanism_drivers = openvswitch ← 追記

[ml2_type_gre]

tunnel_id_ranges = 1:1000 ← 追記

[ovs] ← 追記local_ip = 10.0.0.9 ← 追記tunnel_type = gre ← 追記enable_tunneling = True ← 追記

[securitygroup]

firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver ← 追記# enable_security_group = True

enable_security_group = True ← 追記

9–3 Open vSwitchサービス再起動

network# service openvswitch-switch restart

9–4 ブリッジデバイス設定内部通信用と外部通信用のブリッジを作成して外部通信用ブリッジに共有ネットワークデバイスを接続します。

network# ovs-vsctl add-br br-int

network# ovs-vsctl add-br br-ex

network# ovs-vsctl add-port br-ex eth1

9–5 ブリッジデバイス設定確認ブリッジの作成・設定を確認します。

9–5–1 ブリッジの確認

network# ovs-vsctl list-br

br-ex

br-int

br-tun

※add-brしたブリッジが表示されていれば問題ありません。

9–5–2 外部接続用ブリッジと共有ネットワークデバイスの接続確認

Page 52: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 52

# ovs-vsctl list-ports br-ex

eth1

qg-26005736-4d

※add-port で設定したネットワークデバイスが表示されていれば問題ありません。

Page 53: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 53

9–6 ネットワークインタフェースの設定変更/etc/network/interfaces

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

#auto eth0

#iface eth0 inet dhcp

auto eth0

iface eth0 inet static

address 192.168.0.9

netmask 255.255.255.0

auto eth1

iface eth1 inet manual ← 既存設定を変更 up ip address add 0/0 dev $IFACE ← 既存設定を変更 up ip link set $IFACE up ← 既存設定を変更 down ip link set $IFACE down ← 既存設定を変更

auto br-ex ← 追記iface br-ex inet static ← 追記 address 10.0.0.9 ← 追記 netmask 255.255.255.0 ← 追記 gateway 10.0.0.1 ← 追記 dns-nameservers 10.0.0.1 ← 追記

9–7 networkノード再起動インタフェース設定変更を適用するために、システムを再起動します。

network# reboot

9–8 ブリッジ設定確認各種ブリッジが正常に設定されていることを確認します。

network# ifconfig

Page 54: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 54

br-ex Link encap:Ethernet HWaddr 00:1c:42:29:b3:bd

inet addr:10.0.0.9 Bcast:10.0.0.255 Mask:255.255.255.0

inet6 addr: fe80::a840:fbff:fe7d:dd6e/64 Scope:Link

UP BROADCAST RUNNING MTU:1500 Metric:1

RX packets:2148 errors:0 dropped:0 overruns:0 frame:0

TX packets:2956 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:257185 (257.1 KB) TX bytes:654268 (654.2 KB)

br-int Link encap:Ethernet HWaddr ea:04:ce:9b:58:4b

inet6 addr: fe80::b84c:fbff:fe1a:d627/64 Scope:Link

UP BROADCAST RUNNING MTU:1500 Metric:1

RX packets:56 errors:0 dropped:0 overruns:0 frame:0

TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:4978 (4.9 KB) TX bytes:648 (648.0 B)

br-tun Link encap:Ethernet HWaddr 2e:8d:24:75:de:47

inet6 addr: fe80::f0fb:45ff:fee5:1133/64 Scope:Link

UP BROADCAST RUNNING MTU:1500 Metric:1

RX packets:1 errors:0 dropped:0 overruns:0 frame:0

TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:90 (90.0 B) TX bytes:648 (648.0 B)

eth0 Link encap:Ethernet HWaddr 00:1c:42:5c:58:ba

inet addr:192.168.0.9 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::21c:42ff:fe5c:58ba/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:283 errors:0 dropped:0 overruns:0 frame:0

TX packets:239 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:41011 (41.0 KB) TX bytes:37254 (37.2 KB)

eth1 Link encap:Ethernet HWaddr 00:1c:42:29:b3:bd

inet6 addr: fe80::21c:42ff:fe29:b3bd/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:25542 errors:0 dropped:0 overruns:0 frame:0

TX packets:3083 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:5297181 (5.2 MB) TX bytes:668414 (668.4 KB)

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

Page 55: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 55

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:65536 Metric:1

RX packets:6 errors:0 dropped:0 overruns:0 frame:0

TX packets:6 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:3456 (3.4 KB) TX bytes:3456 (3.4 KB)

9–9 サービス再起動

network# rm /var/log/neutron/*

network# service openvswitch-switch restart && \

service neutron-plugin-openvswitch-agent restart && \

service neutron-l3-agent restart && \

service neutron-dhcp-agent restart && \

service neutron-metadata-agent restart

9–10 ログ確認

network# grep "ERROR\|WARNING" /var/log/neutron/*

/var/log/neutron/openvswitch-agent.log:2014-05-16 19:33:14.963 1523 ERROR neutron.agent.linux.ovsdb_monitor [-

] Error received from ovsdb monitor: ovsdb-client: unix:/var/run/openvswitch/db.sock: receive failed (End of f

ile)

/var/log/neutron/openvswitch-agent.log:2014-05-16 19:33:15.455 1523 ERROR neutron.agent.linux.ovs_lib [-] Unab

le to execute ['ovs-vsctl', '--timeout=10', 'list-ports', 'br-int']. Exception:

/var/log/neutron/openvswitch-agent.log:2014-05-16 19:33:15.456 1523 ERROR neutron.plugins.openvswitch.agent.ov

s_neutron_agent [-] Error while processing VIF ports

※上記ERRORとWARNING以外が出力されなければ問題ありません。

Page 56: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 56

10. Neutornのインストール・設定(compute1ノード)

10–1 パッケージインストール

compute1# apt-get install -y neutron-common neutron-plugin-ml2 \

neutron-plugin-openvswitch-agent openvswitch-datapath-dkms

10–2 設定の変更/etc/neutron/neutron.conf

[DEFAULT]

#core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin ← 既存設定をコメントアウトcore_plugin = ml2 ← 追記service_plugins = router ← 追記auth_strategy = keystone ← 追記allow_overlapping_ips = True ← 追記

# rpc_backend = neutron.openstack.common.rpc.impl_kombu

rpc_backend = neutron.openstack.common.rpc.impl_kombu ← 追記rabbit_host = controller ← 追記rabbit_password = password ← 追記

[keystone_authtoken]

#auth_host = 127.0.0.1 ← 既存設定をコメントアウトauth_uri = http://controller:5000 ← 追記auth_host = controller ← 追記auth_protocol = http

auth_port = 35357

#admin_tenant_name = %SERVICE_TENANT_NAME% ← 既存設定をコメントアウト#admin_user = %SERVICE_USER% ← 既存設定をコメントアウト#admin_password = %SERVICE_PASSWORD% ← 既存設定をコメントアウトadmin_tenant_name = service ← 追記admin_user = neutron ← 追記admin_password = password ← 追記

[database]

#connection = sqlite:////var/lib/neutron/neutron.sqlite ← 既存設定をコメントアウトconnection = mysql://neutron:password@controller/neutron ← 追記

/etc/neutron/plugins/ml2/ml2_conf.ini

Page 57: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 57

[ml2]

type_drivers = gre ← 追記tenant_network_types = gre ← 追記mechanism_drivers = openvswitch ← 追記

[ml2_type_gre]

tunnel_id_ranges = 1:1000 ← 追記

[ovs] ← 追記local_ip = 10.0.0.11 ← 追記tunnel_type = gre ← 追記enable_tunneling = True ← 追記

[securitygroup]

firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver ← 追記enable_security_group = True ← 追記

10–3 Open vSwitchサービス再起動

compute1# service openvswitch-switch restart

10–4 ブリッジ作成内部通信用のブリッジを作成します。

compute1# ovs-vsctl add-br br-int

10–5 サービス再起動

compute1# rm /var/log/neutron/*

compute1# service nova-compute restart &&\

service neutron-plugin-openvswitch-agent restart

10–6 ログ確認

compute1# grep "ERROR\|WARNING" /var/log/neutron/*

※何も表示されなければ問題ありません。

Page 58: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 58

11. 仮想ネットワーク設定(controllerノード)

11–1 外部接続ネットワークの設定

11–1–1 admin環境変数読み込み

外部接続用ネットワーク作成するためにadmin環境変数を読み込みます。

controller# source admin-openrc

11–1–2 外部ネットワーク作成

ext-netという名前で外部用ネットワークを作成します。

controller# neutron net-create ext-net --shared --router:external=True

Created a new network:

+---------------------------+--------------------------------------+

| Field | Value |

+---------------------------+--------------------------------------+

| admin_state_up | True |

| id | 8cbfd14f-72bb-4e6d-a9a6-f1312d641cd4 |

| name | ext-net |

| provider:network_type | gre |

| provider:physical_network | |

| provider:segmentation_id | 1 |

| router:external | True |

| shared | True |

| status | ACTIVE |

| subnets | |

| tenant_id | 07e06d1d7f35430e8906e6fb5badd893 |

+---------------------------+--------------------------------------+

Page 59: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 59

11–1–3 外部ネットワーク用サブネット作成

ext-subnetという名前で外部ネットワーク用サブネットを作成します。

controller# neutron subnet-create ext-net --name ext-subnet \

--allocation-pool start=10.0.0.200,end=10.0.0.250 \

--disable-dhcp --gateway 10.0.0.1 10.0.0.0/24

Created a new subnet:

+------------------+----------------------------------------------+

| Field | Value |

+------------------+----------------------------------------------+

| allocation_pools | {"start": "10.0.0.200", "end": "10.0.0.250"} |

| cidr | 10.0.0.0/24 |

| dns_nameservers | |

| enable_dhcp | False |

| gateway_ip | 10.0.0.1 |

| host_routes | |

| id | 7c457880-29f9-4a85-8714-1a5762b3c932 |

| ip_version | 4 |

| name | ext-subnet |

| network_id | 8cbfd14f-72bb-4e6d-a9a6-f1312d641cd4 |

| tenant_id | 07e06d1d7f35430e8906e6fb5badd893 |

+------------------+----------------------------------------------+

11–2 インスタンス用ネットワーク設定

11–2–1 demo環境変数読み込み

インスタンス用ネットワーク作成するためにdemo環境変数読み込みます。

controller# source demo-openrc

11–2–2 インスタンス用ネットワーク作成

demo-netという名前でインスタンス用ネットワークを作成します。

Page 60: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 60

controller# neutron net-create demo-net

Created a new network:

+----------------+--------------------------------------+

| Field | Value |

+----------------+--------------------------------------+

| admin_state_up | True |

| id | 71059c78-fd2c-4e52-a4b9-98776be0ba28 |

| name | demo-net |

| shared | False |

| status | ACTIVE |

| subnets | |

| tenant_id | 6d19304a59b3456bbe2552a9080d1301 |

+----------------+--------------------------------------+

11–2–3 インスタンス用ネットワークサブネット作成

demo-subnetという名前でインスタンス用ネットワークサブネットを作成します。

controller# neutron subnet-create demo-net --name demo-subnet \

--gateway 192.168.0.1 192.168.0.0/24

Created a new subnet:

+------------------+--------------------------------------------------+

| Field | Value |

+------------------+--------------------------------------------------+

| allocation_pools | {"start": "192.168.0.2", "end": "192.168.0.254"} |

| cidr | 192.168.0.0/24 |

| dns_nameservers | |

| enable_dhcp | True |

| gateway_ip | 192.168.0.1 |

| host_routes | |

| id | 6cf9c7f6-2105-4c2a-9fac-0b1df83f774d |

| ip_version | 4 |

| name | demo-subnet |

| network_id | 71059c78-fd2c-4e52-a4b9-98776be0ba28 |

| tenant_id | 6d19304a59b3456bbe2552a9080d1301 |

+------------------+--------------------------------------------------+

11–3 仮想ネットワークルーター設定仮想ネットワークルーターを作成して外部接続用ネットワークとインスタンス用ネットワークをルーターに接続し、双方でデータのやり取りを行えるようにします。

11–3–1 demo-router作成

仮想ネットワークルータを作成します。

Page 61: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 61

controller# neutron router-create demo-router

Created a new router:

+-----------------------+--------------------------------------+

| Field | Value |

+-----------------------+--------------------------------------+

| admin_state_up | True |

| external_gateway_info | |

| id | d1a10de8-37e2-4966-a84d-caff3e6b0e1f |

| name | demo-router |

| status | ACTIVE |

| tenant_id | 6d19304a59b3456bbe2552a9080d1301 |

+-----------------------+--------------------------------------+

11–3–2 demo-routerにsubnet追加

仮想ネットワークルーターにインスタンス用ネットワークを接続します。

controller# neutron router-interface-add demo-router demo-subnet

Added interface fc83f7f5-6da5-4607-b9f8-34d0004dfc3e to router demo-router.

11–3–3 demo-routerにgateway追加

仮想ネットワークルーターに外部ネットワークを接続します。

controller# neutron router-gateway-set demo-router ext-net

Set gateway for router demo-router

Page 62: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 62

12. 仮想ネットワーク設定確認(networkノード)

12–1 仮想ネットワークルーターの確認以下コマンドで仮想ネットワークルーターが作成されているか確認します。

network# ip netns

qdhcp-ed07c38c-8609-43d8-ae02-582f9f202a3e

qrouter-7c1ca8eb-eaa0-4a68-843d-daca30824693

※qrouter~~ という名前の行が表示されていれば問題ありません。

12–2 仮想ルーターのネームスペースのIPアドレスを確認仮想ルーターと外部用ネットワークの接続を確認します。

network# ip netns exec qrouter-7c1ca8eb-eaa0-4a68-843d-daca30824693 ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

13: qr-65249869-77: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default

link/ether fa:16:3e:d0:df:2c brd ff:ff:ff:ff:ff:ff

inet 192.168.0.1/24 brd 192.168.0.255 scope global qr-65249869-77

valid_lft forever preferred_lft forever

inet6 fe80::f816:3eff:fed0:df2c/64 scope link

valid_lft forever preferred_lft forever

14: qg-bd7c5797-3f: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default

link/ether fa:16:3e:35:80:8f brd ff:ff:ff:ff:ff:ff

inet 10.0.0.200/24 brd 10.0.0.255 scope global qg-bd7c5797-3f

valid_lft forever preferred_lft forever

inet6 fe80::f816:3eff:fe35:808f/64 scope link

valid_lft forever preferred_lft forever

※外部アドレス(この環境では10.0.0.0/24)のアドレスを確認します。

12–3 仮想ゲートウェイの疎通確認仮想ルーターと通信が行えるかを確認します。

Page 63: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 63

network# ping 10.0.0.200

PING 10.0.0.200 (10.0.0.200) 56(84) bytes of data.

64 bytes from 10.0.0.200: icmp_seq=1 ttl=64 time=1.17 ms

64 bytes from 10.0.0.200: icmp_seq=2 ttl=64 time=0.074 ms

64 bytes from 10.0.0.200: icmp_seq=3 ttl=64 time=0.061 ms

64 bytes from 10.0.0.200: icmp_seq=4 ttl=64 time=0.076 ms

※応答が返ってくるなら問題ありません、networkノード以外のノードからも通信を確認してみてもよいです。

Page 64: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 64

13. Cinderインストール(controllerノード)

13–1 パッケージインストール

controller# apt-get install -y cinder-common cinder-api cinder-scheduler cinder-volume

13–2 データベース作成・確認

13–2–1 データベース作成

MySQLのデータベースにCinderのデータベースを作成します。

controller# mysql -u root -p <<EOF

CREATE DATABASE cinder;

GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \

IDENTIFIED BY 'password';

EOF

Enter password: ← MySQLのrootパスワードpasswordを入力

13–2–2 データベースの確認

MySQLにCinderのデータベースが登録されたか確認します。

Page 65: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 65

controller# mysql -u cinder -p

Enter password: ← MySQLのcinderパスワードpasswordを入力Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 50

Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| cinder |

+--------------------+

2 rows in set (0.00 sec)

※ユーザーcinderでログイン可能でデータベースの閲覧が可能なら問題ありません。

13–3 認証情報の設定以下コマンドで認証情報を設定します。

controller# source admin-openrc

controller# keystone user-create --name=cinder --pass=password [email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | 2e391db9f2004b5ab0712c67ae6c9bcd |

| name | cinder |

| username | cinder |

+----------+----------------------------------+

controller# keystone user-role-add --user=cinder --tenant=service --role=admin

controller# keystone service-create --name=cinder --type=volume --description="OpenStack Block Storage"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

Page 66: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 66

| description | OpenStack Block Storage |

| enabled | True |

| id | 3830cd8b2c614414903b0bc31ed9e1ca |

| name | cinder |

| type | volume |

+-------------+----------------------------------+

controller# keystone service-create --name=cinderv2 --type=volumev2 --description="OpenStack Block Storage v2"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | OpenStack Block Storage v2 |

| enabled | True |

| id | cb2b03621220473c9bcbe194dfd55695 |

| name | cinderv2 |

| type | volumev2 |

+-------------+----------------------------------+

controller# keystone endpoint-create \

--service=cinder \

--publicurl=http://controller:8776/v1/%\(tenant_id\)s \

--internalurl=http://controller:8776/v1/%\(tenant_id\)s \

--adminurl=http://controller:8776/v1/%\(tenant_id\)s

+-------------+-----------------------------------------+

| Property | Value |

+-------------+-----------------------------------------+

| adminurl | http://controller:8776/v1/%(tenant_id)s |

| id | 44b37c343f6c4c52843ce3ca6c7fbad3 |

| internalurl | http://controller:8776/v1/%(tenant_id)s |

| publicurl | http://controller:8776/v1/%(tenant_id)s |

| region | regionOne |

| service_id | 3830cd8b2c614414903b0bc31ed9e1ca |

+-------------+-----------------------------------------+

controller# keystone endpoint-create \

--service=cinderv2 \

--publicurl=http://controller:8776/v2/%\(tenant_id\)s \

--internalurl=http://controller:8776/v2/%\(tenant_id\)s \

--adminurl=http://controller:8776/v2/%\(tenant_id\)s

+-------------+-----------------------------------------+

| Property | Value |

+-------------+-----------------------------------------+

| adminurl | http://controller:8776/v2/%(tenant_id)s |

| id | 0eda32a224b74b958be4dc551dfe4aaa |

| internalurl | http://controller:8776/v2/%(tenant_id)s |

| publicurl | http://controller:8776/v2/%(tenant_id)s |

| region | regionOne |

Page 67: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 67

| service_id | cb2b03621220473c9bcbe194dfd55695 |

+-------------+-----------------------------------------+

13–4 設定の変更/etc/cinder/cinder.conf

※以下の記述を追加します。[DEFAULT]

rpc_backend = cinder.openstack.common.rpc.impl_kombu

rabbit_host = controller

rabbit_port = 5672

rabbit_userid = guest

rabbit_password = password

glance_host = controller

[keystone_authtoken]

auth_uri = http://controller:5000

auth_host = controller

auth_port = 35357

auth_protocol = http

admin_tenant_name = service

admin_user = cinder

admin_password = password

[database]

connection = mysql://cinder:password@controller/cinder

13–5 使用しないデータベースファイル削除

controller# rm /var/lib/cinder/cinder.sqlite

13–6 データベースに表を作成

controller# cinder-manage db sync

13–7 サービス再起動

controller# rm /var/log/cinder/*

controller# service cinder-scheduler restart && service cinder-api restart

13–8 ログ確認

Page 68: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 68

controller# grep "ERROR\|WARNING" /var/log/cinder/*

/var/log/cinder/cinder-api.log:2014-05-16 16:56:57.401 2641 WARNING cinder.service [-] Value of config option

osapi_volume_workers must be integer greater than 1. Input value ignored.

/var/log/cinder/cinder-scheduler.log:2014-05-16 16:56:37.733 2287 ERROR oslo.messaging._drivers.impl_rabbit [r

eq-b051f972-4128-49bb-a820-b0718340f8fd - - - - -] AMQP server on localhost:5672 is unreachable: Socket closed

. Trying again in 30 seconds.

/var/log/cinder/cinder-volume.log:2014-05-16 16:56:38.409 2390 ERROR oslo.messaging._drivers.impl_rabbit [-] A

MQP server on localhost:5672 is unreachable: Socket closed. Trying again in 30 seconds.

/var/log/cinder/cinder-volume.log:2014-05-16 16:57:12.442 2390 ERROR oslo.messaging._drivers.impl_rabbit [-] A

MQP server on localhost:5672 is unreachable: Socket closed. Trying again in 30 seconds.

/var/log/cinder/cinder-volume.log:2014-05-16 16:57:46.479 2390 ERROR oslo.messaging._drivers.impl_rabbit [-] A

MQP server on localhost:5672 is unreachable: Socket closed. Trying again in 30 seconds.

※上記ERRORとWARNINGが出力されなければ問題ありません。

13–9 イメージ格納用ボリューム作成イメージ格納用ボリュームを設定するために物理ボリュームの設定、ボリューム作成を行います。

13–9–1 物理ボリューム設定

以下コマンドで物理ボリュームを設定します。

controller# pvcreate /dev/sdb

Physical volume "/dev/sdb" successfully created

controller# vgcreate cinder-volumes /dev/sdb

Volume group "cinder-volumes" successfully created

13–9–2 サービス再起動

controller# service cinder-volume restart && service tgt restart

13–9–3 admin環境変数設定ファイル読み込み

インスタンス格納用ボリュームを作成するためにadmin環境変数を読み込みます。

controller# source admin-openrc

13–9–4 ボリューム作成

以下コマンドでインスタンス格納用ボリュームを作成します。

Page 69: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 69

controller# cinder create --display-name testvolume01 1

+---------------------+--------------------------------------+

| Property | Value |

+---------------------+--------------------------------------+

| attachments | [] |

| availability_zone | nova |

| bootable | false |

| created_at | 2014-04-30T10:57:30.357692 |

| display_description | None |

| display_name | testvolume01 |

| encrypted | False |

| id | 2bd90ca8-0062-4b31-b3b2-7fd6fdc8da97 |

| metadata | {} |

| size | 1 |

| snapshot_id | None |

| source_volid | None |

| status | creating |

| volume_type | None |

+---------------------+--------------------------------------+

13–9–5 作成ボリュームの確認

以下コマンドで作成ボリュームを確認します。

controller# cinder list

+--------------------------------------+-----------+--------------+------+-------------+----------+-----------

--+

| ID | Status | Display Name | Size | Volume Type | Bootable | Attached t

o |

+--------------------------------------+-----------+--------------+------+-------------+----------+-----------

--+

| 2bd90ca8-0062-4b31-b3b2-7fd6fdc8da97 | available | testvolume01 | 1 | None | false |

|

+--------------------------------------+-----------+--------------+------+-------------+----------+-----------

--+

※一覧に登録されたボリュームが作成表示されていれば問題ありません。

Page 70: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 70

14. Ceilometerインストール・設定(controllerノード)

14–1 パッケージインストール

controller# apt-get install -y ceilometer-api ceilometer-collector ceilometer-agent-central \

ceilometer-agent-notification ceilometer-alarm-evaluator ceilometer-alarm-notifier python-ceilometerclient m

ongodb-server

14–2 デフォルトのデータベースファイル削除

controller# service mongodb stop

controller# rm /var/lib/mongodb/journal/prealloc.*

controller# service mongodb start

14–3 mongodb データベース設定/etc/mongodb.conf

#bind_ip = 127.0.0.1 ← 既存設定をコメントアウトbind_ip = 192.168.0.10 ← 追記

14–4 mongodbサービス再起動

controller# service mongodb restart

14–5 mongodbデータベース作成mongodbのデータベースを作成します、–hostオプションはcontrollerノードのIPアドレスを直接入力してください。

Page 71: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 71

controller# mongo --host 192.168.0.10 --eval '

> db = db.getSiblingDB("ceilometer");

> db.addUser({user:"ceilometer",pwd:"password",roles:["readWrite","dbAdmin"]})'

MongoDB shell version: 2.4.9

connecting to: 192.168.0.10:27017/test

{

"user" : "ceilometer",

"pwd" : "c3f1480e5fb171fed77480ec8a9c1a7f",

"roles" : [

"readWrite",

"dbAdmin"

],

"_id" : ObjectId("5361de166482a8aae1aa39c0")

}

Page 72: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 72

14–6 認証情報の設定以下コマンドで認証情報を設定します。

controller# source admin-openrc

controller# keystone user-create --name=ceilometer --pass=password [email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | f496357d3de9426087fc81684c434d68 |

| name | ceilometer |

| username | ceilometer |

+----------+----------------------------------+

controller# keystone user-role-add --user=ceilometer --tenant=service --role=admin

controller# keystone service-create --name=ceilometer --type=metering \

--description="Telemetry"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | Telemetry |

| enabled | True |

| id | 0e7928583f2c4f3e80315eb53dfc705b |

| name | ceilometer |

| type | metering |

+-------------+----------------------------------+

controller# keystone endpoint-create \

--service=ceilometer \

--publicurl=http://controller:8777 \

--internalurl=http://controller:8777 \

--adminurl=http://controller:8777

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| adminurl | http://controller:8777 |

| id | e6b0107d3aa04a04b824a4c2aa7fe1f4 |

| internalurl | http://controller:8777 |

| publicurl | http://controller:8777 |

| region | regionOne |

| service_id | 0e7928583f2c4f3e80315eb53dfc705b |

+-------------+----------------------------------+

Page 73: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 73

14–7 設定の変更/etc/ceilometer/ceilometer.conf

[DEFAULT]

# auth_strategy = keystone

auth_strategy = keystone ← 追記rabbit_host = controller ← 追記rabbit_password = password ← 追記log_dir = /var/log/ceilometer ← 追記

[database]

#connection=sqlite:////var/lib/ceilometer/$sqlite_db ← 既存設定をコメントアウトconnection = mongodb://ceilometer:[email protected]:27017/ceilometer ← 追記

[keystone_authtoken]

auth_host = controller ← 追記auth_port = 35357 ← 追記auth_protocol = http ← 追記auth_uri = http://controller:5000 ← 追記admin_tenant_name = service ← 追記admin_user = ceilometer ← 追記admin_password = password ← 追記

[publisher]

metering_secret = password ← 追記

[service_credentials]

os_auth_url = http://controller:5000/v2.0 ← 追記os_username = ceilometer ← 追記os_tenant_name = service ← 追記os_password = password ← 追記

※connectionの接続先はIPアドレスを指定しないとデータベースの接続エラーとなります。

/etc/glance/glance-api.conf

※[DEFAULT]に以下の記述を追加します。

[DEFAULT]

notification_driver = messaging

/etc/cinder/cinder.conf

※[DEFAULT]に以下の記述を追加します。

Page 74: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 74

[DEFAULT]

control_exchange = cinder

notification_driver = cinder.openstack.common.notifier.rpc_notifier

14–8 使用しないデータベースファイル削除

controller# rm /var/lib/ceilometer/ceilometer.sqlite

14–9 サービス再起動

controller# rm /var/log/glance/*

controller# rm /var/log/cinder/*

controller# rm /var/log/ceilometer/*

controller# service ceilometer-agent-central restart && \

service ceilometer-agent-notification restart && \

service ceilometer-api restart && \

service ceilometer-collector restart && \

service ceilometer-alarm-evaluator restart && \

service ceilometer-alarm-notifier restart && \

service glance-registry restart && \

service glance-api restart && \

service cinder-api restart && \

service cinder-scheduler restart && \

service cinder-volume restart

14–10 ログ確認

controller# grep "ERROR\|WARNING" /var/log/glance/*

/var/log/glance/api.log:2014-05-18 14:10:04.528 8459 ERROR glance.store.sheepdog [-] Error in store configurat

ion: Unexpected error while running command.

/var/log/glance/api.log:2014-05-18 14:10:04.531 8459 WARNING glance.store.base [-] Failed to configure store c

orrectly: Store sheepdog could not be configured correctly. Reason: Error in store configuration: Unexpected e

rror while running command.

/var/log/glance/api.log:2014-05-26 14:10:04.532 8459 WARNING glance.store [-] Deprecated: glance.store.sheepdo

g.Store not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 14:10:04.541 8459 WARNING glance.store [-] Deprecated: glance.store.rbd.Sto

re not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 14:10:04.545 8459 WARNING glance.store.base [-] Failed to configure store c

orrectly: Store gridfs could not be configured correctly. Reason: Missing dependencies: pymongo Disabling add

method.

/var/log/glance/api.log:2014-05-18 14:10:04.546 8459 WARNING glance.store [-] Deprecated: glance.store.gridfs.

Store not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

Page 75: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 75

/var/log/glance/api.log:2014-05-18 14:10:04.645 8459 WARNING glance.store.base [-] Failed to configure store c

orrectly: Store cinder could not be configured correctly. Reason: Cinder storage requires a context. Disabling

add method.

/var/log/glance/api.log:2014-05-18 14:10:04.646 8459 WARNING glance.store [-] Deprecated: glance.store.cinder.

Store not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 14:10:04.669 8459 WARNING glance.store [-] Deprecated: glance.store.swift.S

tore not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 14:10:04.719 8459 WARNING glance.store [-] Deprecated: glance.store.vmware_

datastore.Store not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

/var/log/glance/api.log:2014-05-18 14:10:04.721 8459 WARNING glance.store [-] Deprecated: glance.store.s3.Stor

e not found in `known_store`. Stores need to be explicitly enabled in the configuration file.

controller# grep "ERROR\|WARNING" /var/log/cinder/*

/var/log/cinder/cinder-api.log:2014-05-18 16:22:08.840 3902 WARNING cinder.service [-] Value of config option

osapi_volume_workers must be integer greater than 1. Input value ignored.

/var/log/cinder/cinder-scheduler.log:2014-05-18 14:10:55.049 1141 WARNING cinder.context [-] Arguments dropped

when creating context: {'user': None, 'tenant': None, 'user_identity': u'- - - - -'}

/var/log/cinder/cinder-scheduler.log:2014-05-18 14:10:09.436 3921 WARNING cinder.context [-] Arguments dropped

when creating context: {'user': None, 'tenant': None, 'user_identity': u'- - - - -'}

/var/log/cinder/cinder-scheduler.log:2014-05-18 14:10:31.494 3921 WARNING cinder.context [-] Arguments dropped

when creating context: {'user': None, 'tenant': None, 'user_identity': u'- - - - -'}

controller# grep "ERROR\|WARNING" /var/log/ceilometer/*

/var/log/ceilometer/ceilometer-agent-central.log:2014-05-18 14:10:04.621 3471 WARNING ceilometer.agent [-] Con

tinue after error from image: Error communicating with

※上記WARNING以外表示されなければ問題ありません。

Page 76: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 76

15. Ceilometerインストール・設定(compute1ノード)

15–1 パッケージインストール

compute1# apt-get install -y ceilometer-agent-compute

15–2 設定の変更

15–2–1 Nova設定ファイル変更

/etc/nova/nova.conf

※[DEFAULT]に以下の記述を追加します。

[DEFAULT]

instance_usage_audit = True

instance_usage_audit_period = hour

notify_on_state_change = vm_and_task_state

notification_driver = nova.openstack.common.notifier.rpc_notifier

notification_driver = ceilometer.compute.nova_notifier

15–2–2 サービス再起動

compute1# service nova-compute restart

Page 77: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 77

15–2–3 Ceilometer設定ファイル変更

/etc/ceilometer/ceilometer.conf

[DEFAULT]

rabbit_host = controller ← 追記rabbit_password = password ← 追記log_dir = /var/log/ceilometer ← 追記

[keystone_authtoken]

auth_host = controller ← 追記auth_port = 35357 ← 追記auth_protocol = http ← 追記admin_tenant_name = service ← 追記admin_user = ceilometer ← 追記admin_password = password ← 追記

[publisher]

metering_secret = password ← 追記

[service_credentials]

os_auth_url = http://controller:5000/v2.0 ← 追記os_username = ceilometer ← 追記os_tenant_name = service ← 追記os_password = password ← 追記

15–3 サービス再起動

compute1# rm /var/log/nova/*

compute1# rm /var/log/ceilometer/*

compute1# service ceilometer-agent-compute restart

Page 78: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 78

15–4 ログ確認

compute1# grep "ERROR\|WARNING" /var/log/nova/*

compute1# grep "ERROR\|WARNING" /var/log/ceilometer/*

2014-05-17 18:08:33.648 4421 WARNING ceilometer.compute.virt.libvirt.inspector [-] Failed to inspect disks of

instance-0000000b, domain is in state of SHUTOFF

2014-05-17 18:08:33.661 4421 WARNING ceilometer.compute.virt.libvirt.inspector [-] Failed to inspect disks of

instance-0000000a, domain is in state of SHUTOFF

2014-05-17 18:08:33.694 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbd9c390>,)

2014-05-17 18:08:33.698 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbd9c250>,)

2014-05-17 18:08:33.708 4421 WARNING ceilometer.compute.virt.libvirt.inspector [-] Failed to inspect vnics of

instance-0000000b, domain is in state of SHUTOFF

2014-05-17 18:08:33.718 4421 WARNING ceilometer.compute.virt.libvirt.inspector [-] Failed to inspect vnics of

instance-0000000a, domain is in state of SHUTOFF

2014-05-17 18:08:33.740 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbd9c310>,)

2014-05-17 18:08:33.743 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbda9e50>,)

2014-05-17 18:08:33.766 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbda9cd0>,)

2014-05-17 18:08:33.769 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbda9dd0>,)

2014-05-17 18:08:33.781 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbda9d10>,)

2014-05-17 18:08:33.785 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbda9d90>,)

2014-05-17 18:08:33.806 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbda9e90>,)

2014-05-17 18:08:33.808 4421 WARNING ceilometer.transformer.conversions [-] dropping sample with no predecesso

r: (<ceilometer.sample.Sample object at 0x7f8afbda9d90>,)

※上記WARNING以外表示されなければ問題ありません。

15–5 計測項目取得確認確認はcontrollerノードで行ってください。

15–5–1 admin環境変数設定ファイル読み込み

controller# source admin-openrc

15–5–2 controllerノードでCeilometerの計測項目が取得可能か確認

Page 79: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 79

controller# ceilometer meter-list

+------------+-------+------+--------------------------------------+---------+--------------------------------

--+

| Name | Type | Unit | Resource ID | User ID | Project ID

|

+------------+-------+------+--------------------------------------+---------+--------------------------------

--+

| image.size | gauge | B | 1cdc90ca-fc4b-4064-8514-21aac275729f | None | 261110e97ca143c091d8c82c50f5291

c |

+------------+-------+------+--------------------------------------+---------+--------------------------------

--+

※計測項目一覧が表示されるであれば問題ありません。

Page 80: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 80

16. フロントエンドインストール・確認(controllerノード)クライアントマシンからブラウザでOpenStack環境を操作可能なフロントエンドをインストールします。

16–1 パッケージインストール

controller# apt-get install -y apache2 memcached libapache2-mod-wsgi openstack-dashboard

16–2 フロントエンドアクセス確認controllerノードとネットワーク的に接続されているマシンからブラウザで以下URLに接続してOpenStackのログイン画面が表示されるか確認します。

※ブラウザで接続するマシンは予めDNSもしくは/etc/hostsにcontrollerノードのIPを記述しておく等controllerノードの名前解決を行っておく必要があります。

http://controller/horizon/

※上記URLにアクセスしてログイン画面が表示され、ユーザーadminとdemoでログイン(パスワード:password)でログインできれば問題ありません。

Page 81: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 81

17. セキュリティグループ設定(controllerノード)このままではインスタンスの疎通確認やアクセスができないので特定のパケットを通すように設定します。

17–1 demo環境変数設定ファイル読み込み

controller# source demo-openrc

17–2 ICMPパケット透過設定

controller# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0

+-------------+-----------+---------+-----------+--------------+

| IP Protocol | From Port | To Port | IP Range | Source Group |

+-------------+-----------+---------+-----------+--------------+

| icmp | -1 | -1 | 0.0.0.0/0 | |

+-------------+-----------+---------+-----------+--------------+

17–3 SSHパケット透過設定

controller# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0

+-------------+-----------+---------+-----------+--------------+

| IP Protocol | From Port | To Port | IP Range | Source Group |

+-------------+-----------+---------+-----------+--------------+

| tcp | 22 | 22 | 0.0.0.0/0 | |

+-------------+-----------+---------+-----------+--------------+

17–4 設定確認

controller# nova secgroup-list-rules default

+-------------+-----------+---------+-----------+--------------+

| IP Protocol | From Port | To Port | IP Range | Source Group |

+-------------+-----------+---------+-----------+--------------+

| | | | | default |

| tcp | 22 | 22 | 0.0.0.0/0 | |

| | | | | default |

| icmp | -1 | -1 | 0.0.0.0/0 | |

+-------------+-----------+---------+-----------+--------------+

※リストにICMPとポート番号22の設定があれば問題ありません。

Page 82: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 82

18. Swiftのインストールと設定Swiftは一つにまとめることが可能ですが、このドキュメントでは2つのノードに分けてインストールを行います。

※compute1ノードに新規にHDDドライブを追加してあります。(/dev/sdb)

18–1 共通設定(controllerノード、compute1ノード)

18–1–1 設定ファイル用ディレクトリ作成

設定ファイル用のディレクトリを作成します

controller# mkdir -p /etc/swift

18–1–2 設定ファイル作成

※プロキシノード、ストレージノード双方に記述します。

/etc/swift/swift.conf

[swift-hash]

# random unique string that can never change (DO NOT LOSE)

swift_hash_path_prefix = xrfuniounenqjnw

swift_hash_path_suffix = fLIbertYgibbitZ

Page 83: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 83

18–2 認証情報の設定(controllerノード)以下コマンドで認証情報を設定します。

controller# keystone user-create --name=swift --pass=password \

[email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | f4bfa05237154029a958f121c4de0673 |

| name | swift |

| username | swift |

+----------+----------------------------------+

controller# keystone user-role-add --user=swift --tenant=service --role=admin

controller# keystone service-create --name=swift --type=object-store \

--description="OpenStack Object Storage"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | OpenStack Object Storage |

| enabled | True |

| id | 7d817bcf9d504fa68c049a376b3f432b |

| name | swift |

| type | object-store |

+-------------+----------------------------------+

controller# keystone endpoint-create \

--service-id=$(keystone service-list | awk '/ object-store / {print $2}') \

--publicurl='http://controller:8080/v1/AUTH_%(tenant_id)s' \

--internalurl='http://controller:8080/v1/AUTH_%(tenant_id)s' \

--adminurl=http://controller:8080

+-------------+----------------------------------------------+

| Property | Value |

+-------------+----------------------------------------------+

| adminurl | http://controller:8080 |

| id | edd04f8bb68e4181939ec2c8e14923b6 |

| internalurl | http://controller:8080/v1/AUTH_%(tenant_id)s |

| publicurl | http://controller:8080/v1/AUTH_%(tenant_id)s |

| region | regionOne |

| service_id | 7d817bcf9d504fa68c049a376b3f432b |

+-------------+----------------------------------------------+

Page 84: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 84

18–3 Swiftストレージノード設定(compute1ノード)Swiftのストレージノードパッケージのインストールとrsyncの設定を行います。

18−3–1 パッケージインストール

以下コマンドでパッケージをインストールします。

compute1# apt-get install -y swift swift-account swift-container swift-object xfsprogs

18−3–2 ストレージデバイス設定

ストレージデバイスを作成します

compute1# fdisk /dev/sdb

compute1# mkfs.xfs /dev/sdb1

compute1# echo "/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab

compute1# mkdir -p /srv/node/sdb1

compute1# mount /srv/node/sdb1

compute1# chown -R swift:swift /srv/node

18–3–3 rsync設定ファイル作成

/etc/rsyncd.confを以下内容で作成します。

Page 85: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 85

uid = swift

gid = swift

log file = /var/log/rsyncd.log

pid file = /var/run/rsyncd.pid

address = 10.0.0.11

[account]

max connections = 2

path = /srv/node/

read only = false

lock file = /var/lock/account.lock

[container]

max connections = 2

path = /srv/node/

read only = false

lock file = /var/lock/container.lock

[object]

max connections = 2

path = /srv/node/

read only = false

lock file = /var/lock/object.lock

18–3–4 rsyncデフォルト設定を変更

/etc/defaut/rsyncの以下設定を変更してrsyncの動作を有効にします。

RSYNC_ENABLE=true

18–3–5 rsync起動

rsyncを起動し増す。

compute1# service rsync start

18–3–6 キャッシュディレクトリ作成

以下コマンドでキャッシュディレクトリを作成します

compute1# mkdir -p /var/swift/recon

18–3–7 キャッシュディレクトリ、オーナー変更

キャッシュディレクトリのオーナーをSwiftユーザーに変更します

Page 86: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 86

compute1# chown -R swift:swift /var/swift/recon

Page 87: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 87

18–4 Swiftプロキシ設定(controllerノード)

18–4–1 パッケージインストール

controller# apt-get install swift swift-proxy memcached python-keystoneclient python-swiftclient python-webob

18–4–2 memcached設定

設定ファイルの以下の部分を変更します。

/etc/memcached.conf

#-l 127.0.0.1 ← コメント化-l 10.0.0.11 ← 追記

18–4–3 memcachedサービス再起動

以下コマンドでmemcachedサービスを再起動します。

controller# service memcached restart

Page 88: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 88

18–4–4 プロキシサービス設定ファイル作成

以下内容で作成します。

/etc/swift/proxy-server.conf

Page 89: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 89

[DEFAULT]

bind_port = 8080

user = swift

[pipeline:main]

pipeline = healthcheck cache authtoken keystoneauth proxy-server

[app:proxy-server]

use = egg:swift#proxy

allow_account_management = true

account_autocreate = true

[filter:keystoneauth]

use = egg:swift#keystoneauth

operator_roles = Member,admin,swiftoperator

[filter:authtoken]

paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory

# Delaying the auth decision is required to support token-less

# usage for anonymous referrers ('.r:*').

delay_auth_decision = true

# auth_* settings refer to the Keystone server

auth_protocol = http

auth_host = controller

auth_uri = http://controller:5000

# the service tenant and swift username and password created in Keystone

admin_tenant_name = service

admin_user = swift

admin_password = password

[filter:cache]

use = egg:swift#memcache

[filter:catch_errors]

use = egg:swift#catch_errors

[filter:healthcheck]

use = egg:swift#healthcheck

Page 90: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 90

18–5 リングファイル作成・設定(controllerノード)リングファイルを作成して、プロキシノードとストレージノードのデバイスと関連付けを行いデバイスを認識できるようにします。

18–5–1 /etc/swiftへ移動

リングファイルを作成するために/etc/swiftディレクトリへ移動します。

controller# cd /etc/swift

18–5–2 ビルダーファイル作成

以下コマンドでビルダーファイルを作成します。

controller# swift-ring-builder account.builder create 18 3 1

controller# swift-ring-builder container.builder create 18 3 1

controller# swift-ring-builder object.builder create 18 3 1

18–5–3 ビルダーファイル作成確認

上記コマンドでビルダーファイルが作成されているか確認します。

controller:~# ls *.builder

account.builder container.builder object.builder

※上記のファイルが作成されていれば問題ありません。

Page 91: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 91

18–5–4 ストレージデバイス関連付け

以下コマンドで作成したビルダーファイルとストレージデバイスの関連付けを行います。

controller# swift-ring-builder account.builder add z1-10.0.0.1:6002R/sdb1 100

WARNING: No region specified for z1-10.0.0.11:6002/sdb1. Defaulting to region 1.

Device d0r1z1-10.0.0.11:6002R10.0.0.11:6002/sdb1_"" with 100.0 weight got id 0

controller# swift-ring-builder container.builder add z1-10.0.0.1:6001/sdb1 100

WARNING: No region specified for z1-10.0.0.11:6001/sdb1. Defaulting to region 1.

Device d0r1z1-10.0.0.11:6001R10.0.0.11:6001/sdb1_"" with 100.0 weight got id 0

controller# swift-ring-builder object.builder add z1-10.0.0.11:6000/sdb1 100

WARNING: No region specified for z1-10.0.0.11:6000/sdb1. Defaulting to region 1.

Device d0r1z1-10.0.0.11:6000R10.0.0.11:6000/sdb1_"" with 100.0 weight got id 0

※WARNINGが表示されますが問題ありません。

18–5–5 デバイス関連付け確認

ストレージデバイスと関連付けが行われているかを確認します。

controller# swift-ring-builder account.builder

account.builder, build version 1

262144 partitions, 3.000000 replicas, 1 regions, 1 zones, 1 devices, 100.00 balance

The minimum number of hours before a partition can be reassigned is 1

Devices: id region zone ip address port replication ip replication port name weight partitio

ns balance meta

0 1 1 10.0.0.11 6002 10.0.0.11 6002 sdb1 100.00 0 -100.00

controller# swift-ring-builder container.builder

container.builder, build version 1

262144 partitions, 3.000000 replicas, 1 regions, 1 zones, 1 devices, 100.00 balance

The minimum number of hours before a partition can be reassigned is 1

Devices: id region zone ip address port replication ip replication port name weight partitio

ns balance meta

0 1 1 10.0.0.11 6001 10.0.0.11 6001 sdb1 100.00 0 -100.00

controller# swift-ring-builder object.builder

object.builder, build version 1

262144 partitions, 3.000000 replicas, 1 regions, 1 zones, 1 devices, 100.00 balance

The minimum number of hours before a partition can be reassigned is 1

Devices: id region zone ip address port replication ip replication port name weight partitio

ns balance meta

0 1 1 10.0.0.11 6000 10.0.0.11 6000 sdb1 100.00 0 -100.00

Page 92: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 92

18–5–6 リングファイル作成

以下コマンドでストレージを関連付けたリングファイルを作成します。

controller# swift-ring-builder account.builder rebalance

Reassigned 262144 (100.00%) partitions. Balance is now 0.00.

controller# swift-ring-builder container.builder rebalance

Reassigned 262144 (100.00%) partitions. Balance is now 0.00.

controller# swift-ring-builder object.builder rebalance

Reassigned 262144 (100.00%) partitions. Balance is now 0.00.

18–5–7 リングファイル作成確認

先のコマンドでリングファイルが作成されているか確認します。

controller# ls *.ring.gz

account.ring.gz container.ring.gz object.ring.gz

※上記のファイルが作成されていれば問題ありません。

18–5–8 /etc/swiftディレクトリオーナー変更

/etc/swiftディレクトリのオーナーをswiftユーザーに変更します。

controller# chown -R swift:swift /etc/swift

18–5–9 サービス再起動

Swiftのプロキシサービスを再起動します。

controller# service swift-proxy restart

Page 93: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 93

18–6 リング設定反映(compute1ノード)

18–6–1 リングファイルコピー

controllerノードで作成したリングファイルをストレージノードの/etc/swiftにコピーします。

compute1# cd /etc/swift

compute1# scp user@controller:/etc/swift/*.gz .

The authenticity of host 'controller (192.168.30.100)' can't be established.

ECDSA key fingerprint is a1:97:13:e2:e4:df:52:58:e1:58:fa:be:b6:d7:2a:cd.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'controller,192.168.30.100' (ECDSA) to the list of known hosts.

user@controller's password:

account.ring.gz

100% 1732 1.7KB/s 00:00

container.ring.gz

100% 1733 1.7KB/s 00:00

object.ring.gz

100% 1730 1.7KB/s 00:00

18−6−2 サービス再起動

ストレージサービスを再起動します。

compute1# for service in \

swift-object swift-object-replicator swift-object-updater swift-object-auditor \

swift-container swift-container-replicator swift-container-updater swift-container-auditor \

swift-account swift-account-replicator swift-account-reaper swift-account-auditor; do \

service $service start; done

Page 94: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 94

19. Heat 動作確認(controllerノード)

19–1 admin環境変数設定ファイル読み込みadmin環境変数を詠み込みます。

controller# source admin-openrc.sh

19–2 Swift状態確認以下コマンドでSwiftの状態を確認します。

controller# swift stat

Account: AUTH_b348b47155884978af344b84db561865

Containers: 0

Objects: 0

Bytes: 0

Content-Type: text/plain; charset=utf-8

X-Timestamp: 1404454338.78517

X-Trans-Id: txf10d032b325c4a01b20a2-0053b645c2

X-Put-Timestamp: 1404454338.78517

19–3 テスト用ファイル作成ストレージへ送るためのテストファイルを作成します。

controller# echo "test 1 file" > test.txt

controller# echo "test 2 file" > test2.txt

19–4 テスト用ファイルアップロードテストファイルをストレージへアップロードします。

controller# swift upload myfiles test.txt

controller# swift upload myfiles test2.txt

19–5 テスト用ファイルダウンロード別のディレクトリへ移動しアップロードしたファイルをダウンロードします。

controller# cd /tmp

controller# swift download myfiles

controller# ls

Page 95: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 95

19–6 ダウンロード確認ダウンロードされているか確認します。

controller# ls

test.txt text2.txt

Page 96: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 96

20. Heat のインストールと設定(controllerノード)Heatをインストールすることにより、予め設定の必要なインスタンスや、複数インスタンス間で連携して動作する必要がある環境をスタックとして登録することが可能となります。

20–1 パッケージのインストール

controller# apt-get install -y heat-api heat-api-cfn heat-engine

20−2 データベースの作成・確認

20−2−1 データベース作成

MySQLのデータベースにHeatのデータベースを作成します。

controller# mysql -u root -p << EOF

CREATE DATABASE heat;

GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' \

IDENTIFIED BY 'password';

EOF

Enter password: ← MySQLのrootパスワードpasswordを入力

20–2–2 データベースの確認

MySQLにHeatのデータベースが作成されたか確認します。

Page 97: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 97

controller# mysql -u heat -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 70

Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| heat |

+--------------------+

2 rows in set (0.00 sec)

※ユーザーheatでログイン可能でデータベースの閲覧が可能なら問題ありません。

Page 98: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 98

20–3 認証情報の設定以下コマンドで認証情報を設定します。

controller# source admin-openrc.sh

controller# keystone user-create --name heat --pass=password \

[email protected]

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| email | [email protected] |

| enabled | True |

| id | 46d2f3d760f24f7fa9a330bc44d6e300 |

| name | heat |

| username | heat |

+----------+----------------------------------+

controller# keystone user-role-add --user=heat --tenant=service --role=admin

controller# keystone service-create --name=heat --type=orchestration \

--description="Orchestration"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | Orchestration |

| enabled | True |

| id | 6809388ab08346bb8e8fae84d51c9766 |

| name | heat |

| type | orchestration |

+-------------+----------------------------------+

controller# keystone service-create --name=heat-cfn --type=cloudformation \

--description="Orchestration CloudFormation"

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| description | Orchestration CloudFormation |

| enabled | True |

| id | e606f59f6f4a44069fe34a3c23ddb09c |

| name | heat-cfn |

| type | cloudformation |

+-------------+----------------------------------+

controller# keystone role-create --name heat_stack_user

+----------+----------------------------------+

| Property | Value |

+----------+----------------------------------+

| id | 63d6d5789e944020913b3cb904c37140 |

Page 99: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 99

| name | heat_stack_user |

+----------+----------------------------------+

controller# keystone endpoint-create \

> --service-id=$(keystone service-list | awk '/ orchestration / {print $2}') \

> --publicurl=http://controller:8004/v1/%\(tenant_id\)s \

> --internalurl=http://controller:8004/v1/%\(tenant_id\)s \

> --adminurl=http://controller:8004/v1/%\(tenant_id\)s

+-------------+-----------------------------------------+

| Property | Value |

+-------------+-----------------------------------------+

| adminurl | http://controller:8004/v1/%(tenant_id)s |

| id | 6a358143e26f4da7bbcffacee5eecae2 |

| internalurl | http://controller:8004/v1/%(tenant_id)s |

| publicurl | http://controller:8004/v1/%(tenant_id)s |

| region | regionOne |

| service_id | 6809388ab08346bb8e8fae84d51c9766 |

+-------------+-----------------------------------------+

# keystone endpoint-create \

> --service-id=$(keystone service-list | awk '/ cloudformation / {print $2}') \

> --publicurl=http://controller:8000/v1 \

> --internalurl=http://controller:8000/v1 \

> --adminurl=http://controller:8000/v1

+-------------+----------------------------------+

| Property | Value |

+-------------+----------------------------------+

| adminurl | http://controller:8000/v1 |

| id | 498d36d4d2f14f3e8f5fb70afecf5030 |

| internalurl | http://controller:8000/v1 |

| publicurl | http://controller:8000/v1 |

| region | regionOne |

| service_id | e606f59f6f4a44069fe34a3c23ddb09c |

+-------------+----------------------------------+

Page 100: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 100

20–4 設定の変更/etc/heat/heat.conf

[DEFAULT]

...

rpc_backend = heat.openstack.common.rpc.impl_kombu ← 追記rabbit_host = controller ← 追記rabbit_password = password ← 追記heat_metadata_server_url = http://controller:8000 ← 追記heat_waitcondition_server_url = http://controller:8000/v1/waitcondition ← 追記log_dir = /var/log/heat ← 追記

[database]

...

#connection=sqlite:////var/lib/heat/$sqlite_db ← 既存設定をコメントアウトconnection = mysql://heat:password@controller/heat ← 追記

[keystone_authtoken]

...

auth_uri = http://controller:5000/v2.0 ← 追記auth_host = controller ← 追記auth_port = 35357 ← 追記auth_protocol = http ← 追記admin_tenant_name = service ← 追記admin_user = heat ← 追記admin_password = password ← 追記

[ec2authtoken]

...

auth_uri = http://controller:5000/v2.0 ← 追記

Page 101: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 101

20–5 使用しないデータベースファイルの削除

controller# rm /var/lib/heat/heat.sqlite

20–6 データベースに表を作成

controller# heat-manage db_sync

※以下メッセージが出力されますが問題ありません。

No handlers could be found for logger "heat.common.config"

2014-06-30 16:30:56.095 4563 WARNING heat.openstack.common.db.sqlalchemy.session [-] This application has not

enabled MySQL traditional mode, which means silent data corruption may occur. Please encourage the application

developers to enable this mode.

/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py:324: Warning: Specified key was too long; max key

length is 767 bytes

cursor.execute(statement, parameters)

20–7 サービス再起動

controller# rm /var/log/heat/*

controller# service heat-api restart ; \

service heat-api-cfn restart ; \

service heat-engine restart

20–8 ログ確認

controller# grep "ERROR\|WARNING" /var/log/heat/*

/var/log/heat/heat-engine.log:2014-06-30 16:45:33.779 4873 WARNING heat.common.config [-] The "instance_user"

option in heat.conf is deprecated and will be removed in the Juno release.

/var/log/heat/heat-engine.log:2014-06-30 16:45:35.379 4873 WARNING heat.openstack.common.db.sqlalchemy.session

[req-c37ddf9e-ebbb-4ad4-82c8-dd90d47fb3d0 None] This application has not enabled MySQL traditional mode, whic

h means silent data corruption may occur. Please encourage the application developers to enable this mode.

※上記メッセージ以外が表示されなければ問題ありません。

Page 102: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 102

21. Heat 動作確認(controllerノード)

21–1 demo環境変数読み込み

controller# source demo-openrc.sh

21–2 テンプレートファイル作成スタックを作成するための設定を記述したファイルをテンプレートとして作成します。

test-stack.yml

heat_template_version: 2013-05-23

description: Test Template

parameters:

ImageID:

type: string

description: Image use to boot a server

NetID:

type: string

description: Network ID for the server

resources:

server1:

type: OS::Nova::Server

properties:

name: "Test server"

image: { get_param: ImageID }

flavor: "m1.tiny"

networks:

- network: { get_param: NetID }

outputs:

server1_private_ip:

description: IP address of the server in the private network

value: { get_attr: [ server1, first_address ] }

Page 103: OpenStack Icehouse構築手順書

OpenStack構築手順書 Icehouse版

日本仮想化技術 103

21–3 スタック作成内容を以下コマンドを使って、テンプレートファイルよりスタックを作成します。

controller# NET_ID=$(nova net-list | awk '/ demo-net / { print $2 }')

controller# heat stack-create -f test-stack.yml -P "ImageID=CirrOS 3.2;NetID=$NET_ID" testStack

+--------------------------------------+------------+--------------------+----------------------+

| id | stack_name | stack_status | creation_time |

+--------------------------------------+------------+--------------------+----------------------+

| ef6924aa-94d1-4f19-8f41-8f371209ecb3 | testStack | CREATE_IN_PROGRESS | 2014-07-01T11:29:17Z |

+--------------------------------------+------------+--------------------+----------------------+

21–4 スタック作成確認スタックが作成されたか確認します。

# heat stack-list

+--------------------------------------+------------+-----------------+----------------------+

| id | stack_name | stack_status | creation_time |

+--------------------------------------+------------+-----------------+----------------------+

| ef6924aa-94d1-4f19-8f41-8f371209ecb3 | testStack | CREATE_COMPLETE | 2014-07-01T11:29:17Z |

+--------------------------------------+------------+-----------------+----------------------+