Block Storage Service(Cinder):
Cinder存储服务(控制节点)安装:
创建用户(cinder)
openstack user create --domain default --password-prompt cinder
将用户cinder关联至租户(项目service)和role上:
openstack role add --project service --user cinder admin
创建cinder服务实体:
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
注:块设备存储服务要求两个服务实体
创建cinder服务 API 端点(endpoint):
openstack endpoint create --region RegionOne volumev2 public http://con.colinshi.top:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://con.colinshi.top:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://con.colinshi.top:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 public http://con.colinshi.top:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://con.colinshi.top:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://con.colinshi.top:8776/v3/%\(project_id\)s
注:块设备存储服务每个服务实体都需要端点。
创建cinder数据库并配置访问权限:
安装cinder服务:
yum install openstack-cinder
编辑配置文件/etc/cinder/cinder.conf:
[DEFAULT]
auth_strategy = keystone
transport_url = rabbit://rabbit:rabbit@con.colinshi.top
my_ip = 10.0.0.51
[database]
connection = mysql+pymysql://root:123456@con.colinshi.top/cinder
[keystone_authtoken]
auth_uri = http://con.colinshi.top:5000
auth_url = http://con.colinshi.top:35357
memcached_servers = con.colinshi.top:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
初始化cinder服务的数据库:
su -s /bin/sh -c "cinder-manage db sync" cinder
编辑配置文件/etc/nova/nova.conf:
[cinder]
os_region_name = RegionOne
重启NOVA-API服务
systemctl restart openstack-nova-api.service
启动Cinder服务,并将其配置为开机自启:
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
存储节点:
安装Cinder包:
yum install lvm2 device-mapper-persistent-data openstack-cinder targetcli python-keystone
创建LVM物理卷/dev/sdb(存储节点上提供多个物理硬盘,sda为系统,sdb提供物理卷服务)
pvcreate /dev/sdb
创建LVM卷组cinder-volumes
vgcreate cinder-volumes /dev/sdb
编辑配置文件/etc/lvm/lvm.conf:
devices {
filter = [ "a/sdb/", "r/.*/"]
注: "a/sdb/"表示允许访问/sdb,"r/.*/"表示禁止其他所的
编辑配置文件/etc/cinder/cinder.conf:
[DEFAULT]
auth_strategy = keystone
transport_url = rabbit://rabbit:rabbit@con.colinshi.top
my_ip = 10.0.0.52
enabled_backends = lvm
glance_api_servers = http://con.colinshi.top:9292
[database]
connection = mysql+pymysql://root:123456@con.colinshi.top/cinder
[keystone_authtoken]
auth_uri = http://con.colinshi.top:5000
auth_url = http://con.colinshi.top:35357
memcached_servers = con.colinshi.top:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
启动Cinder服务,并将其配置为开机自启:
systemctl enable lvm2-lvmetad.service openstack-cinder-volume.service target.service
systemctl start lvm2-lvmetad.service openstack-cinder-volume.service target.service
验证操作:
列出服务组件以验证是否每个进程都成功启动:
cinder service-list
其他问题:
如果这样配置完成,实际启动卷的时候会发生错误。
经检查,应该存储节点/usr/lib/systemd/system/openstack-cinder-volume.service启动脚本中的一个配置文件的问题:
ExecStart=/usr/bin/cinder-volume --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/volume.log
启动脚本调用/usr/share/cinder/cinder-dist.conf这个配置文件其中有一行定义了volumes_dir:
#volumes_dir = /etc/cinder/volumes
注释掉即可。
这个组件安装后可以提供volumes服务。