EPEL版 OpenStack folsomインストール(cinder編)
前提
cinderは独立したノードにインストールしました。
novaとは同居させていません。
- 構成図
+---------+ +-------+ +-------------+ |keystone | |cinder | |qpidd/mysqld | +----+----+ +---+---+ +------+------+ | | | |.101 |.102 |.100 172.16.201.0/24 -----+----------+------------+-----------------------
EPELパッケージリポジトリ追加
※testingではなく、公式にEPEL版folsomが提供されるようになったので以下のパスに修正しました。
$ sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
openstack-utilsインストール
openstack関連のユーティリティコマンド群(db作成やデモ環境インストール用コマンドなど)をインストールする
$ sudo yum install openstack-utils
インストールされるコマンド群は以下の通り。
- /usr/bin/openstack-config
- /usr/bin/openstack-db
- /usr/bin/openstack-demo-install
- /usr/bin/openstack-status
cinderのインストール
keystoneが提供するモジュール群はcinderが利用することになるので、keystoneも忘れずにインストールしておく必要がある。
$ sudo yum install openstack-cinder openstack-keystone
qpidサーバで利用するcinderアカウントを作成
以下のコマンドをqpiddが稼動しているサーバで実施する。
ここで作成したアカウントは、cinder.conf内に設定することとなる。
$ sudo saslpasswd2 -f /var/lib/qpidd/qpidd.sasldb -u folsom cinder Password: ******** Again (for verification): ********
mysqlサーバ上にcinder用データベースを作成
openstack-dbコマンドでDBを作成する場合、mysqldが動作するサーバ上で実行しなければならない(リモートのDBサーバを指定するオプションは存在しなかった)ので注意。
$ sudo openstack-db --init --service cinder Please enter the password for the 'root' MySQL user: ******** Verified connectivity to MySQL. Creating 'cinder' database. Asking openstack-cinder to sync the database. Complete!
データベースが作成されたことを確認
openstack-dbでデータベースは作成されるが、接続用のユーザ作成してくれないので自分で忘れずに作成する必要がある。
$ mysql -u root -p mysql> use cinder Database changed mysql> show tables; +-------------------------+ | Tables_in_cinder | +-------------------------+ | iscsi_targets | | migrate_version | | migrations | | quota_classes | | quota_usages | | quotas | | reservations | | services | | sm_backend_config | | sm_flavors | | sm_volume | | snapshots | | volume_metadata | | volume_type_extra_specs | | volume_types | | volumes | +-------------------------+ 16 rows in set (0.00 sec)
cinder用ユーザ作成と権限付与。
mysql> grant all on keystone.* to 'cinder'@'localhost' identified by '********'; mysql> grant all on keystone.* to 'cinder'@'172.16.201.100' identified by '********'; mysql> grant all on keystone.* to 'cinder'@'172.16.201.102' identified by '********'; mysql> flush privileges;
cinder設定
- /etc/cinder/cinder.conf
$ sudo openstack-config --set /etc/cinder/cinder.conf DEFAULT sql_connection 'mysql://cinder:********@172.16.201.100/cinder' $ sudo openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_hostname 172.16.201.100 $ sudo openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_port 5672 $ sudo openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_username cinder $ sudo openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_password ******** $ sudo openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone $ sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service $ sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_user cinder $ sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password ******** $ sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_host 172.16.201.101 $ sudo openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_port 35357
- /etc/cinder/api-paste.ini
$ sudo openstack-config --set /etc/cinder/api-paste.ini filter:authtoken service_host 172.16.201.101 $ sudo openstack-config --set /etc/cinder/api-paste.ini filter:authtoken service_port 5000 $ sudo openstack-config --set /etc/cinder/api-paste.ini filter:authtoken auth_host 172.16.201.101 $ sudo openstack-config --set /etc/cinder/api-paste.ini filter:authtoken auth_port 35357 $ sudo openstack-config --set /etc/cinder/api-paste.ini filter:authtoken auth_uri http://172.16.201.101:5000/ $ sudo openstack-config --set /etc/cinder/api-paste.ini filter:authtoken admin_user cinder $ sudo openstack-config --set /etc/cinder/api-paste.ini filter:authtoken admin_tenant_name service $ sudo openstack-config --set /etc/cinder/api-paste.ini filter:authtoken admin_password ********
- /etc/tgt/conf.d/cinder.conf
手動で以下のエントリを追加する。
include /etc/cinder/volumes/*
- /etc/tgt/targets.conf
手動で以下のエントリを追加する。
include /etc/tgt/conf.d/*.conf
cinder-volume作成
cinderが仮想マシンに提供するボリュームである"cinder-volumes"を作成する。
- 1.fdiskでパーティション作成
# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): b There is no *BSD partition on /dev/sda. Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (4178-17750, default 4178): Using default value 4178 Last cylinder, +cylinders or +size{K,M,G} (4178-17750, default 17750): Using default value 17750 Command (m for help): p Disk /dev/sda: 146.0 GB, 145999527936 bytes 255 heads, 63 sectors/track, 17750 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0007a40a Device Boot Start End Blocks Id System /dev/sda1 * 1 3917 31457280 83 Linux /dev/sda2 3917 4178 2097152 82 Linux swap / Solaris /dev/sda3 4178 17750 109021419 83 Linux Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): 8e Changed system type of partition 3 to 8e (Linux LVM) Command (m for help): p Disk /dev/sda: 146.0 GB, 145999527936 bytes 255 heads, 63 sectors/track, 17750 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0007a40a Device Boot Start End Blocks Id System /dev/sda1 * 1 3917 31457280 83 Linux /dev/sda2 3917 4178 2097152 82 Linux swap / Solaris /dev/sda3 4178 17750 109021419 8e Linux LVM Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
- 2.LVMを利用してcinder-volumesを作成
# pvcreate /dev/sda3 Writing physical volume data to disk "/dev/sda3" Physical volume "/dev/sda3" successfully created # vgcreate cinder-volumes /dev/sda3 Volume group "cinder-volumes" successfully created # vgdisplay --- Volume group --- VG Name cinder-volumes System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 103.97 GiB PE Size 4.00 MiB Total PE 26616 Alloc PE / Size 0 / 0 Free PE / Size 26616 / 103.97 GiB VG UUID c6T4iS-lCHy-YyzE-NvWK-VkmQ-Zn2q-2MhsHX
iptablesのポートを開ける
cinder(Port:8776)とtgtd(Port:3260)を開けておく。
# Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp --dport 3260 -j ACCEPT -A INPUT -i eth0 -p tcp -m tcp --dport 8776 -j ACCEPT -A INPUT -p tcp -m tcp -j LOG --log-prefix "IPTABLES_DROPLOG: " --log-level 6 -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
keystoneへの情報登録
- 1.まずはテナント情報を確認する
$ keystone tenant-list +----------------------------------+---------------+---------+ | id | name | enabled | +----------------------------------+---------------+---------+ | 75f495905b844c41b06ddc09afb7ce87 | service | True | | 904b90af097744608581f49186c7163a | openstackDemo | True | +----------------------------------+---------------+---------+
- 2.cinderが利用するユーザ"cinder"を作成しサービス用テナント"service"に所属させる。
$ keystone user-create --name cinder --tenant_id 75f495905b844c41b06ddc09afb7ce87 --pass fuji3776 --email None --enabled true +----------+-------------------------------------------------------------------------------------------------------------------------+ | Property | Value | +----------+-------------------------------------------------------------------------------------------------------------------------+ | email | None | | enabled | True | | id | 89d38c8857f04ba78951ad77f755e3b1 | | name | cinder | | password | $6$rounds=40000$1yxyF9Lj3TwVBlan$dtw/KGJt8k2j8GHhGPuXGqS6kgXmo7mhVRQFUbImicxVdq.939HcrcaZkNHRubrfYatkgPLfDzqt0jXKwKEHX1 | | tenantId | 75f495905b844c41b06ddc09afb7ce87 | +----------+-------------------------------------------------------------------------------------------------------------------------+
- 3.作成したユーザ"cinder"に"admin"ロールを割り当てる。
$ keystone role-list +----------------------------------+------------+ | id | name | +----------------------------------+------------+ | 1554dbd537e2435baaa130d8add96b6c | admin | | b1e612fed695499b82431690c42022be | memberRole | +----------------------------------+------------+ $ keystone user-role-add --user-id 89d38c8857f04ba78951ad77f755e3b1 --role-id 1554dbd537e2435baaa130d8add96b6c --tenant-id 75f495905b844c41b06ddc09afb7ce87
cinderの自動起動設定と起動
cinderの起動スクリプト(openstack-cinder-api,openstack-cinder-volume,openstack-cinder-scheduler)の他にtgtdも忘れずに起動させること。
$ sudo chkconfig --level 3 openstack-cinder-api on $ sudo chkconfig --level 3 openstack-cinder-volume on $ sudo chkconfig --level 3 openstack-cinder-scheduler on $ sudo chkconfig --level 3 tgtd on $ sudo service openstack-cinder-api start $ sudo service openstack-cinder-volume start $ sudo service openstack-cinder-scheduler start $ sudo service tgtd start
volume作成テスト
cinderコマンドで実際に"cinder-volumes"からボリュームを切り出してみる。
ボリューム作成時のステータスは"creating"->"available"に変化する。
ボリューム削除時のステータスは"available"->"deleting"に変化する。
完全に削除されたボリュームはリストから消える。
- 1.ボリュームリストを確認する。
$ cinder list <空>
- 2.1GBのボリューム"test"を切り出す。
$ cinder create --display_name test 1 +---------------------+--------------------------------------+ | Property | Value | +---------------------+--------------------------------------+ | attachments | [] | | availability_zone | nova | | created_at | 2012-11-22T17:08:56.233162 | | display_description | None | | display_name | test | | id | 20c55922-6715-455c-b251-cc192c880922 | | metadata | {} | | size | 1 | | snapshot_id | None | | status | creating | | volume_type | None | +---------------------+--------------------------------------+
- 3.ボリュームリスト確認
$ cinder list +--------------------------------------+-----------+--------------+------+-------------+-------------+ | ID | Status | Display Name | Size | Volume Type | Attached to | +--------------------------------------+-----------+--------------+------+-------------+-------------+ | db818cc7-8540-4edf-a4d4-5a50c12761ac | available | test | 1 | None | | +--------------------------------------+-----------+--------------+------+-------------+-------------+
- 4.ボリューム削除
$ cinder delete test $ cinder list +--------------------------------------+----------+--------------+------+-------------+-------------+ | ID | Status | Display Name | Size | Volume Type | Attached to | +--------------------------------------+----------+--------------+------+-------------+-------------+ | db818cc7-8540-4edf-a4d4-5a50c12761ac | deleting | test | 1 | None | | +--------------------------------------+----------+--------------+------+-------------+-------------+ $ cinder list <空>