openstack cinder lvm配置

gokeibi 2019-10-30

openstack cinder lvm配置

############
yum install lvm2 -y
systemctl enable lvm2-lvmetad.service
systemctl restart lvm2-lvmetad.service   


yes |pvcreate /dev/sdb
yes |vgcreate vg_sdb /dev/sdb

\cp -f /etc/lvm/lvm.conf{,.bak}

####如果系统是lvm分区 sda
sed -i ‘/devices {/ a filter = [ "a/sda/","a/sdb/", "r/.*/"]‘ /etc/lvm/lvm.conf 
grep ‘devices {‘ -C 3 /etc/lvm/lvm.conf



##
yum install openstack-cinder targetcli python-oslo-policy -y


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

echo "
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = vg_sdb
iscsi_protocol = iscsi
iscsi_helper = lioadm
volume_backend_name = lvm 
" >>/etc/cinder/cinder.conf
tail /etc/cinder/cinder.conf

[ $(grep -c ‘^enabled_backends‘ /etc/cinder/cinder.conf) -eq 0 ] && sed -i ‘s/\[DEFAULT\]/ a enabled_backends=lvm/g‘ /etc/cinder/cinder.conf || sed -i ‘s/^enabled_backends.*=/enabled_backends=lvm,/g‘ /etc/cinder/cinder.conf

grep enabled_backends /etc/cinder/cinder.conf


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

相关推荐