OpenStack Train : How to use Manila#22019/10/28 |
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 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 | f8a6cbff57ee1f91e05e576d88057dbe | | container_format | bare | | created_at | 2019-10-28T08:00:38Z | | disk_format | qcow2 | | file | /v2/images/c5b5bdf8-e79e-443e-bd80-784266c4d63f/file | | id | c5b5bdf8-e79e-443e-bd80-784266c4d63f | | min_disk | 0 | | min_ram | 0 | | name | manila-service-image | | owner | 4f93fd3e6e184c859641b017115016a4 | | properties | os_hash_algo='sha512', os_hash_value='ff76a0867f56b884...| | protected | False | | schema | /v2/schemas/image | | size | 441342976 | | status | active | | tags | | | updated_at | 2019-10-28T08:00:40Z | | virtual_size | None | | visibility | public | +------------------+----------------------------------------------------------+[root@dlp ~(keystone)]# openstack security group create manila-service +-----------------+----------------------------------------------------------+ | Field | Value | +-----------------+----------------------------------------------------------+ | created_at | 2019-10-28T08:01:20Z | | description | manila-service | | id | 3c203967-1f3a-4c9e-b5b3-ecf0f93c4177 | | location | cloud='', project.domain_id=, project.domain_name='de... | | name | manila-service | | project_id | 4f93fd3e6e184c859641b017115016a4 | | revision_number | 1 | | rules | created_at='2019-10-28T08:01:20Z', direction='egress'... | | | created_at='2019-10-28T08:01:20Z', direction='egress'... | | tags | [] | | updated_at | 2019-10-28T08:01:20Z | +-----------------+----------------------------------------------------------+ # 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 | 01221b6d-4419-464e-90c7-cf093d039c1f | | optional_extra_specs | | | Description | None | +----------------------+--------------------------------------+[root@dlp ~(keystone)]# manila type-list +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ | ID | Name | visibility | is_default | required_extra_specs | optional_extra_specs | Description | +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ | 01221b6d-4419-464e-90c7-cf093d039c1f | 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 | +--------------------------------------+---------+--------------------------------------+ | 08ba2a6b-a9e6-41cd-b530-ffecb146117e | int_net | 7e35d8e7-4f75-4afd-ab9f-da5ccf6850fc | | f6440530-1b12-4748-a557-3596e36a42ec | ext_net | c2db3338-39cf-4529-8c7e-8680db716475 | +--------------------------------------+---------+--------------------------------------+[cent@dlp ~(keystone)]$ openstack subnet list +--------------------------------------+---------+--------------------------------------+------------------+ | ID | Name | Network | Subnet | +--------------------------------------+---------+--------------------------------------+------------------+ | 7e35d8e7-4f75-4afd-ab9f-da5ccf6850fc | subnet1 | 08ba2a6b-a9e6-41cd-b530-ffecb146117e | 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 | +-----------------------+--------------------------------------------+ | description | None | | name | manila_share | | share_network_subnets | [{u'availability_zone': None, u'neutron_...| | created_at | 2019-10-28T08:03:36.000000 | | project_id | 67b2b71cee384d69939e6b3963e0b2db | | updated_at | None | | id | d352f476-c626-4b50-90d9-cdc80a7c4d55 | +-----------------------+--------------------------------------------+[cent@dlp ~(keystone)]$ manila share-network-list +--------------------------------------+--------------+ | id | name | +--------------------------------------+--------------+ | d352f476-c626-4b50-90d9-cdc80a7c4d55 | 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 | d352f476-c626-4b50-90d9-cdc80a7c4d55 | | 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 | 5ce99ae0-8dd8-4a9b-b1de-7386c5dee996 | | size | 10 | | source_share_group_snapshot_member_id | None | | user_id | 14ad73cc98744e01a51886e13d541013 | | name | share01 | | share_type | 01221b6d-4419-464e-90c7-cf093d039c1f | | has_replicas | False | | replication_type | None | | created_at | 2019-10-28T08:05:41.000000 | | share_proto | NFS | | mount_snapshot_support | False | | project_id | 67b2b71cee384d69939e6b3963e0b2db | | 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 | +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | 5ce99ae0-8dd8-4a9b-b1de-7386c5dee996 | 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. |
[root@storage ~]# ip addr ..... ..... 15: tap50ba9ff0-0c: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 link/ether fa:16:3e:d9:29:9f brd ff:ff:ff:ff:ff:ff inet 10.254.0.138/24 brd 10.254.0.255 scope global tap50ba9ff0-0c valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:fed9:299f/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 | +--------------------------------------+----------+---------+-------------------------------------+---------+----------+ | b3c21241-2800-4109-831b-6fd69d20ecf8 | CentOS_7 | SHUTOFF | int_net=192.168.100.179, 10.0.0.233 | 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 | 5ce99ae0-8dd8-4a9b-b1de-7386c5dee996 | | created_at | 2019-10-28T08:08:06.000000 | | updated_at | None | | access_type | ip | | access_to | 10.0.0.0/24 | | access_level | rw | | state | queued_to_apply | | id | 401b25f5-7512-438f-8136-cac6d7910b78 | | 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 | +--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+ | 401b25f5-7512-438f-8136-cac6d7910b78 | ip | 10.0.0.0/24 | rw | active | None | 2019-10-28T08:08:06.000000 | None | | afe9dece-42b6-4f81-92c1-a5c71ee9508f | ip | 192.168.100.0/24 | rw | active | None | 2019-10-28T08:08:35.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.237:/shares/share-7b1f498b-26ed-4d3b-9159-2c4a4a9ddf22
[cent@dlp ~(keystone)]$
ssh centos@10.0.0.233 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.237:/shares/share-7b1f498b-26ed-4d3b-9159-2c4a4a9ddf22 /mnt [centos@centos-7 ~]$ df -hT Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 908M 0 908M 0% /dev tmpfs tmpfs 919M 0 919M 0% /dev/shm tmpfs tmpfs 919M 8.5M 911M 1% /run tmpfs tmpfs 919M 0 919M 0% /sys/fs/cgroup /dev/mapper/centos-root xfs 8.0G 1.3G 6.8G 16% / /dev/vda1 xfs 1014M 149M 866M 15% /boot tmpfs tmpfs 184M 0 184M 0% /run/user/1001 10.254.0.237:/shares/share-7b1f498b-26ed-4d3b-9159-2c4a4a9ddf22 nfs4 9.8G 37M 9.3G 1% /mnt |
Sponsored Link |
|