openstack-rocky安装部署-09安装manila

manila,为虚拟机提供文件存储。共享文件系统服务提供了管理和配置文件共享的抽象。该服务还支持管理共享类型以及在驱动程序支持快照时共享快照


manila-api
#一种WSGI应用程序,用于对共享文件系统服务的请求进行身份验证和路由

manila-data
#一种独立服务,其目的是处理数据操作,如复制,共享迁移或备份

manila-scheduler
#安排并将请求路由到适当的共享服务。调度程序使用可配置的过滤器和称重器来路由请求。过滤器计划程序是默认设置,可以对后端的各种属性(例如,容量,可用区和其他功能)启用过滤器

manila-share
#管理提供共享文件系统的后端设备。马尼拉共享服务通过使用共享后端驱动程序作为接口与后端设备进行通信。共享驱动程序可以以两种模式之一操作,无论是否处理共享服务器。共享服务器通过共享网络导出文件共享。共享服务器不由共享文件系统服务中的驱动程序管理时,应在共享文件系统服务的带外处理网络要求


mq
#在共享文件系统进程之间路由信息

 

控制节点执行:

先决条件

创建manila数据库并授权

mysql -u root -p123

CREATE DATABASE manila;

GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'localhost' \
  IDENTIFIED BY '123';
GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'%' \
  IDENTIFIED BY '123';

  

#创建manila用户:
openstack user create --domain default --password-prompt manila
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 9bc5447e09584227b96c806f257a7b1a |
| name                | manila                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

#将admin角色添加到manila用户:
openstack role add --project service --user manila admin

#创建manila和manilav2服务实体:

openstack service create --name manila \
  --description "OpenStack Shared File Systems" share

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Shared File Systems    |
| enabled     | True                             |
| id          | d3d20f869eab4ac580cf4689386e490a |
| name        | manila                           |
| type        | share                            |
+-------------+----------------------------------+
openstack service create --name manilav2 \
  --description "OpenStack Shared File Systems V2" sharev2

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Shared File Systems V2 |
| enabled     | True                             |
| id          | 3f27da0033bc4773afc9bd62cd66a3f1 |
| name        | manilav2                         |
| type        | sharev2                          |
+-------------+----------------------------------+

#创建共享文件系统服务API端点:

openstack endpoint create --region RegionOne \
  share public http://controller:8786/v1/%\(tenant_id\)s


openstack endpoint create --region RegionOne \
  share internal http://controller:8786/v1/%\(tenant_id\)s


openstack endpoint create --region RegionOne \
  share admin http://controller:8786/v1/%\(tenant_id\)s


+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 48edb4c463d146eba804b4761d829c1d        |
| interface    | public                                  |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | d3d20f869eab4ac580cf4689386e490a        |
| service_name | manila                                  |
| service_type | share                                   |
| url          | http://controller:8786/v1/%(tenant_id)s |
+--------------+-----------------------------------------+

+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 61b3b835c37a48e1b43d3b1045deb57e        |
| interface    | internal                                |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | d3d20f869eab4ac580cf4689386e490a        |
| service_name | manila                                  |
| service_type | share                                   |
| url          | http://controller:8786/v1/%(tenant_id)s |
+--------------+-----------------------------------------+

+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 117d7569e8484eb7a87d0643a2571fba        |
| interface    | admin                                   |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | d3d20f869eab4ac580cf4689386e490a        |
| service_name | manila                                  |
| service_type | share                                   |
| url          | http://controller:8786/v1/%(tenant_id)s |
+--------------+-----------------------------------------+






openstack endpoint create --region RegionOne \
  sharev2 public http://controller:8786/v2/%\(tenant_id\)s

openstack endpoint create --region RegionOne \
  sharev2 internal http://controller:8786/v2/%\(tenant_id\)s

openstack endpoint create --region RegionOne \
  sharev2 admin http://controller:8786/v2/%\(tenant_id\)s


+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | f5704c87b3da411d9cbd1f048843e044        |
| interface    | public                                  |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 3f27da0033bc4773afc9bd62cd66a3f1        |
| service_name | manilav2                                |
| service_type | sharev2                                 |
| url          | http://controller:8786/v2/%(tenant_id)s |
+--------------+-----------------------------------------+
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 13d0dff8dbb2446ea9998dc01760f5e5        |
| interface    | internal                                |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 3f27da0033bc4773afc9bd62cd66a3f1        |
| service_name | manilav2                                |
| service_type | sharev2                                 |
| url          | http://controller:8786/v2/%(tenant_id)s |
+--------------+-----------------------------------------+

+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | e1632a8fc4754e1db80be7c058bbfa4d        |
| interface    | admin                                   |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 3f27da0033bc4773afc9bd62cd66a3f1        |
| service_name | manilav2                                |
| service_type | sharev2                                 |
| url          | http://controller:8786/v2/%(tenant_id)s |
+--------------+-----------------------------------------+

  

安装

yum install openstack-manila python-manilaclient -y

  

配置

vi /etc/manila/manila.conf

[database]
...
connection = mysql+pymysql://manila:123@controller/manila
  
[DEFAULT]
...
transport_url = rabbit://openstack:123@controller

default_share_type = default_share_type
share_name_template = share-%s
rootwrap_config = /etc/manila/rootwrap.conf
api_paste_config = /etc/manila/api-paste.ini
auth_strategy = keystone
my_ip = 10.1.1.11

[keystone_authtoken]
...
memcached_servers = controller:11211
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = manila
password = 123

[oslo_concurrency]
...
lock_path = /var/lock/manila

  

填充manila数据库

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

2019-04-14 13:29:31.223 18361 INFO alembic.runtime.migration [-] Context impl MySQLImpl.
2019-04-14 13:29:31.224 18361 INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
2019-04-14 13:29:31.453 18361 INFO alembic.runtime.migration [-] Running upgrade  -> 162a3e673105, manila_init
2019-04-14 13:29:31.989 18361 INFO alembic.runtime.migration [-] Running upgrade 162a3e673105 -> 211836bf835c, add access level
2019-04-14 13:29:32.010 18361 INFO alembic.runtime.migration [-] Running upgrade 211836bf835c -> 38e632621e5a, change volume_type to share_type
2019-04-14 13:29:32.010 18361 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Renaming column name shares.volume_type_id to shares.share_type.id
2019-04-14 13:29:32.046 18361 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Renaming volume_types table to share_types
2019-04-14 13:29:32.071 18361 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Creating share_type_extra_specs table
2019-04-14 13:29:32.089 18361 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Migrating volume_type_extra_specs to share_type_extra_specs
2019-04-14 13:29:32.092 18361 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Dropping volume_type_extra_specs table
2019-04-14 13:29:32.104 18361 INFO alembic.runtime.migration [-] Running upgrade 38e632621e5a -> 17115072e1c3, add_nova_net_id_column_to_share_networks
2019-04-14 13:29:32.126 18361 INFO alembic.runtime.migration [-] Running upgrade 17115072e1c3 -> 4ee2cf4be19a, Remove share_snapshots.export_location
2019-04-14 13:29:32.144 18361 INFO alembic.runtime.migration [-] Running upgrade 4ee2cf4be19a -> 59eb64046740, Add required extra spec
2019-04-14 13:29:32.156 18361 INFO alembic.runtime.migration [-] Running upgrade 59eb64046740 -> ef0c02b4366, Add_share_type_projects
2019-04-14 13:29:32.181 18361 INFO alembic.runtime.migration [-] Running upgrade ef0c02b4366 -> 30cb96d995fa, add public column for share
2019-04-14 13:29:32.200 18361 INFO alembic.runtime.migration [-] Running upgrade 30cb96d995fa -> 56cdbe267881, Add share_export_locations table
2019-04-14 13:29:32.225 18361 INFO alembic.runtime.migration [-] Running upgrade 56cdbe267881 -> 3a482171410f, add_driver_private_data_table
2019-04-14 13:29:32.239 18361 INFO alembic.runtime.migration [-] Running upgrade 3a482171410f -> 533646c7af38, Remove unused attr status
2019-04-14 13:29:32.261 18361 INFO alembic.runtime.migration [-] Running upgrade 533646c7af38 -> 3db9992c30f3, Transform statuses to lowercase
2019-04-14 13:29:32.449 18361 INFO alembic.runtime.migration [-] Running upgrade 3db9992c30f3 -> 5077ffcc5f1c, add_share_instances
2019-04-14 13:29:32.852 18361 INFO alembic.runtime.migration [-] Running upgrade 5077ffcc5f1c -> 579c267fbb4d, add_share_instances_access_map
2019-04-14 13:29:32.907 18361 INFO alembic.runtime.migration [-] Running upgrade 579c267fbb4d -> 1f0bd302c1a6, add_availability_zones_table
2019-04-14 13:29:33.036 18361 INFO alembic.runtime.migration [-] Running upgrade 1f0bd302c1a6 -> 55761e5f59c5, Add 'snapshot_support' extra spec to share types
2019-04-14 13:29:33.067 18361 INFO alembic.runtime.migration [-] Running upgrade 55761e5f59c5 -> 3651e16d7c43, Create Consistency Groups Tables and Columns
2019-04-14 13:29:33.450 18361 INFO alembic.runtime.migration [-] Running upgrade 3651e16d7c43 -> 323840a08dc4, Add shares.task_state
2019-04-14 13:29:33.479 18361 INFO alembic.runtime.migration [-] Running upgrade 323840a08dc4 -> dda6de06349, Add DB support for share instance export locations metadata.
2019-04-14 13:29:33.592 18361 INFO alembic.runtime.migration [-] Running upgrade dda6de06349 -> 344c1ac4747f, Remove access rules status and add access_rule_status to share_instance
model
2019-04-14 13:29:33.679 18361 INFO alembic.runtime.migration [-] Running upgrade 344c1ac4747f -> 293fac1130ca, Add replication attributes to Share and ShareInstance models.
2019-04-14 13:29:33.720 18361 INFO alembic.runtime.migration [-] Running upgrade 293fac1130ca -> 5155c7077f99, Add more network info attributes to 'network_allocations' table.
2019-04-14 13:29:33.790 18361 INFO alembic.runtime.migration [-] Running upgrade 5155c7077f99 -> eb6d5544cbbd, add provider_location to share_snapshot_instances
2019-04-14 13:29:33.811 18361 INFO alembic.runtime.migration [-] Running upgrade eb6d5544cbbd -> 221a83cfd85b, change_user_id_length
2019-04-14 13:29:33.812 18361 INFO 221a83cfd85b_change_user_project_id_length_py [-] Changing user_id length for share_networks
2019-04-14 13:29:33.843 18361 INFO 221a83cfd85b_change_user_project_id_length_py [-] Changing project_id length for share_networks
2019-04-14 13:29:33.866 18361 INFO 221a83cfd85b_change_user_project_id_length_py [-] Changing project_id length for security_services
2019-04-14 13:29:33.903 18361 INFO alembic.runtime.migration [-] Running upgrade 221a83cfd85b -> fdfb668d19e1, add_gateway_to_network_allocations_table
2019-04-14 13:29:33.950 18361 INFO alembic.runtime.migration [-] Running upgrade fdfb668d19e1 -> e8ea58723178, Remove host from driver private data
2019-04-14 13:29:34.015 18361 INFO alembic.runtime.migration [-] Running upgrade e8ea58723178 -> 493eaffd79e1, add_mtu_network_allocations
2019-04-14 13:29:34.049 18361 INFO alembic.runtime.migration [-] Running upgrade 493eaffd79e1 -> 63809d875e32, add_access_key
2019-04-14 13:29:34.069 18361 INFO alembic.runtime.migration [-] Running upgrade 63809d875e32 -> 48a7beae3117, move_share_type_id_to_instances
2019-04-14 13:29:34.165 18361 INFO alembic.runtime.migration [-] Running upgrade 48a7beae3117 -> 3e7d62517afa, Add 'create_share_from_snapshot_support' extra spec to share types
2019-04-14 13:29:34.191 18361 INFO alembic.runtime.migration [-] Running upgrade 3e7d62517afa -> 95e3cf760840, remove_nova_net_id_column_from_share_networks
2019-04-14 13:29:34.206 18361 INFO alembic.runtime.migration [-] Running upgrade 95e3cf760840 -> 87ce15c59bbe, add_revert_to_snapshot_support
2019-04-14 13:29:34.229 18361 INFO alembic.runtime.migration [-] Running upgrade 87ce15c59bbe -> 54667b9cade7, add_share_instance_access_map_state
2019-04-14 13:29:34.298 18361 INFO alembic.runtime.migration [-] Running upgrade 54667b9cade7 -> e9f79621d83f, add_cast_rules_to_readonly_to_share_instances
2019-04-14 13:29:34.299 18361 INFO e9f79621d83f_add_cast_rules_to_readonly_to_share_instances_py [-] Adding cast_rules_to_readonly column to share instances.
2019-04-14 13:29:34.377 18361 INFO alembic.runtime.migration [-] Running upgrade e9f79621d83f -> 03da71c0e321, Convert consistency groups to share groups
2019-04-14 13:29:34.377 18361 INFO 03da71c0e321_convert_cgs_to_share_groups_py [-] Renaming consistency group tables
2019-04-14 13:29:34.729 18361 INFO alembic.runtime.migration [-] Running upgrade 03da71c0e321 -> e1949a93157a, Add share group types table
2019-04-14 13:29:34.813 18361 INFO alembic.runtime.migration [-] Running upgrade e1949a93157a -> a77e2ad5012d, add_share_snapshot_access
2019-04-14 13:29:34.920 18361 INFO alembic.runtime.migration [-] Running upgrade a77e2ad5012d -> 927920b37453, Add 'provider_location' attr to 'share_group_snapshot_members' model.
2019-04-14 13:29:34.938 18361 INFO alembic.runtime.migration [-] Running upgrade 927920b37453 -> d5db24264f5c, Add enum 'consistent_snapshot_support' attr to 'share_groups' model.
2019-04-14 13:29:34.960 18361 INFO alembic.runtime.migration [-] Running upgrade d5db24264f5c -> 7d142971c4ef, add_reservation_expire_index
2019-04-14 13:29:34.975 18361 INFO alembic.runtime.migration [-] Running upgrade 7d142971c4ef -> 5237b6625330, Add 'availability_zone_id' field to 'share_groups' table.
2019-04-14 13:29:35.000 18361 INFO alembic.runtime.migration [-] Running upgrade 5237b6625330 -> 31252d671ae5, Squash 'share_group_snapshot_members' and 'share_snapshot_instances' models.
2019-04-14 13:29:35.152 18361 INFO alembic.runtime.migration [-] Running upgrade 31252d671ae5 -> 238720805ce1, Add messages table
2019-04-14 13:29:35.166 18361 INFO alembic.runtime.migration [-] Running upgrade 238720805ce1 -> b516de97bfee, Add ProjectShareTypeQuota model
2019-04-14 13:29:35.213 18361 INFO alembic.runtime.migration [-] Running upgrade b516de97bfee -> 829a09b0ddd4, Fix 'project_share_type_quotas' unique constraint
2019-04-14 13:29:35.248 18361 INFO alembic.runtime.migration [-] Running upgrade 829a09b0ddd4 -> 27cb96d991fa, add description for share type
2019-04-14 13:29:35.266 18361 INFO alembic.runtime.migration [-] Running upgrade 27cb96d991fa -> 4a482571410f, add_backend_info_table
2019-04-14 13:29:35.283 18361 INFO alembic.runtime.migration [-] Running upgrade 4a482571410f -> 0274d20c560f, Add ou to security service
2019-04-14 13:29:35.301 18361 INFO alembic.runtime.migration [-] Running upgrade 0274d20c560f -> 097fad24d2fc, add_share_instances_share_id_index
2019-04-14 13:29:35.316 18361 INFO alembic.runtime.migration [-] Running upgrade 097fad24d2fc -> 11ee96se625f3, add metadata for access rule

  

完成安装

systemctl enable openstack-manila-api.service openstack-manila-scheduler.service
systemctl start openstack-manila-api.service openstack-manila-scheduler.service

  

 

安装和配置共享节点

安装

yum install openstack-manila-share python2-PyMySQL -y

  

配置

vi /etc/manila/manila.conf

[database]
...
connection = mysql+pymysql://manila:123@controller/manila

[DEFAULT]
...
transport_url = rabbit://openstack:123@controller

default_share_type = default_share_type
rootwrap_config = /etc/manila/rootwrap.conf

auth_strategy = keystone

my_ip = 10.1.1.13

[keystone_authtoken]
...
memcached_servers = controller:11211
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = manila
password = 123

[oslo_concurrency]
...
lock_path = /var/lib/manila/tmp

  

共享文件系统选项

共享文件系统选项1:没有驱动程序支持共享服务器管理

 

yum install lvm2 nfs-utils nfs4-acl-tools portmap targetcli
 
systemctl enable lvm2-lvmetad.service target.service
systemctl start lvm2-lvmetad.service target.service

systemctl restart lvm2-lvmetad.service target.service


pvcreate /dev/sdc

vgcreate manila-volumes /dev/sdc


/etc/lvm/lvm.conf

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

}

  

配置

vi /etc/manila/manila.conf

[DEFAULT]
...
enabled_share_backends = lvm
enabled_share_protocols = NFS


[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_ip = 10.1.1.13

  

共享文件系统选项2:共享服务器管理的驱动程序支持,

yum install openstack-neutron openstack-neutron-linuxbridge ebtables

  

配置

vi /etc/manila/manila.conf

[DEFAULT]
...
enabled_share_backends = generic
enabled_share_protocols = NFS


[neutron]
...
url = http://controller:9696
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
region_name = RegionOne
project_name = service
username = neutron
password = 123

[nova]
...
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
region_name = RegionOne
project_name = service
username = nova
password = 123

[cinder]
...
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
region_name = RegionOne
project_name = service
username = cinder
password = 123



[generic]
share_backend_name = GENERIC
share_driver = manila.share.drivers.generic.GenericShareDriver
driver_handles_share_servers = True
service_instance_flavor_id = 100
service_image_name = manila-service-image
service_instance_user = manila
service_instance_password = 123
interface_driver = manila.network.linux.interface.BridgeInterfaceDriver

  

完成安装

systemctl enable openstack-manila-share.service
systemctl start openstack-manila-share.service

  

注意:

配置多backend,中间,相隔

enabled_share_backends = lvm,generic

  

验证

manila service-list
+----+------------------+---------------+------+---------+-------+----------------------------+
| Id | Binary           | Host          | Zone | Status  | State | Updated_at                 |
+----+------------------+---------------+------+---------+-------+----------------------------+
| 1  | manila-scheduler | ceph1         | nova | enabled | up    | 2019-04-16T06:56:58.000000 |
| 2  | manila-share     | ceph3@lvm     | nova | enabled | up    | 2019-04-16T06:56:55.000000 |
| 3  | manila-share     | ceph3@generic | nova | enabled | up    | 2019-04-16T06:56:52.000000 |
+----+------------------+---------------+------+---------+-------+----------------------------+




#使用共享文件系统选项1创建共享(DHSS = False)

driver_handles_share_servers在使用LVM驱动程序创建共享之前禁用DHSS()


#禁用DHSS创建默认共享类型。默认共享类型将允许您使用此驱动程序创建共享,而无需在共享创建期间明确指定共享类型
manila type-create default_share_type False
+----------------------+--------------------------------------+
| Property             | Value                                |
+----------------------+--------------------------------------+
| required_extra_specs | driver_handles_share_servers : False |
| Name                 | default_share_type                   |
| Visibility           | public                               |
| is_default           | YES                                  |
| ID                   | fa6e7a1a-63e3-4cac-bc70-d9cba26e6fa6 |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+


manila type-list
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
| ID                                   | Name               | visibility | is_default | required_extra_specs                 | optional_extra_specs | Description |
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
| fa6e7a1a-63e3-4cac-bc70-d9cba26e6fa6 | default_share_type | public     | YES        | driver_handles_share_servers : False |                      | None        |
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+

manila availability-zone-list

+--------------------------------------+------+----------------------------+------------+
| Id                                   | Name | Created_At                 | Updated_At |
+--------------------------------------+------+----------------------------+------------+
| a87d5f35-4e61-4dd1-ae10-ca5878b2c2e4 | nova | 2019-04-14T05:30:45.000000 | None       |
+--------------------------------------+------+----------------------------+------------+


#创建共享
manila create NFS 1 --name share1
+---------------------------------------+--------------------------------------+
| Property                              | Value                                |
+---------------------------------------+--------------------------------------+
| status                                | creating                             |
| share_type_name                       | default_share_type                   |
| description                           | None                                 |
| availability_zone                     | None                                 |
| share_network_id                      | None                                 |
| share_server_id                       | None                                 |
| share_group_id                        | None                                 |
| host                                  |                                      |
| 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                                    | 8c627602-18f4-4732-9036-41c9aa8051ed |
| size                                  | 1                                    |
| source_share_group_snapshot_member_id | None                                 |
| user_id                               | cf86a58ebc3f462c9465beda84ec705c     |
| name                                  | share1                               |
| share_type                            | fa6e7a1a-63e3-4cac-bc70-d9cba26e6fa6 |
| has_replicas                          | False                                |
| replication_type                      | None                                 |
| created_at                            | 2019-04-16T07:05:53.000000           |
| share_proto                           | NFS                                  |
| mount_snapshot_support                | False                                |
| project_id                            | c1e6cbf1502141dca4a70c7f500688f3     |
| metadata                              | {}                                   |
+---------------------------------------+--------------------------------------+


#共享状态应更改creating 为available
manila list
+--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+---------------------------+-------------------+
| ID                                   | Name   | Size | Share Proto | Status    | Is Public | Share Type Name    | Host                      | Availability Zone |
+--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+---------------------------+-------------------+
| 8c627602-18f4-4732-9036-41c9aa8051ed | share1 | 1    | NFS         | available | False     | default_share_type | ceph3@lvm#lvm-single-pool | nova              |
+--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+---------------------------+-------------------+

#确定共享的导出IP地址
manila show share1
manila show 8c627602-18f4-4732-9036-41c9aa8051ed
+---------------------------------------+---------------------------------------------------------------------------------+
| Property                              | Value                                                                           |
+---------------------------------------+---------------------------------------------------------------------------------+
| status                                | available                                                                       |
| share_type_name                       | default_share_type                                                              |
| description                           | None                                                                            |
| availability_zone                     | nova                                                                            |
| share_network_id                      | None                                                                            |
| export_locations                      |                                                                                 |
|                                       | path = 10.1.1.13:/var/lib/manila/mnt/share-95d22d63-94ea-40ac-9166-78f6400e7dcf |
|                                       | preferred = False                                                               |
|                                       | is_admin_only = False                                                           |
|                                       | id = c729c256-a6e8-4a3c-9db2-e1219bb9cd8a                                       |
|                                       | share_instance_id = 95d22d63-94ea-40ac-9166-78f6400e7dcf                        |
| share_server_id                       | None                                                                            |
| share_group_id                        | None                                                                            |
| host                                  | ceph3@lvm#lvm-single-pool                                                       |
| 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                                    | 8c627602-18f4-4732-9036-41c9aa8051ed                                            |
| size                                  | 1                                                                               |
| source_share_group_snapshot_member_id | None                                                                            |
| user_id                               | cf86a58ebc3f462c9465beda84ec705c                                                |
| name                                  | share1                                                                          |
| share_type                            | fa6e7a1a-63e3-4cac-bc70-d9cba26e6fa6                                            |
| has_replicas                          | False                                                                           |
| replication_type                      | None                                                                            |
| created_at                            | 2019-04-16T07:05:53.000000                                                      |
| share_proto                           | NFS                                                                             |
| mount_snapshot_support                | False                                                                           |
| project_id                            | c1e6cbf1502141dca4a70c7f500688f3                                                |
| metadata                              | {}                                                                              |
+---------------------------------------+---------------------------------------------------------------------------------+

#添加允许访问前,尝试挂载
manila access-list 8c627602-18f4-4732-9036-41c9aa8051ed 
+----+-------------+-----------+--------------+-------+------------+------------+------------+
| id | access_type | access_to | access_level | state | access_key | created_at | updated_at |
+----+-------------+-----------+--------------+-------+------------+------------+------------+
+----+-------------+-----------+--------------+-------+------------+------------+------------+

#在计算实例上挂载

#登录到您的计算实例并创建一个放置挂载的文件夹:

mkdir ~/test_folder



#使用共享的导出位置在计算实例中挂载NFS共享:
mount -vt nfs 10.1.1.13:/var/lib/manila/mnt/share-95d22d63-94ea-40ac-9166-78f6400e7dcf ~/test_folder
mount.nfs: timeout set for Tue Apr 16 15:23:24 2019
mount.nfs: trying text-based options 'vers=4.1,addr=10.1.1.13,clientaddr=10.1.1.11'
mount.nfs: mount(2): Connection refused
mount.nfs: trying text-based options 'addr=10.1.1.13'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Program not registered



#允许访问共享,在尝试通过网络安装之前配置对新共享的访问。计算实例(其IP地址由下面的INSTANCE_IP引用)必须具有到共享网络中指定的网络的网络连接。
manila access-allow share1 ip 10.1.1.11
ERROR: The server has either erred or is incapable of performing the requested operation.

manila access-list  share1
+--------------------------------------+-------------+-----------+--------------+-----------------+------------+----------------------------+------------+
| id                                   | access_type | access_to | access_level | state           | access_key | created_at                 | updated_at |
+--------------------------------------+-------------+-----------+--------------+-----------------+------------+----------------------------+------------+
| a49efa9c-ab62-4791-bfe9-d131c5abbc5f | ip          | 10.1.1.11 | rw           | queued_to_apply | None       | 2019-04-16T07:24:20.000000 | None       |
+--------------------------------------+-------------+-----------+--------------+-----------------+------------+----------------------------+------------+

manila access-allow share1 ip 172.20.10.2
ERROR: The server has either erred or is incapable of performing the requested operation.
manila access-list share1
+--------------------------------------+-------------+-------------+--------------+-----------------+------------+----------------------------+------------+
| id                                   | access_type | access_to   | access_level | state           | access_key | created_at                 | updated_at |
+--------------------------------------+-------------+-------------+--------------+-----------------+------------+----------------------------+------------+
| 35581769-428d-474c-ba52-0c423a4414af | ip          | 172.20.10.2 | rw           | queued_to_apply | None       | 2019-04-16T07:31:32.000000 | None       |
| a49efa9c-ab62-4791-bfe9-d131c5abbc5f | ip          | 10.1.1.11   | rw           | queued_to_apply | None       | 2019-04-16T07:24:20.000000 | None       |
+--------------------------------------+-------------+-------------+--------------+-----------------+------------+----------------------------+------------+


#使用共享的导出位置在计算实例中挂载NFS共享:
mount -vt nfs 10.1.1.13:/var/lib/manila/mnt/share-95d22d63-94ea-40ac-9166-78f6400e7dcf ~/test_folder











#使用共享文件系统选项2创建共享(DHSS = True)
#在启用DHSS的情况下创建默认共享类型。默认共享类型将允许您使用此驱动程序创建共享,而无需在共享创建期间明确指定共享类型
manila type-create generic True
+----------------------+--------------------------------------+
| Property             | Value                                |
+----------------------+--------------------------------------+
| required_extra_specs | driver_handles_share_servers : True  |
| Name                 | generic                              |
| Visibility           | public                               |
| is_default           | -                                    |
| ID                   | e3a87f49-1c1b-4ebb-8477-2c0912064ab6 |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+

#manila.conf在该[DEFAULT] 部分下设置此默认共享类型,然后重新启动manila-api服务,然后再继续。除非您这样做,否则默认共享类型将无效。



share_backend_name = generic





curl https://tarballs.openstack.org/manila-image-elements/images/manila-service-image-master.qcow2 | \
glance image-create \
--name "manila-service-image" \
--disk-format qcow2 \
--container-format bare \
--visibility public --progress







#列出可用网络以获取专用网络的ID和子网

neutron net-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------------------------+----------------------------------+-----------------------------------------------------+
| id                                   | name                   | tenant_id                        | subnets                                             |
+--------------------------------------+------------------------+----------------------------------+-----------------------------------------------------+
| 21d91d88-961d-4179-bce3-8728debf0480 | selfservice            | c1e6cbf1502141dca4a70c7f500688f3 | 23c52d0d-e1b6-4b1d-af48-f21e5382dc7f 172.16.1.0/24  |
| 29c05cbd-c675-47fb-adbf-e8568733559b | provider               | c1e6cbf1502141dca4a70c7f500688f3 | a62b9c41-bc0f-4fcd-80e0-bbad5ecb9536 172.20.10.0/24 |
| ec4d7c77-5599-4d46-a963-02736d7ceed2 | manila_service_network | 2f5e4f59bb1344c88787c8b0979dfe8c |                                                     |
+--------------------------------------+------------------------+----------------------------------+-----------------------------------------------------+


#获取demo凭据以执行以下步骤作为非管理项目:

. demo-openrc.sh

#
manila share-network-create --name demo-share-network1  --neutron-net-id 21d91d88-961d-4179-bce3-8728debf0480 --neutron-subnet-id 23c52d0d-e1b6-4b1d-af48-f21e5382dc7f
+-------------------+--------------------------------------+
| Property          | Value                                |
+-------------------+--------------------------------------+
| network_type      | None                                 |
| name              | demo-share-network1                  |
| segmentation_id   | None                                 |
| created_at        | 2019-04-17T09:34:58.745675           |
| neutron_subnet_id | 23c52d0d-e1b6-4b1d-af48-f21e5382dc7f |
| updated_at        | None                                 |
| mtu               | None                                 |
| gateway           | None                                 |
| neutron_net_id    | 21d91d88-961d-4179-bce3-8728debf0480 |
| ip_version        | None                                 |
| cidr              | None                                 |
| project_id        | c1e6cbf1502141dca4a70c7f500688f3     |
| id                | caf55e5f-ed14-4344-a03d-872946beca9f |
| description       | None                                 |
+-------------------+--------------------------------------+



#使用共享网络创建NFS共享。由于已创建并配置了默认共享类型,因此无需在请求中指定。

 manila create NFS 1 --name demo-share1 --share-network demo-share-network1  --share-type e3a87f49-1c1b-4ebb-8477-2c0912064ab6 
+---------------------------------------+--------------------------------------+
| Property                              | Value                                |
+---------------------------------------+--------------------------------------+
| status                                | creating                             |
| share_type_name                       | generic                              |
| description                           | None                                 |
| availability_zone                     | None                                 |
| share_network_id                      | caf55e5f-ed14-4344-a03d-872946beca9f |
| share_server_id                       | None                                 |
| share_group_id                        | None                                 |
| host                                  |                                      |
| 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                                    | ad4c25ce-b60c-46f5-9d33-579a2d960e4b |
| size                                  | 1                                    |
| source_share_group_snapshot_member_id | None                                 |
| user_id                               | cf86a58ebc3f462c9465beda84ec705c     |
| name                                  | demo-share1                          |
| share_type                            | e3a87f49-1c1b-4ebb-8477-2c0912064ab6 |
| has_replicas                          | False                                |
| replication_type                      | None                                 |
| created_at                            | 2019-04-17T09:36:06.000000           |
| share_proto                           | NFS                                  |
| mount_snapshot_support                | False                                |
| project_id                            | c1e6cbf1502141dca4a70c7f500688f3     |
| metadata                              | {}                                   |
+---------------------------------------+--------------------------------------+


#共享状态应更改creating 为available

manila list
+--------------------------------------+-------------+------+-------------+--------+-----------+-----------------+-----------------------+-------------------+
| ID                                   | Name        | Size | Share Proto | Status | Is Public | Share Type Name | Host                  | Availability Zone |
+--------------------------------------+-------------+------+-------------+--------+-----------+-----------------+-----------------------+-------------------+
| ad4c25ce-b60c-46f5-9d33-579a2d960e4b | demo-share1 | 1    | NFS         | error  | False     | generic         | ceph3@generic#generic | nova              |
+--------------------------------------+-------------+------+-------------+--------+-----------+-----------------+-----------------------+-------------------+
#确定共享的导出IP地址
manila show demo-share1



#在尝试通过网络安装之前配置对新共享的访问。计算实例(其IP地址由下面的INSTANCE_IP引用)必须具有到共享网络中指定的网络的网络连接。

manila access-allow demo-share1 ip INSTANCE_IP


#登录到您的计算实例并创建一个放置挂载的文件夹

mkdir ~/test_folder
 
#使用共享的导出位置在计算实例中挂载NFS共享 

mount -vt nfs 10.254.0.6:/shares/share-0bfd69a1-27f0-4ef5-af17-7cd50bce6550 ~/test_folder

  

 

posted @ 2019-04-25 18:24  larlly  阅读(705)  评论(0)    收藏  举报