cinder 后端存储2种方式结合,nfs+lvm
###1.pre
新增10.0.0.35 虚机,作为nfs存储服务器
###2.计算节点挂载
[root@compute01 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 8.6G 0 8.6G 0% /dev
tmpfs tmpfs 8.6G 0 8.6G 0% /dev/shm
tmpfs tmpfs 8.6G 177M 8.4G 3% /run
tmpfs tmpfs 8.6G 0 8.6G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 80G 2.5G 78G 4% /
/dev/vda1 xfs 1014M 194M 821M 20% /boot
/dev/mapper/centos-home xfs 8.0G 33M 8.0G 1% /home
tmpfs tmpfs 1.8G 0 1.8G 0% /run/user/0
10.0.0.35:/data/nfs nfs4 160G 1.5G 159G 1% /etc/cinder/nfs_mnt
###3.. 编辑/etc/cinder/cinder,conf 新增nfs配置
[root@compute01 ~]# egrep -v "^$|^#" /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:password@controller
auth_strategy = keystone
my_ip = 10.0.0.41
enabled_backends = lvm,nfs
glance_api_servers = http://controller:9292
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = lioadm
[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = $state_path/mnt
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[nova]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault]
###4.重启cinder服务
systemctl restart openstack-cinder-volume
systemctl restart openstack-nova-compute
###5.验证
[root@controller cinder(keystone)]# openstack volume service list
+------------------+---------------+------+---------+-------+----------------------------+
| Binary | Host | Zone | Status | State | Updated At |
+------------------+---------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller | nova | enabled | up | 2020-08-21T06:26:10.000000 |
| cinder-volume | compute01@lvm | nova | enabled | up | 2020-08-21T06:25:58.000000 |
| cinder-volume | compute01@nfs | nova | enabled | up | 2020-08-21T06:25:59.000000 |
+------------------+---------------+------+---------+-------+----------------------------+
###6。
[root@controller ~(keystone)]# openstack volume type create lvm
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| description | None |
| id | d322cd9e-f167-4cc4-9c36-0056a971c5b7 |
| is_public | True |
| name | lvm |
+-------------+--------------------------------------+
[root@controller ~(keystone)]# openstack volume type create nfs
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| description | None |
| id | 294bdeac-9b5d-4b7c-b23d-b82557a113e6 |
| is_public | True |
| name | nfs |
+-------------+--------------------------------------+
[root@controller ~(keystone)]# openstack volume type list
+--------------------------------------+-------------+-----------+
| ID | Name | Is Public |
+--------------------------------------+-------------+-----------+
| 294bdeac-9b5d-4b7c-b23d-b82557a113e6 | nfs | True |
| d322cd9e-f167-4cc4-9c36-0056a971c5b7 | lvm | True |
| b731e51e-c830-48c6-b838-0880f7a2a0b4 | __DEFAULT__ | True |
+--------------------------------------+-------------+-----------+
[root@controller ~(keystone)]# openstack volume create --type lvm --size 5 disk_lvm
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2020-08-21T06:30:55.000000 |
| description | None |
| encrypted | False |
| id | c6299e72-438f-4545-82df-79875b3bc8e3 |
| migration_status | None |
| multiattach | False |
| name | disk_lvm |
| properties | |
| replication_status | None |
| size | 5 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | lvm |
| updated_at | None |
| user_id | e8d9593bbed14173a3b5e62d9a3a534b |
+---------------------+--------------------------------------+
[root@controller ~(keystone)]# openstack volume create --type nfs --size 6 disk_nfs
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2020-08-21T06:31:12.000000 |
| description | None |
| encrypted | False |
| id | 5944e0c8-05af-4740-95cb-01dcfc61c3d9 |
| migration_status | None |
| multiattach | False |
| name | disk_nfs |
| properties | |
| replication_status | None |
| size | 5 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | nfs |
| updated_at | None |
| user_id | e8d9593bbed14173a3b5e62d9a3a534b |
+---------------------+--------------------------------------+
[root@controller ~(keystone)]# openstack volume list
+--------------------------------------+----------+-----------+------+-------------+
| ID | Name | Status | Size | Attached to |
+--------------------------------------+----------+-----------+------+-------------+
| 5944e0c8-05af-4740-95cb-01dcfc61c3d9 | disk_nfs | available | 6 | |
| c6299e72-438f-4545-82df-79875b3bc8e3 | disk_lvm | available | 5 | |
| 0f867f82-ed61-4274-a082-ecea829984f2 | disk01 | available | 10 | |
+--------------------------------------+----------+-----------+------+-------------+
[root@controller ~(keystone)]# openstack volume service list
+------------------+---------------+------+---------+-------+----------------------------+
| Binary | Host | Zone | Status | State | Updated At |
+------------------+---------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller | nova | enabled | up | 2020-08-24T02:52:28.000000 |
| cinder-volume | compute01@lvm | nova | enabled | up | 2020-08-24T02:52:28.000000 |
| cinder-volume | compute01@nfs | nova | enabled | up | 2020-08-24T02:52:27.000000 |
| cinder-volume | compute02@lvm | nova | enabled | up | 2020-08-24T02:52:27.000000 |
| cinder-volume | compute02@nfs | nova | enabled | up | 2020-08-24T02:52:27.000000 |
+------------------+---------------+------+---------+-------+----------------------------+
至此,cinder服务,后端存储nfs+lvm都ok!