OpenStack Pike : How to use Manila#22017/09/07 |
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.
It needs to use Cinder storage for backends, so Configure Cinder service first. On this example, create and use a Cinder storage [disk01] with 10G by LVM backend like here. ------------+---------------------------+---------------------------+------------ | | | 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] | 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_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
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_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
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_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
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
driver_handles_share_servers = True
service_instance_flavor_id = 1
service_instance_security_group = manila-service
service_image_name = manila-service-image
service_instance_user = manila
service_instance_password = manila
interface_driver = manila.network.linux.interface.OVSInterfaceDriver
systemctl start openstack-manila-share [root@storage ~]# systemctl enable openstack-manila-share
|
[2] | 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 | 2bf61c8f8fc4f0305a01efcf28a28151 | | container_format | bare | | created_at | 2017-09-08T03:54:43Z | | disk_format | qcow2 | | file | /v2/images/ed4094fc-a22e-400f-9eb3-833bb25c0230/file | | id | ed4094fc-a22e-400f-9eb3-833bb25c0230 | | min_disk | 0 | | min_ram | 0 | | name | manila-service-image | | owner | 09158bee8c6441519bf3a3743d936566 | | protected | False | | schema | /v2/schemas/image | | size | 337947136 | | status | active | | tags | | | updated_at | 2017-09-08T03:54:45Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+[root@dlp ~(keystone)]# openstack security group create manila-service +-----------------+--------------------------------------------------------------------------------------+ | Field | Value | +-----------------+--------------------------------------------------------------------------------------+ | created_at | 2017-09-08T07:05:59Z | | description | manila-service | | id | fb852fcd-3c1d-4555-b59a-a4b8cab4f27a | | name | manila-service | | project_id | 09158bee8c6441519bf3a3743d936566 | | revision_number | 2 | | rules | created_at='2017-09-08T07:05:59Z', direction='egress', ethertype='IPv4', id='19af... | | | created_at='2017-09-08T07:05:59Z', direction='egress', ethertype='IPv6', id='f107... | | updated_at | 2017-09-08T07:05:59Z | +-----------------+--------------------------------------------------------------------------------------+ |
[3] | 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 | - | | ID | 34805584-9ac4-4ffd-a802-08d27c788ce6 | | optional_extra_specs | | +----------------------+--------------------------------------+[root@dlp ~(keystone)]# manila type-list +-----------+--------------------+------------+------------+--------------------------+-------------------+ | ID | Name | visibility | is_default | required_extra_specs | optional_extra_.. | +-----------+--------------------+------------+------------+--------------------------+-------------------+ | 34805584- | default_share_type | public | YES | driver_handles_share_... | | +-----------+--------------------+------------+------------+--------------------------+-------------------+ |
[4] | Create shared network. |
[root@dlp ~(keystone)]# openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | b70e8cdc-8c61-4a3b-8dfc-060cba8f82f9 | int_net | 3627d5d7-8196-469f-897e-2159f695052a | | e27d7f02-773f-4e11-8aa9-e70ebc05ab76 | ext_net | 85f3a6a0-07ab-493d-91a3-cd60ecd908c7 | +--------------------------------------+---------+--------------------------------------+[root@dlp ~(keystone)]# openstack subnet list +--------------------------------------+---------+--------------------------------------+------------------+ | ID | Name | Network | Subnet | +--------------------------------------+---------+--------------------------------------+------------------+ | 3627d5d7-8196-469f-897e-2159f695052a | subnet1 | b70e8cdc-8c61-4a3b-8dfc-060cba8f82f9 | 192.168.100.0/24 | | 85f3a6a0-07ab-493d-91a3-cd60ecd908c7 | subnet2 | e27d7f02-773f-4e11-8aa9-e70ebc05ab76 | 10.0.0.0/24 | +--------------------------------------+---------+--------------------------------------+------------------+
[root@dlp ~(keystone)]#
[root@dlp ~(keystone)]# INT_NET=$(openstack network list | grep 'int_net' | awk '{print $2}') [root@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 | 2017-09-08T07:09:13.579105 | | neutron_subnet_id | 3627d5d7-8196-469f-897e-2159f695052a | | updated_at | None | | mtu | None | | gateway | None | | neutron_net_id | b70e8cdc-8c61-4a3b-8dfc-060cba8f82f9 | | ip_version | None | | cidr | None | | project_id | 09158bee8c6441519bf3a3743d936566 | | id | 26f4b5da-a472-46db-bc27-9277ff7ff6c2 | | description | None | +-------------------+--------------------------------------+[root@dlp ~(keystone)]# manila share-network-list +--------------------------------------+--------------+ | id | name | +--------------------------------------+--------------+ | 26f4b5da-a472-46db-bc27-9277ff7ff6c2 | manila_share | +--------------------------------------+--------------+ |
[5] | Create NFS share. |
# create a flavor id 1 [root@dlp ~(keystone)]# openstack flavor create --id 1 --vcpus 1 --ram 2048 --disk 10 m1.tiny +----------------------------+---------+ | Field | Value | +----------------------------+---------+ | OS-FLV-DISABLED:disabled | False | | OS-FLV-EXT-DATA:ephemeral | 0 | | disk | 10 | | id | 1 | | name | m1.tiny | | os-flavor-access:is_public | True | | properties | | | ram | 2048 | | rxtx_factor | 1.0 | | swap | | | vcpus | 1 | +----------------------------+---------+[root@dlp ~(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 | e346e2d4-cceb-420e-a1b0-950dacea10ee | | 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 | f51f9e8a-a7ae-446c-9332-b5104c3401cf | | size | 1 | | source_share_group_snapshot_member_id | None | | user_id | 09d8dfa20e0f40eaae448d369943b195 | | name | share01 | | share_type | cbfdfba0-f043-4c48-9f75-aea45be2caff | | has_replicas | False | | replication_type | None | | created_at | 2017-09-08T07:31:35.000000 | | share_proto | NFS | | mount_snapshot_support | False | | project_id | 09158bee8c6441519bf3a3743d936566 | | metadata | {} | +---------------------------------------+--------------------------------------+ # few minutes later, the Status turns to available [root@dlp ~(keystone)]# manila list +--------+---------+------+-------------+-----------+-----------+--------------------+------------+--------+ | ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Avai.. | +--------+---------+------+-------------+-----------+-----------+--------------------+------------+--------+ | f51... | share01 | 1 | NFS | available | False | default_share_type | network... | nova | +--------+---------+------+-------------+-----------+-----------+--------------------+------------+--------+ |
[6] | At this point, 10.254.0.9/28 network has been created on Storage Node. |
[root@storage ~]# ip addr ..... ..... 16: tapb2bf768a-46: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000 link/ether fa:16:3e:55:f3:ed brd ff:ff:ff:ff:ff:ff inet 10.254.0.9/28 brd 10.254.0.15 scope global tapb2bf768a-46 valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:fe55:f3ed/64 scope link valid_lft forever preferred_lft forever ..... ..... |
[7] | It's OK all, you can use Manila Shared filesystem from Instances like follows. |
[root@dlp ~(keystone)]# openstack server list +-----------+----------+---------+------------------------------------+---------+----------+ | ID | Name | Status | Networks | Image | Flavor | +-----------+----------+---------+------------------------------------+---------+----------+ | 662f62b8- | CentOS_7 | SHUTOFF | int_net=192.168.100.12, 10.0.0.201 | CentOS7 | m1.small | +-----------+----------+---------+------------------------------------+---------+----------+ # allow access rights first [root@dlp ~(keystone)]# manila access-allow share01 ip 192.168.100.0/24 --access-level rw +--------------+--------------------------------------+ | Property | Value | +--------------+--------------------------------------+ | access_key | None | | share_id | f51f9e8a-a7ae-446c-9332-b5104c3401cf | | created_at | 2017-09-08T07:40:23.000000 | | updated_at | None | | access_type | ip | | access_to | 192.168.100.0/24 | | access_level | rw | | state | queued_to_apply | | id | c9c973a4-3b68-47c7-bcef-724fc3551463 | +--------------+--------------------------------------+ # it's no problem if State turns to active [root@dlp ~(keystone)]# manila access-list share01 +--------+-------------+------------------+--------------+--------+------------+--------------+------------+ | id | access_type | access_to | access_level | state | access_key | created_at | updated_at | +--------+-------------+------------------+--------------+--------+------------+--------------+------------+ | c9c... | ip | 192.168.100.0/24 | rw | active | None | 2017-09-0... | None | +--------+-------------+------------------+--------------+--------+------------+--------------+------------+
[root@dlp ~(keystone)]#
openstack server start CentOS_7 # confirm access Path [root@dlp ~(keystone)]# manila show share01 | grep path | cut -d'|' -f3 path = 10.254.0.11:/shares/share-15db92a3-4e21-4efc-9c36-bbcc65002662
[root@dlp ~(keystone)]#
ssh centos@10.0.0.201 Last login: Thu Sep 7 17:13:09 2017 from dlp.srv.world # mount Manila shared storage [centos@centos-7 ~]$ sudo mount -t nfs \ 10.254.0.11:/shares/share-15db92a3-4e21-4efc-9c36-bbcc65002662 /mnt [centos@centos-7 ~]$ df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/cl-root xfs 8.0G 1.1G 7.0G 14% / devtmpfs devtmpfs 990M 0 990M 0% /dev tmpfs tmpfs 1001M 0 1001M 0% /dev/shm tmpfs tmpfs 1001M 8.4M 992M 1% /run tmpfs tmpfs 1001M 0 1001M 0% /sys/fs/cgroup /dev/vda1 xfs 1014M 121M 894M 12% /boot tmpfs tmpfs 201M 0 201M 0% /run/user/1000 10.254.0.11:/shares/share-15db92a3-4e21-4efc-9c36-bb... nfs4 976M 1.3M 908M 1% /mnt |
Sponsored Link |