なにかの技術メモ置き場

なにかの技術メモ置き場

@インフラエンジニア

OpenStack環境構築 part24

Install and configure controller node / Install and configure a storage nodes

コントローラノードにストレージノードを共存させる構成とする。
両ノードを分離させる構成にしたい場合は、公式ドキュメントを参照のこと。

Prerequisites

コントローラノード要件の設定。

mysql -u root -p
ROOT_DBPASS
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'CINDER_DBPASS';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'CINDER_DBPASS';
exit
. admin-openrc
openstack user create --domain default --password CINDER_PASS cinder
openstack role add --project service --user cinder admin
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
openstack endpoint create --region RegionOne volumev2 public http://ctr01:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://ctr01:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://ctr01:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 public http://ctr01:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://ctr01:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://ctr01:8776/v3/%\(project_id\)s

ストレージノード要件の設定。

dnf -y install nfs-utils

Install and configure components

コントローラノード、ストレージノード要件の設定。
dnf -y install openstack-cinder

ストレージノード要件の設定。

dnf -y install python3-keystone

※すでにインストール済みかもしれない

コントローラノード、ストレージノード要件をマージしてコンフィグを作成する。

cp -p /etc/cinder/cinder.conf{,_org}
ls -l /etc/cinder/cinder.conf{,_org}
cat << EOF > /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@ctr01
auth_strategy = keystone
my_ip = 172.16.0.206
glance_api_servers = http://ctr01:9292
enabled_backends = nfs
backup_driver = cinder.backup.drivers.swift.SwiftBackupDriver
backup_swift_url = SWIFT_URL

[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@ctr01/cinder

[keystone_authtoken]
www_authenticate_uri = http://ctr01:5000
auth_url = http://ctr01:5000
memcached_servers = ctr01:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS

[oslo_concurrency]
lock_path = /var/lib/cinder/tmp

[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = $state_path/mnt
EOF
cat /etc/cinder/cinder.conf
su -s /bin/sh -c "cinder-manage db sync" cinder
cat << EOF > /etc/cinder/nfs_shares
file01:/var/lib/nfs-share
EOF
cat /etc/cinder/nfs_shares
chmod 640 /etc/cinder/nfs_shares
chgrp cinder /etc/cinder/nfs_shares
ls -l /etc/cinder/nfs_shares

※file01はNFSサーバ、/var/lib/nfs-sahareはそのNFS共有領域。NFSサーバは構築済みとする。

Configure Compute to use Block Storage

cp -p /etc/nova/nova.conf{,_add_cinder}
ls -l /etc/nova/nova.conf*
cat << EOF >> /etc/nova/nova.conf

[cinder]
os_region_name = RegionOne
EOF
diff /etc/nova/nova.conf{,_add_cinder}
cat /etc/nova/nova.conf

Finalize installation

コントローラノード要件の設定。

systemctl restart openstack-nova-api.service
systemctl enable --now openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl is-active openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl is-enabled openstack-cinder-api.service openstack-cinder-scheduler.service

コントローラノードでCinderのバックアップサービス(オプション)を利用する場合の設定。

systemctl enable --now openstack-cinder-backup.service
systemctl is-active openstack-cinder-backup.service
systemctl is-enabled openstack-cinder-backup.service

ストレージノード要件の設定。

systemctl enable --now openstack-cinder-volume.service target.service
systemctl is-active openstack-cinder-volume.service target.service
systemctl is-enabled openstack-cinder-volume.service target.service

Verify Cinder operation

. admin-openrc
openstack volume service list

コンピュートノードに対する設定

NFSマウントのために以下の設定を行う。

dnf -y install nfs-utils