OpenStack Stein : How to use Manila#22019/05/17 |
This is How to use OpenStack Shared File System (Manila).
This example is based on the emvironment like follows.
For example, Configure Manila share to use a designed instance.
------------+---------------------------+---------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ Control Node ] | | [ Storage Node ] | | [ Compute Node ] | | | | | | | | MariaDB RabbitMQ | | Open vSwitch | | Libvirt | | Memcached httpd | | L2 Agent | | Nova Compute | | Keystone Glance | | L3 Agent | | Open vSwitch | | Nova API Cinder API| | Metadata Agent | | L2 Agent | | Neutron Server | | Cinder Volume | | | | Metadata Agent | | Manila Share | | | | Manila API | | | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] |
It needs to use Cinder storage for backends,
so Configure Cinder service first. (any backends are OK for Cinder)
|
[2] | Configure Storage Node. |
[root@storage ~]#
vi /etc/manila/manila.conf # add follows into [DEFAULT] section
enabled_share_backends = generic
# add follows to the end
[neutron]
url = http://10.0.0.30:9696
auth_url = http://10.0.0.30:5000
memcached_servers = 10.0.0.30: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://10.0.0.30:5000
memcached_servers = 10.0.0.30: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://10.0.0.30:5000
memcached_servers = 10.0.0.30: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
systemctl start openstack-manila-share [root@storage ~]# systemctl enable openstack-manila-share
|
[3] | Download official Manila designed image and add it to Glance. And more, create a security group for Manila Service. |
[root@dlp ~(keystone)]# curl -O http://tarballs.openstack.org/manila-image-elements/images/manila-service-image-master.qcow2 [root@dlp ~(keystone)]# openstack image create "manila-service-image" --file manila-service-image-master.qcow2 --disk-format qcow2 --container-format bare --public +------------------+--------------------------------------------------------------------------------+ | Field | Value | +------------------+--------------------------------------------------------------------------------+ | checksum | df9d9b8b5e829aa89b9eb3484919a905 | | container_format | bare | | created_at | 2019-05-17T02:19:59Z | | disk_format | qcow2 | | file | /v2/images/dc520d03-9070-440c-ae2c-78a6b7c4ef63/file | | id | dc520d03-9070-440c-ae2c-78a6b7c4ef63 | | min_disk | 0 | | min_ram | 0 | | name | manila-service-image | | owner | 183a5ed32a77427986038c176b605d73 | | properties | os_hash_algo='sha512', os_hash_value='8db4fe6b8f04ed2dccd9fea6f73016c22f78...' | | protected | False | | schema | /v2/schemas/image | | size | 438073344 | | status | active | | tags | | | updated_at | 2019-05-17T02:20:03Z | | virtual_size | None | | visibility | public | +------------------+--------------------------------------------------------------------------------+[root@dlp ~(keystone)]# openstack security group create manila-service +-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | created_at | 2019-05-17T02:21:07Z | | description | manila-service | | id | f812f27f-217f-4ba3-8b81-d553e7528a41 | | location | Munch({'project': Munch({'domain_name': 'default', 'domain_id': None, 'name': 'admin', 'id': u'183a5ed32a77427986038c176b605d73'}), 'cloud': '', 'region_name': '', 'zone': None}) | | name | manila-service | | project_id | 183a5ed32a77427986038c176b605d73 | | revision_number | 1 | | rules | created_at='2019-05-17T02:21:07Z', direction='egress', ethertype='IPv4', id='67485073-7895-48f0-9da8-65925cbc7f34', updated_at='2019-05-17T02:21:07Z' | | | created_at='2019-05-17T02:21:07Z', direction='egress', ethertype='IPv6', id='c3de00f2-fb9c-4acb-92ca-9d6191fa0143', updated_at='2019-05-17T02:21:07Z' | | tags | [] | | updated_at | 2019-05-17T02:21:07Z | +-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ # allow ports for manila service root@dlp ~(keystone)# openstack security group rule create --protocol icmp --ingress manila-service root@dlp ~(keystone)# openstack security group rule create --protocol tcp --dst-port 22:22 manila-service root@dlp ~(keystone)# openstack security group rule create --protocol tcp --dst-port 2049:2049 manila-service |
[4] | Create default share type. |
[root@dlp ~(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 | f7c4b828-c1dd-4884-bc69-2812d6e3b51d | | optional_extra_specs | | | Description | None | +----------------------+--------------------------------------+[root@dlp ~(keystone)]# manila type-list +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ | ID | Name | visibility | is_default | required_extra_specs | optional_extra_specs | Description | +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ | f7c4b828-c1dd-4884-bc69-2812d6e3b51d | default_share_type | public | YES | driver_handles_share_servers : True | | None | +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ |
[5] | Login as a common user you'd like to use Manila Share and Create shared network. |
[cent@dlp ~(keystone)]$ openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 85844309-e89a-49cb-8ec7-730a8e6d253c | ext_net | 7bcaa30a-261c-41bb-bcab-f88c711f98a8 | | c9377689-558e-4f2a-9334-17a3b9fa1b87 | int_net | b4dda943-e57b-4455-88dd-c3308c2ac30c | +--------------------------------------+---------+--------------------------------------+[cent@dlp ~(keystone)]$ openstack subnet list +--------------------------------------+---------+--------------------------------------+------------------+ | ID | Name | Network | Subnet | +--------------------------------------+---------+--------------------------------------+------------------+ | b4dda943-e57b-4455-88dd-c3308c2ac30c | subnet1 | c9377689-558e-4f2a-9334-17a3b9fa1b87 | 192.168.100.0/24 | +--------------------------------------+---------+--------------------------------------+------------------+
[cent@dlp ~(keystone)]$
[cent@dlp ~(keystone)]$ INT_NET=$(openstack network list | grep 'int_net' | awk '{print $2}') [cent@dlp ~(keystone)]$ INT_SUBNET=$(openstack subnet list | grep 'subnet1' | awk '{print $2}')
manila share-network-create --neutron-net-id $INT_NET --neutron-subnet-id $INT_SUBNET --name manila_share +-------------------+--------------------------------------+ | Property | Value | +-------------------+--------------------------------------+ | network_type | None | | name | manila_share | | segmentation_id | None | | created_at | 2019-05-17T02:24:30.195211 | | neutron_subnet_id | b4dda943-e57b-4455-88dd-c3308c2ac30c | | updated_at | None | | mtu | None | | gateway | None | | neutron_net_id | c9377689-558e-4f2a-9334-17a3b9fa1b87 | | ip_version | None | | cidr | None | | project_id | caab6ec580994e6481cd104b9d210f3f | | id | 8dbddb94-22c3-47bf-9abe-a4ba7653b77e | | description | None | +-------------------+--------------------------------------+[cent@dlp ~(keystone)]$ manila share-network-list +--------------------------------------+--------------+ | id | name | +--------------------------------------+--------------+ | 8dbddb94-22c3-47bf-9abe-a4ba7653b77e | manila_share | +--------------------------------------+--------------+ |
[6] | Create NFS share. |
[cent@dlp ~(keystone)]$ manila create NFS 10 --name share01 --share-network manila_share +---------------------------------------+--------------------------------------+ | Property | Value | +---------------------------------------+--------------------------------------+ | status | creating | | share_type_name | default_share_type | | description | None | | availability_zone | None | | share_network_id | 8dbddb94-22c3-47bf-9abe-a4ba7653b77e | | 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 | 9a6898f1-086f-4344-bf98-ceb6b954b6b7 | | size | 10 | | source_share_group_snapshot_member_id | None | | user_id | b5dd128c2fd744c892ad7d1fb39d21a0 | | name | share01 | | share_type | f7c4b828-c1dd-4884-bc69-2812d6e3b51d | | has_replicas | False | | replication_type | None | | created_at | 2019-05-17T02:26:12.000000 | | share_proto | NFS | | mount_snapshot_support | False | | project_id | caab6ec580994e6481cd104b9d210f3f | | metadata | {} | +---------------------------------------+--------------------------------------+ # few minutes later, the Status turns to available [cent@dlp ~(keystone)]$ manila list +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone | +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | 9a6898f1-086f-4344-bf98-ceb6b954b6b7 | share01 | 10 | NFS | available | False | default_share_type | | nova | +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ |
[7] | At this point, network for Manila has been created within 10.254.0.0 network on Storage Node. |
[cent@storage ~]$ ip addr ..... ..... 16: tap5c659a4d-23: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 link/ether fa:16:3e:dc:58:ba brd ff:ff:ff:ff:ff:ff inet 10.254.0.153/24 brd 10.254.0.255 scope global tap5c659a4d-23 valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:fedc:58ba/64 scope link valid_lft forever preferred_lft forever ..... ..... |
[8] | It's OK all, you can use Manila Shared filesystem from your own instances like follows. |
[cent@dlp ~(keystone)]$ openstack server list +--------------------------------------+----------+---------+------------------------------------+---------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+----------+---------+------------------------------------+---------+----------+ | aced428a-2d16-4679-9798-50e69c7aaf1d | CentOS_7 | SHUTOFF | int_net=192.168.100.59, 10.0.0.240 | CentOS7 | m1.small | +--------------------------------------+----------+---------+------------------------------------+---------+----------+ # allow access permission first [cent@dlp ~(keystone)]$ manila access-allow share01 ip 10.0.0.0/24 --access-level rw +--------------+--------------------------------------+ | Property | Value | +--------------+--------------------------------------+ | access_key | None | | share_id | 9a6898f1-086f-4344-bf98-ceb6b954b6b7 | | created_at | 2019-05-17T02:29:23.000000 | | updated_at | None | | access_type | ip | | access_to | 10.0.0.0/24 | | access_level | rw | | state | queued_to_apply | | id | fa1e3fdd-1144-4306-9a9c-8d3a7d800dfe | | metadata | {} | +--------------+--------------------------------------+ # OK if State turns to active [cent@dlp ~(keystone)]$ manila access-list share01 +--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+ | id | access_type | access_to | access_level | state | access_key | created_at | updated_at | +--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+ | 576e30bd-3b45-4f78-8657-640d1a444c9b | ip | 192.168.100.0/24 | rw | active | None | 2019-05-17T02:29:56.000000 | None | | fa1e3fdd-1144-4306-9a9c-8d3a7d800dfe | ip | 10.0.0.0/24 | rw | active | None | 2019-05-17T02:29:23.000000 | None | +--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+
[cent@dlp ~(keystone)]$
openstack server start CentOS_7 # confirm access Path [cent@dlp ~(keystone)]$ manila show share01 | grep path | cut -d'|' -f3 path = 10.254.0.59:/shares/share-4ea7f27d-1c45-4061-b185-0d8bbe15c6cd
[cent@dlp ~(keystone)]$
ssh centos@10.0.0.240 Last login: Fri May 17 19:57:00 2019 from dlp.srv.world # mount Manila shared storage [centos@centos-7 ~]$ sudo mount -t nfs \ 10.254.0.59:/shares/share-4ea7f27d-1c45-4061-b185-0d8bbe15c6cd /mnt [centos@centos-7 ~]$ df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/centos-root xfs 8.0G 1.1G 7.0G 14% / devtmpfs devtmpfs 988M 0 988M 0% /dev tmpfs tmpfs 1000M 0 1000M 0% /dev/shm tmpfs tmpfs 1000M 8.5M 992M 1% /run tmpfs tmpfs 1000M 0 1000M 0% /sys/fs/cgroup /dev/vda1 xfs 1014M 132M 883M 13% /boot tmpfs tmpfs 200M 0 200M 0% /run/user/1000 10.254.0.59:/shares/share-4ea7f27d-1c45-4061-b185-0d8bbe15c6cd nfs4 9.8G 37M 9.3G 1% /mnt |
Sponsored Link |