OpenStack Train版 简单部署流程(2)- cinder

cinder

controller node

1.条件设置

1.创库授权

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';

2.创建项目和角色

openstack user create --domain default --password cinder123 cinder
openstack role add --project admin --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://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s

2.安装并配置组件

1.安装软件包

yum install openstack-cinder -y

2.Edit the /etc/cinder/cinder.conf file

sed -i '/^\[database\]/a connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a transport_url = rabbit://openstack:RABBIT_PASS@controller' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a auth_strategy = keystone' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a my_ip = 10.1.10.161' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a password = cinder123' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a username = cinder' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a project_name = admin' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a user_domain_name = Default' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a project_domain_name = Default' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a auth_type = password' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a memcached_servers = controller:11211' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a auth_url = http://controller:5000' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a www_authenticate_uri  = http://controller:5000' /etc/cinder/cinder.conf
sed -i '/^\[oslo_concurrency\]/a lock_path = /var/lib/cinder/tmp' /etc/cinder/cinder.conf

3.初始化数据库

su -s /bin/sh -c "cinder-manage db sync" cinder

4.Edit the /etc/nova/nova.conf file

sed -i '/^\[cinder\]/a os_region_name = RegionOne' /etc/nova/nova.conf

5.启动服务

systemctl restart openstack-nova-api.service
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service

(1)code

mysql -u root -p1234qwer
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';
quit
. /root/admin-openrc
openstack user create --domain default --password cinder123 cinder
openstack role add --project admin --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://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s
yum install openstack-cinder -y
sed -i '/^\[database\]/a connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a transport_url = rabbit://openstack:RABBIT_PASS@controller' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a auth_strategy = keystone' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a my_ip = 10.1.10.161' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a password = cinder123' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a username = cinder' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a project_name = admin' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a user_domain_name = Default' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a project_domain_name = Default' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a auth_type = password' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a memcached_servers = controller:11211' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a auth_url = http://controller:5000' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a www_authenticate_uri  = http://controller:5000' /etc/cinder/cinder.conf
sed -i '/^\[oslo_concurrency\]/a lock_path = /var/lib/cinder/tmp' /etc/cinder/cinder.conf
su -s /bin/sh -c "cinder-manage db sync" cinder
sed -i '/^\[cinder\]/a os_region_name = RegionOne' /etc/nova/nova.conf
systemctl restart openstack-nova-api.service
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service

storage node

1.安装并配置组件

1.创建卷

yum install lvm2 device-mapper-persistent-data -y
systemctl enable lvm2-lvmetad.service
systemctl restart lvm2-lvmetad.service
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb

只有实例可以访问块存储卷组。但是,底层的操作系统管理着与这些卷相关联的设备。默认情况下,LVM卷扫描工具会扫描``/dev`` 目录,查找包含卷的块存储设备。如果项目在他们的卷上使用了LVM,扫描工具便会在检测到这些卷时尝试缓存它们,这可能会在底层操作系统和项目卷上产生各种问题。所以您必须重新配置LVM,让它扫描仅包含``cinder-volume``卷组的设备。编辑``/etc/lvm/lvm.conf``文件并完成下面的操作:

在``devices``部分,添加一个过滤器,只接受``/dev/sdb``设备,拒绝其他所有设备:

devices {
...
filter = [ "a/sdb/", "r/.*/"]

每个过滤器组中的元素都以``a``开头,即为 accept,或以 r 开头,即为**reject**,并且包括一个设备名称的正则表达式规则。过滤器组必须以``r/.*/``结束,过滤所有保留设备。您可以使用 :命令:`vgs -vvvv` 来测试过滤器。

警告

如果您的存储节点在操作系统磁盘上使用了 LVM,您还必需添加相关的设备到过滤器中。例如,如果 /dev/sda 设备包含操作系统:

filter = [ "a/sda/", "a/sdb/", "r/.*/"]

类似地,如果您的计算节点在操作系统磁盘上使用了 LVM,您也必需修改这些节点上 /etc/lvm/lvm.conf 文件中的过滤器,将操作系统磁盘包含到过滤器中。例如,如果``/dev/sda`` 设备包含操作系统:

filter = [ "a/sda/", "r/.*/"]

2.安装软件包

yum install openstack-cinder targetcli python-keystone -y

3.Edit the /etc/cinder/cinder.conf file

sed -i '/^\[database\]/a connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a transport_url = rabbit://openstack:RABBIT_PASS@controller' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a auth_strategy = keystone' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a my_ip = 10.1.10.161' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a password = cinder123' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a username = cinder' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a project_name = admin' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a user_domain_name = Default' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a project_domain_name = Default' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a auth_type = password' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a memcached_servers = controller:11211' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a auth_url = http://controller:5000' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a www_authenticate_uri  = http://controller:5000' /etc/cinder/cinder.conf
sed -i '/^\[oslo_concurrency\]/a lock_path = /var/lib/cinder/tmp' /etc/cinder/cinder.conf
echo '[lvm]' >> /etc/cinder/cinder.conf
sed -i '/^\[lvm\]/a iscsi_helper = lioadm' /etc/cinder/cinder.conf
sed -i '/^\[lvm\]/a iscsi_protocol = iscsi' /etc/cinder/cinder.conf
sed -i '/^\[lvm\]/a volume_group = cinder-volumes' /etc/cinder/cinder.conf
sed -i '/^\[lvm\]/a volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a enabled_backends = lvm' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a glance_api_servers = http://controller:9292' /etc/cinder/cinder.conf

4.启动服务

systemctl enable openstack-cinder-volume.service target.service
systemctl restart openstack-cinder-volume.service target.service

(2)code

yum install lvm2 device-mapper-persistent-data -y
systemctl enable lvm2-lvmetad.service
systemctl restart lvm2-lvmetad.service
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb

yum install openstack-cinder targetcli python-keystone -y
sed -i '/^\[database\]/a connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a transport_url = rabbit://openstack:RABBIT_PASS@controller' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a auth_strategy = keystone' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a my_ip = 10.1.10.161' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a password = cinder123' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a username = cinder' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a project_name = admin' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a user_domain_name = Default' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a project_domain_name = Default' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a auth_type = password' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a memcached_servers = controller:11211' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a auth_url = http://controller:5000' /etc/cinder/cinder.conf
sed -i '/^\[keystone_authtoken\]/a www_authenticate_uri  = http://controller:5000' /etc/cinder/cinder.conf
sed -i '/^\[oslo_concurrency\]/a lock_path = /var/lib/cinder/tmp' /etc/cinder/cinder.conf
echo '[lvm]' >> /etc/cinder/cinder.conf
sed -i '/^\[lvm\]/a iscsi_helper = lioadm' /etc/cinder/cinder.conf
sed -i '/^\[lvm\]/a iscsi_protocol = iscsi' /etc/cinder/cinder.conf
sed -i '/^\[lvm\]/a volume_group = cinder-volumes' /etc/cinder/cinder.conf
sed -i '/^\[lvm\]/a volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a enabled_backends = lvm' /etc/cinder/cinder.conf
sed -i '/^\[DEFAULT\]/a glance_api_servers = http://controller:9292' /etc/cinder/cinder.conf
systemctl enable openstack-cinder-volume.service target.service
systemctl restart openstack-cinder-volume.service target.service

 

##云硬盘创建实例超时报错

did not finish being created even after we waited 189 seconds or 61 attempts. And its status is downloading

解决方法

修改计算节点nova.conf的下面两个参数

block_device_allocate_retries=1000
block_device_allocate_retries_interval=10

 

posted @ 2019-12-25 18:16  chili7  阅读(1370)  评论(0编辑  收藏  举报