Openstack Train配置手册-Manila

snow chuai汇总、整理、撰写---2020/3/4


1. 拓扑
     ------------+---------------------------+---------------------------+------------
                 |                           |                           |
             eth0|192.168.10.11          eth0|192.168.10.12          eth0|192.168.10.13
     +-----------+-----------+   +-----------+-----------+   +-----------+-----------+
     |    [ Control Node ]   |   |    [ Compute Node ]   |   |   [ Storage Node ]    |
     |   [node1.1000cc.net]  |   |   [node2.1000cc.net]  |   |  [node3.1000cc.net]   |
     |  MariaDB    RabbitMQ  |   |         ibvirt        |   |      Open vSwitch     |
     |  Memcached  httpd     |   |       Nova Compute    |   |        L2 Agent       |
     |  Keystone   Glance    |   |       Open vSwitch    |   |        L3 Agent       |
     |  Nova API             |   |        L2 Agent       |   |     Metadata Agent    |
     |  Neutron Server       |   |                       |   |      Manila Share     |
     |  Metadata Agent       |   |                       |   |                       |
     |  Manila API           |   |                       |   |                       |
     +-----------------------+   +-----------------------+   +-----------------------+
2. 在控制节点设置Manila
2.1 设定keystone信息及endpoint
1) 创建服务及设定相关账户等信息
[root@node1 ~(keystone)]# openstack user create --domain default --project service --password servicepassword manila
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | 7972f61f4a1c4f2592d2bb6dc7711e81 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | bbeca1715af748158a043a8c30b82d17 |
| name                | manila                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@node1 ~(keystone)]# openstack role add --project service --user manila admin
[root@node1 ~(keystone)]# openstack service create --name manila --description "OpenStack Shared Filesystem" share +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Shared Filesystem | | enabled | True | | id | b021e23875b04747b2ab13938883a3f1 | | name | manila | | type | share | +-------------+----------------------------------+
[root@node1 ~(keystone)]# openstack service create --name manilav2 --description "OpenStack Shared Filesystem V2" sharev2 +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Shared Filesystem V2 | | enabled | True | | id | b047c7dfe11944cc86f5575bd7672816 | | name | manilav2 | | type | sharev2 | +-------------+----------------------------------+
2) 设定endpoint信息 [root@node1 ~(keystone)]# openstack endpoint create --region RegionOne share public http://192.168.10.11:8786/v1/%\(tenant_id\)s +--------------+--------------------------------------------+ | Field | Value | +--------------+--------------------------------------------+ | enabled | True | | id | 965cf29bde71446c91c19010f0491e67 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | b021e23875b04747b2ab13938883a3f1 | | service_name | manila | | service_type | share | | url | http://192.168.10.11:8786/v1/%(tenant_id)s | +--------------+--------------------------------------------+
[root@node1 ~(keystone)]# openstack endpoint create --region RegionOne share internal http://192.168.10.11:8786/v1/%\(tenant_id\)s +--------------+--------------------------------------------+ | Field | Value | +--------------+--------------------------------------------+ | enabled | True | | id | f25b04fd9367478ea5e97b0c0c98faeb | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | b021e23875b04747b2ab13938883a3f1 | | service_name | manila | | service_type | share | | url | http://192.168.10.11:8786/v1/%(tenant_id)s | +--------------+--------------------------------------------+
[root@node1 ~(keystone)]# openstack endpoint create --region RegionOne share admin http://192.168.10.11:8786/v1/%\(tenant_id\)s +--------------+--------------------------------------------+ | Field | Value | +--------------+--------------------------------------------+ | enabled | True | | id | 92eacba2803b4a6a9ef3abd87b035bfc | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | b021e23875b04747b2ab13938883a3f1 | | service_name | manila | | service_type | share | | url | http://192.168.10.11:8786/v1/%(tenant_id)s | +--------------+--------------------------------------------+
[root@node1 ~(keystone)]# openstack endpoint create --region RegionOne sharev2 public http://192.168.10.11:8786/v2/%\(tenant_id\)s +--------------+--------------------------------------------+ | Field | Value | +--------------+--------------------------------------------+ | enabled | True | | id | f190cddf2e714c2cb8d627dd5242db3d | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | b047c7dfe11944cc86f5575bd7672816 | | service_name | manilav2 | | service_type | sharev2 | | url | http://192.168.10.11:8786/v2/%(tenant_id)s | +--------------+--------------------------------------------+
[root@node1 ~(keystone)]# openstack endpoint create --region RegionOne sharev2 internal http://192.168.10.11:8786/v2/%\(tenant_id\)s +--------------+--------------------------------------------+ | Field | Value | +--------------+--------------------------------------------+ | enabled | True | | id | 79febd274ae24df59abb4b2a0606010e | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | b047c7dfe11944cc86f5575bd7672816 | | service_name | manilav2 | | service_type | sharev2 | | url | http://192.168.10.11:8786/v2/%(tenant_id)s | +--------------+--------------------------------------------+
[root@node1 ~(keystone)]# openstack endpoint create --region RegionOne sharev2 admin http://192.168.10.11:8786/v2/%\(tenant_id\)s +--------------+--------------------------------------------+ | Field | Value | +--------------+--------------------------------------------+ | enabled | True | | id | bb192783d1be441790dd3a6607797aa8 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | b047c7dfe11944cc86f5575bd7672816 | | service_name | manilav2 | | service_type | sharev2 | | url | http://192.168.10.11:8786/v2/%(tenant_id)s | +--------------+--------------------------------------------+
2.2 设定数据库
[root@node1 ~(keystone)]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 461
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database manila; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on manila.* to manila@'localhost' identified by 'password'; Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all privileges on manila.* to manila@'%' identified by 'password'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> exit Bye
2.3 安装Manila服务并配置及启动
1) 安装Manila服务
[root@node1 ~(keystone)]# yum --enablerepo=centos-openstack-train,epel install openstack-manila python-manilaclient -y
2) 配置Manila服务 [root@node1 ~(keystone)]# mv /etc/manila/manila.conf /etc/manila/manila.conf.bak [root@node1 ~(keystone)]# vim /etc/manila/manila.conf [DEFAULT] # 设定本机地址 my_ip = 192.168.10.11 api_paste_config = /etc/manila/api-paste.ini rootwrap_config = /etc/manila/rootwrap.conf state_path = /var/lib/manila auth_strategy = keystone default_share_type = default_share_type share_name_template = share-%s
transport_url = rabbit://openstack:password@192.168.10.11
[database] connection = mysql+pymysql://manila:password@192.168.10.11/manila
[keystone_authtoken] www_authenticate_uri = http://192.168.10.11:5000 auth_url = http://192.168.10.11:5000 memcached_servers = 192.168.10.11:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = manila password = servicepassword
[oslo_concurrency] lock_path = $state_path/tmp

[root@node1 ~(keystone)]# chmod 640 /etc/manila/manila.conf [root@node1 ~(keystone)]# chgrp manila /etc/manila/manila.conf [root@node1 ~(keystone)]# su -s /bin/bash manila -c "manila-manage db sync" [root@node1 ~(keystone)]# systemctl enable --now openstack-manila-api openstack-manila-scheduler [root@node1 ~(keystone)]# manila service-list +----+------------------+-----------------+------+---------+-------+----------------------------+ | Id | Binary | Host | Zone | Status | State | Updated_at | +----+------------------+-----------------+------+---------+-------+----------------------------+ | 1 | manila-scheduler |node1.1000cc.net | nova | enabled | up | 2020-03-03T17:48:10.000000 | +----+------------------+-----------------+------+---------+-------+----------------------------+
3) 配置防火墙 [root@node1 ~(keystone)]# firewall-cmd --add-port=8786/tcp --permanent success [root@node1 ~(keystone)]# firewall-cmd --reload success
3. 在存储节点设置Manila
3.1 添加Manila Share到存储节点
[root@node3 ~]# yum --enablerepo=centos-openstack-train,epel install openstack-manila-share python-manilaclient MySQL-python -y
3.2 配置Manila Share服务
[root@node3 ~]# mv /etc/manila/manila.conf /etc/manila/manila.conf.bak
[root@node3 ~]# vim /etc/manila/manila.conf
[DEFAULT]
my_ip = 192.168.10.13
api_paste_config = /etc/manila/api-paste.ini
rootwrap_config = /etc/manila/rootwrap.conf
state_path = /var/lib/manila
auth_strategy = keystone
default_share_type = default_share_type
enabled_share_protocols = NFS,CIFS
transport_url = rabbit://openstack:password@192.168.10.11
[database] connection = mysql+pymysql://manila:password@192.168.10.11/manila
[keystone_authtoken] www_authenticate_uri = http://192.168.10.11:5000 auth_url = http://192.168.10.11:5000 memcached_servers = 192.168.10.11:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = manila password = servicepassword
[oslo_concurrency] lock_path = $state_path/tmp

[root@node3 ~]# chmod 640 /etc/manila/manila.conf [root@node3 ~]# chgrp manila /etc/manila/manila.conf [root@node3 ~]# mkdir /var/lib/manila [root@node3 ~]# chown manila. /var/lib/manila
防火墙设定 [root@node3 ~]# firewall-cmd --add-service=nfs --permanent success [root@node3 ~]# firewall-cmd --reload success
4. 使用本地设备
4.1 配置存储节点
1) 安装必须的软件--nfs-utils
[root@node3 ~]# yum install nfs-utils nfs4-acl-tools -y
2) 分区 [root@node3 ~]# pvcreate /dev/sdc1 Physical volume "/dev/sdc1" successfully created
[root@node3 ~]# vgcreate manila-volumes /dev/sdc1 Volume group "manila-volumes" successfully created
3) 配置manila [root@node3 ~]# vim /etc/manila/manila.conf # 于[default]区段最后追加如下内容 [DEFAULT] ...... ...... ...... ...... ...... ......
enabled_share_backends = lvm
...... ...... ...... ...... ...... ......
# 于文档最后追加如下内容 [lvm] share_backend_name = LVM share_driver = manila.share.drivers.lvm.LVMShareDriver driver_handles_share_servers = False lvm_share_volume_group = manila-volumes lvm_share_export_ips = 192.168.10.113
[root@node3 ~]# systemctl enable --now openstack-manila-share nfs-server
4.2 创建Manila共享文件
1) 与srv1节点创建默认共享类型
[root@srv1 ~(keystone)]# manila type-create default_share_type False
+----------------------+--------------------------------------+
| Property             | Value                                |
+----------------------+--------------------------------------+
| ID                   | ce266b98-e6fc-486a-963b-893be00e7292 |
| Name                 | default_share_type                   |
| Visibility           | public                               |
| is_default           | YES                                  |
| required_extra_specs | driver_handles_share_servers : False |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+
[root@srv1 ~(keystone)]# manila type-list +--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+ | ID | Name | visibility | is_default | required_extra_specs | optional_extra_specs | Description | +--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+ | ce266b98-e6fc-486a-963b-893be00e7292 | default_share_type | public | YES | driver_handles_share_servers : False | | None | +--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
2) 与srv1节点创建MFS共享 [root@srv1 ~(keystone)]# su - snow [snow@srv1 ~(keystone)]$ manila create NFS 1 --name share1 +---------------------------------------+--------------------------------------+ | Property | Value | +---------------------------------------+--------------------------------------+ | id | 6860f4a5-c233-42ae-b63f-a42373b6bf7c | | size | 1 | | availability_zone | None | | created_at | 2020-07-14T18:48:44.000000 | | status | creating | | name | share1 | | description | None | | project_id | 5ab6d526d4c94903be2400a64809f357 | | snapshot_id | None | | share_network_id | None | | share_proto | NFS | | metadata | {} | | share_type | ce266b98-e6fc-486a-963b-893be00e7292 | | is_public | False | | snapshot_support | False | | task_state | None | | share_type_name | default_share_type | | access_rules_status | active | | replication_type | None | | has_replicas | False | | user_id | 0a51bede93764a47a0cde02a5fb1c628 | | create_share_from_snapshot_support | False | | revert_to_snapshot_support | False | | share_group_id | None | | source_share_group_snapshot_member_id | None | | mount_snapshot_support | False | | progress | None | +---------------------------------------+--------------------------------------+q
# 等待数分钟后验证 [snow@srv1 ~(keystone)]$ manila list +--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone | +--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | 6860f4a5-c233-42ae-b63f-a42373b6bf7c | share1 | 1 | NFS | available | False | default_share_type | | nova | +--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+------+-------------------+
3) 让实例使用manila共享文件系统 # 查看当前所运行的实例 [snow@srv1 ~(keystone)]$ openstack server list +--------------------------------------+---------+--------+-----------------------------------------+-------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+---------+--------+-----------------------------------------+-------+----------+ | da1aa5bb-44db-4086-a01b-a7057a633dfb | CentOS8 | ACTIVE | int_net=192.168.188.199, 192.168.10.222 | c8 | m1.small | +--------------------------------------+---------+--------+-----------------------------------------+-------+----------+ [snow@srv1 ~(keystone)]$ openstack server stop CentOS8
[snow@srv1 ~(keystone)]$ openstack server list +--------------------------------------+---------+---------+-----------------------------------------+-------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+---------+---------+-----------------------------------------+-------+----------+ | da1aa5bb-44db-4086-a01b-a7057a633dfb | CentOS8 | SHUTOFF | int_net=192.168.188.199, 192.168.10.222 | c8 | m1.small | +--------------------------------------+---------+---------+-----------------------------------------+-------+----------+
# 授权访问,设定权限为rw [snow@srv1 ~(keystone)]$ manila access-allow share1 ip 192.168.10.0/24 --access-level rw +--------------+--------------------------------------+ | Property | Value | +--------------+--------------------------------------+ | id | 4e855a72-e48c-45d8-b895-d391c7fa0e6f | | share_id | 6860f4a5-c233-42ae-b63f-a42373b6bf7c | | access_level | rw | | access_to | 192.168.10.0/24 | | access_type | ip | | state | queued_to_apply | | access_key | None | | created_at | 2020-07-14T18:51:28.000000 | | updated_at | None | | metadata | {} | +--------------+--------------------------------------+
# 验证访问状态 [snow@srv1 ~(keystone)]$ manila access-list share1 +--------------------------------------+-------------+-----------------+--------------+--------+------------+----------------------------+------------+ | id | access_type | access_to | access_level | state | access_key | created_at | updated_at | +--------------------------------------+-------------+-----------------+--------------+--------+------------+----------------------------+------------+ | 4e855a72-e48c-45d8-b895-d391c7fa0e6f | ip | 192.168.10.0/24 | rw | active | None | 2020-07-14T18:51:28.000000 | None | +--------------------------------------+-------------+-----------------+--------------+--------+------------+----------------------------+------------+
[snow@srv1 ~(keystone)]$ openstack server start CentOS8
# 验证访问路径 [snow@srv1 ~(keystone)]$ manila show share1 | grep path | cut -d'|' -f3 path = 192.168.10.113:/var/lib/manila/mnt/share-e2eabd7a-e578-432d-a212-bbb78f91d41
[snow@srv1 ~(keystone)]$ ssh centos@192.168.10.252 Last login: Mon Jun 8 03:57:42 2020 from 192.168.10.252
[centos@centos-7 ~]$ sudo mount -t nfs \ 192.168.10.13:/var/lib/manila/mnt/share-3544d5a3-7157-4c10-aaa3-edd4b6fd2512 /mnt
[centos@centos-7 ~]$ df -hT | grep /mnt 192.168.10.13:/var/lib/manila/mnt/share-3544d5a3-7157-4c10-aaa3-edd4b6fd2512 nfs4 9.8G 36M 9.3G 1% /mnt
5. 使用Manila(实例)
5.1 配置存储节点
1) 先完成Cinder节点的配置,配置好任何一个存储类型即可(LVM/NFS)并启动服务。
2) 编写Manila配置文件 [root@node3 ~]# vim /etc/manila/manila.conf ...... ...... # 于[DEFAULT] 添加如下信息 enabled_share_backends = generic enabled_share_backends = generic
删除[LVM]区段
# 于最近最后添加如下信息 [neutron] url = http://192.168.10.11:9696 auth_url = http://192.168.10.11:5000 memcached_servers = 192.168.10.11:11211 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = servicepassword
[nova] auth_url = http://192.168.10.11:5000 memcached_servers = 192.168.10.11:11211 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = servicepassword
[cinder] auth_url = http://192.168.10.11:5000 memcached_servers = 192.168.10.11:11211 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = cinder password = servicepassword
[generic] share_backend_name = backend01 share_driver = manila.share.drivers.generic.GenericShareDriver interface_driver = manila.network.linux.interface.OVSInterfaceDriver driver_handles_share_servers = True service_instance_flavor_id = 0 service_instance_security_group = manila-service service_image_name = manila-service-image service_instance_user = manila service_instance_password = manila service_network_cidr = 10.254.0.0/16 service_network_division_mask = 24

[root@node3 ~]# systemctl enable --now openstack-manila-share
5.2 在控制节点建立Manila Share及设定相关信息
1) 下载manila镜像
[root@node1 ~(keystone)]# curl -O http://tarballs.openstack.org/manila-image-elements/images/manila-service-image-master.qcow2
2) 将manila镜像注册到glance中 [root@node1 ~(keystone)]# openstack image create "manila-service-image" \ --file manila-service-image-master.qcow2 \ --disk-format qcow2 \ --container-format bare \ --public +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | checksum | f8a6cbff57ee1f91e05e576d88057dbe | | container_format | bare | | created_at | 2020-03-03T18:22:14Z | | disk_format | qcow2 | | file | /v2/images/8de72d61-2910-4f6f-b191-b33c44d116e5/file | | id | 8de72d61-2910-4f6f-b191-b33c44d116e5 | | min_disk | 0 | | min_ram | 0 | | name | manila-service-image | | owner | 558ed85c8f84439a876cfd35150d0fe1 | | protected | os_hash_algo='sha512', os_hash_value='ff7...... | | schema | /v2/schemas/image | | size | 441342976 | | status | active | | tags | | | updated_at | 2020-03-03T18:22:24Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+
3) 设定Manila安全组 [root@node1 ~(keystone)]# openstack security group create manila-service +-----------------+----------------------------------------+ | Field | Value | +-----------------+----------------------------------------+ | created_at | 2020-03-03T18:24:49Z | | description | manila-service | | id | a2b939ef-7def-4468-ba2b-336f6e69a5eb | | location | cloud='', project.domain_id=, ...... | | name | manila-service | | project_id | 558ed85c8f84439a876cfd35150d0fe1 | | revision_number | 1 | | rules | created_at='2020-03-03T18:24:49Z',... | | | created_at='2020-03-03T18:24:49Z', ... | | updated_at | 2020-03-03T18:24:49Z | +-----------------+----------------------------------------+
root@node1 ~(keystone)# openstack security group rule create --protocol icmp --ingress manila-service root@node1 ~(keystone)# openstack security group rule create --protocol tcp --dst-port 22:22 manila-service root@node1 ~(keystone)# openstack security group rule create --protocol tcp --dst-port 2049:2049 manila-service
4) 创建Manila类型 # 先删除原有的共享磁盘和类型 [root@node1 ~(keystone)]# manila type-list [root@node1 ~(keystone)]# manila type-delete $share_id
[root@node1 ~(keystone)]# manila type-create default_share_type True +----------------------+--------------------------------------+ | Property | Value | +----------------------+--------------------------------------+ | required_extra_specs | driver_handles_share_servers : True | | Name | default_share_type | | Visibility | public | | is_default | YES | | ID | c33692c0-881c-492c-8777-3c606a228c33 | | optional_extra_specs | | | Description | None | +----------------------+--------------------------------------+
[root@node1 ~(keystone)]# manila type-list +-----------+--------------------+------------+------------+-------------------------------------+- | ID | Name | visibility | is_default | required_extra_specs | +-----------+--------------------+------------+------------+-------------------------------------+- | c33692c0- | default_share_type | public | YES | driver_handles_share_servers : True | +-----------+--------------------+------------+------------+-------------------------------------+-
5) 创建Manila网络 [root@node1 ~(keystone)]# su - snow [snow@node1 ~(keystone)]$ openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | def89ce3-f965-4f26-a179-eb731878b79a | ext_net | d5092c09-259e-415f-90f0-834a525f9c0e | | fab0c6a1-5aea-470c-a39b-55dd9c34da19 | int_net | a93b513a-da35-4ce0-99e4-a80fd97fd907 | +--------------------------------------+---------+--------------------------------------+
[snow@node1 ~(keystone)]$ openstack subnet list +----------------------+---------+--------------------------------------+------------------+ | ID | Name | Network | Subnet | +----------------------+---------+--------------------------------------+------------------+ | a93b513a-da35-...... | subnet1 | fab0c6a1-5aea-470c-a39b-55dd9c34da19 | 192.168.188.0/24 | +----------------------+---------+--------------------------------------+------------------+
[snow@node1 ~(keystone)]$ INT_NET=$(openstack network list | grep 'int_net' | awk '{print $2}') [snow@node1 ~(keystone)]$ INT_SUBNET=$(openstack subnet list | grep 'subnet1' | awk '{print $2}')
[snow@node1 ~(keystone)]$ manila share-network-create --neutron-net-id $INT_NET --neutron-subnet-id $INT_SUBNET --name manila_share +-----------------------+--------------------------------------------+ | Property | Value | +-----------------------+--------------------------------------------+ | description | None | | name | manila_share | | share_network_subnets | [{u'availability_zone': None, u'neutron_...| | created_at | 2020-03-03T18:32:43.000000 | | project_id | 70e9c932884544eea84190f7fb42f9f6 | | updated_at | None | | id | 11703cf3-5e95-4bcc-baee-26e9142b8694 | +-----------------------+--------------------------------------------+
[snow@node1 ~(keystone)]$ manila share-network-list +--------------------------------------+--------------+ | id | name | +--------------------------------------+--------------+ | 11703cf3-5e95-4bcc-baee-26e9142b8694 | manila_share | +--------------------------------------+--------------+
6) 使用Manila [snow@node1 ~(keystone)]$ manila create NFS 1 --name share01 --share-network manila_share +---------------------------------------+--------------------------------------+ | Property | Value | +---------------------------------------+--------------------------------------+ | status | creating | | share_type_name | default_share_type | | description | None | | availability_zone | None | | share_network_id | 11703cf3-5e95-4bcc-baee-26e9142b8694 | | share_group_id | None | | revert_to_snapshot_support | False | | access_rules_status | active | | snapshot_id | None | | create_share_from_snapshot_support | False | | is_public | False | | task_state | None | | snapshot_support | False | | id | 8ab522f5-dff6-4124-a582-7fee3b3fc414 | | size | 1 | | source_share_group_snapshot_member_id | None | | user_id | d3a4d7927ebd4dfb8b6fa00d11f778f0 | | name | share01 | | share_type | c33692c0-881c-492c-8777-3c606a228c33 | | has_replicas | False | | replication_type | None | | created_at | 2020-03-03T18:35:12.000000 | | share_proto | NFS | | mount_snapshot_support | False | | project_id | 70e9c932884544eea84190f7fb42f9f6 | | metadata | {} | +---------------------------------------+--------------------------------------+
[cent@node1 ~(keystone)]$ manila list +---------+---------+------+-------------+-----------+-----------+--------------------+------+---------+ | ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Avai... | +---------+---------+------+-------------+-----------+-----------+--------------------+------+---------+ | 8ab5... | share01 | 1 | NFS | available | False | default_share_type | | nova | +---------+---------+------+-------------+-----------+-----------+--------------------+------+---------+
7) Manila在存储节点建立了一个10.254.0.0/28的网络段 [root@node3 ~]# ip addr ..... ..... 15: tap21b6020e-e0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 link/ether fa:16:3e:56:3b:b7 brd ff:ff:ff:ff:ff:ff inet 10.254.0.169/24 brd 10.254.0.255 scope global tap21b6020e-e0 valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:fe56:3bb7/64 scope link valid_lft forever preferred_lft forever
8) Manila连接实例 (1) 确认实例 [snow@node1 ~(keystone)]$ openstack server list +-----------+------+---------+---------------------------------------+---------+----------+ | ID | Name | Status | Networks | Image | Flavor | +-----------+------+---------+---------------------------------------+---------+----------+ | 48534705- | c7 | ACTIVE |int_net=192.168.188.70, 192.168.10.221 | c77 | m1.small | +-----------+------+---------+---------------------------------------+---------+----------+
(2) 允许192.168.188.0/24网络段访问存储 [snow@node1 ~(keystone)]$ manila access-allow share01 ip 192.168.188.0/24 --access-level rw +--------------+--------------------------------------+ | Property | Value | +--------------+--------------------------------------+ | access_key | None | | share_id | 8ab522f5-dff6-4124-a582-7fee3b3fc414 | | created_at | 2020-03-03T18:39:50.000000 | | updated_at | None | | access_type | ip | | access_to | 192.168.188.0/24 | | access_level | rw | | state | queued_to_apply | | id | 51e1faa9-ffa0-496d-93c8-7510e0351b81 | | metadata | {} | +--------------+--------------------------------------+
# 确认权限 [snow@node1 ~(keystone)]$ manila access-list share01 +---------+-------------+-----------------+--------------+--------+------------+-------------------- | id | access_type | access_to | access_level | state | access_key | created_at...... +---------+-------------+-----------------+--------------+--------+------------+------------------- | 51e1... | ip | 192.168.188.0/24 | rw | active | None | 2020-03-...... +---------+-------------+------------------+--------------+--------+--------------------------------
# 启动实例 [snow@node1 ~(keystone)]$ openstack server start c7
9) 挂载Manila存储 # 查看访问路径 [snow@node1 ~(keystone)]$ manila show share01 | grep path | cut -d'|' -f3 path = 10.254.0.141:/shares/share-c778342a-ef17-4b02-82b7-6eb372a92e6d
[snow@srv1 ~(keystone)]$ ssh centos@192.168.10.221 [centos@c7 ~]$ sudo mount -t nfs \ 10.254.0.141:/shares/share-c778342a-ef17-4b02-82b7-6eb372a92e6d \ /mnt
[centos@c7 ~]$ df -Th | grep /mnt 10.254.0.141:/shares/share-c778342a-ef17-4b02-82b7-6eb372a92e6d nfs4 976M 1.3M 908M 1% /mnt
# 如果挂载超时,可在租户的安全组中增加nfs访问规则 [snow@srv1 ~(keystone)]$ openstack security group rule create --protocol tcp --dst-port 2049:2049 secgroup1

 

如对您有帮助,请随缘打个赏。^-^

gold