Ubuntu 20.04
Sponsored Link

OpenStack Ussuri : How to use Manila (Designed Instance)2020/06/18

 
This is How to use OpenStack Shared File System (Manila).
This example is based on the environment 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  |   |     Cinder-Volume     |   |        Libvirt        |
|  Memcached  httpd     |   |        L2 Agent       |   |     Nova Compute      |
|  Keystone   Glance    |   |        L3 Agent       |   |        L2 Agent       |
|  Nova API  Cinder API |   |     Metadata Agent    |   |                       |
|  Neutron Server       |   |      Manila Share     |   |                       |
|  Metadata Agent       |   |                       |   |                       |
|  Manila API           |   |                       |   |                       |
+-----------------------+   +-----------------------+   +-----------------------+

[1]
[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.BridgeInterfaceDriver
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@storage:~#
systemctl restart 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)#
wget https://tarballs.opendev.org/openstack/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         | 86ff39a9ffe1fbf0d35557d81ea01d51                                               |
| container_format | bare                                                                           |
| created_at       | 2020-06-18T00:36:02Z                                                           |
| disk_format      | qcow2                                                                          |
| file             | /v2/images/0a5e4628-aa7c-4e1f-b785-0418259e7df2/file                           |
| id               | 0a5e4628-aa7c-4e1f-b785-0418259e7df2                                           |
| min_disk         | 0                                                                              |
| min_ram          | 0                                                                              |
| name             | manila-service-image                                                           |
| owner            | 3227cdd34d5c4d9c97eeb8f0dfdf5d0e                                               |
| properties       | os_hash_algo='sha512', os_hash_value='a7f284913fd4f4447f8108603b1d634d5f7a79e8 |
| protected        | False                                                                          |
| schema           | /v2/schemas/image                                                              |
| size             | 468320256                                                                      |
| status           | active                                                                         |
| tags             |                                                                                |
| updated_at       | 2020-06-18T00:36:05Z                                                           |
| visibility       | public                                                                         |
+------------------+--------------------------------------------------------------------------------+

root@dlp ~(keystone)#
openstack security group create --project service manila-service

+-----------------+---------------------------------------------------------------------------------+
| Field           | Value                                                                           |
+-----------------+---------------------------------------------------------------------------------+
| created_at      | 2020-06-18T00:36:43Z                                                            |
| description     | manila-service                                                                  |
| id              | e40f3ea5-259a-4c64-a22b-742097178ae9                                            |
| location        | cloud='', project.domain_id=, project.domain_name=, project.id='c0e098a54a4640c |
| name            | manila-service                                                                  |
| project_id      | c0e098a54a4640caa9004fb8f500f554                                                |
| revision_number | 1                                                                               |
| rules           | created_at='2020-06-18T00:36:43Z', direction='egress', ethertype='IPv6', id=... |
|                 | created_at='2020-06-18T00:36:43Z', direction='egress', ethertype='IPv4', id=... |
| stateful        | True                                                                            |
| tags            | []                                                                              |
| updated_at      | 2020-06-18T00:36:43Z                                                            |
+-----------------+---------------------------------------------------------------------------------+

# 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                                |
+----------------------+--------------------------------------+
| ID                   | b4f761a9-f04d-4ff9-afe0-638b44571bd0 |
| Name                 | default_share_type                   |
| Visibility           | public                               |
| is_default           | YES                                  |
| required_extra_specs | driver_handles_share_servers : True  |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+

root@dlp ~(keystone)#
manila type-list

+--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+
| ID                                   | Name               | visibility | is_default | required_extra_specs                | optional_extra_specs | Description |
+--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+
| b4f761a9-f04d-4ff9-afe0-638b44571bd0 | 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.
ubuntu@dlp ~(keystone)$
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 1f3f1f9b-4822-4312-b5a5-51a529cd6e8a | ext_net | ddfcdd10-7ecb-4239-b3d7-46fdd15a006d |
| b351e1b9-bd7c-4e3c-b5eb-848d211f4392 | int_net | e2a461fc-9d50-4bab-913f-14067b175ea6 |
+--------------------------------------+---------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack subnet list

+--------------------------------------+---------+--------------------------------------+------------------+
| ID                                   | Name    | Network                              | Subnet           |
+--------------------------------------+---------+--------------------------------------+------------------+
| e2a461fc-9d50-4bab-913f-14067b175ea6 | subnet1 | b351e1b9-bd7c-4e3c-b5eb-848d211f4392 | 192.168.100.0/24 |
+--------------------------------------+---------+--------------------------------------+------------------+

ubuntu@dlp ~(keystone)$
INT_NET=$(openstack network list | grep 'int_net' | awk '{print $2}')

ubuntu@dlp ~(keystone)$
INT_SUBNET=$(openstack subnet list | grep 'subnet1' | awk '{print $2}')
ubuntu@dlp ~(keystone)$
manila share-network-create --neutron-net-id $INT_NET --neutron-subnet-id $INT_SUBNET --name manila_share

+-----------------------+---------------------------------------------------------------------------+
| Property              | Value                                                                     |
+-----------------------+---------------------------------------------------------------------------+
| id                    | c54808bb-0f9a-4910-bda4-008cfcadcd48                                      |
| name                  | manila_share                                                              |
| project_id            | eaa8de359ae0451d944a6401e688f730                                          |
| created_at            | 2020-06-18T00:39:01.000000                                                |
| updated_at            | None                                                                      |
| description           | None                                                                      |
| share_network_subnets | [{'id': '99d08614-91a5-49f0-b691-222b49be615a', 'availability_zone': N... |
+-----------------------+---------------------------------------------------------------------------+

ubuntu@dlp ~(keystone)$
manila share-network-list

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| c54808bb-0f9a-4910-bda4-008cfcadcd48 | manila_share |
+--------------------------------------+--------------+
[6] Create NFS share.
ubuntu@dlp ~(keystone)$
manila create NFS 5 --name share01 --share-network manila_share

+---------------------------------------+--------------------------------------+
| Property                              | Value                                |
+---------------------------------------+--------------------------------------+
| id                                    | 28ab0c70-f59a-4f90-b391-aecd23b6971b |
| size                                  | 5                                    |
| availability_zone                     | None                                 |
| created_at                            | 2020-06-18T00:40:46.000000           |
| status                                | creating                             |
| name                                  | share01                              |
| description                           | None                                 |
| project_id                            | eaa8de359ae0451d944a6401e688f730     |
| snapshot_id                           | None                                 |
| share_network_id                      | c54808bb-0f9a-4910-bda4-008cfcadcd48 |
| share_proto                           | NFS                                  |
| metadata                              | {}                                   |
| share_type                            | b4f761a9-f04d-4ff9-afe0-638b44571bd0 |
| 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                               | 2a1e722c971c45d384efe048155d89c7     |
| 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                                 |
+---------------------------------------+--------------------------------------+

# OK if the Status turns to [available] after a few minutes

ubuntu@dlp ~(keystone)$
manila list

+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
| ID                                   | Name    | Size | Share Proto | Status    | Is Public | Share Type Name    | Host | Availability Zone |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
| 28ab0c70-f59a-4f90-b391-aecd23b6971b | share01 | 5    | 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

.....
.....
10: ns-cf787217-72@tapcf787217-72: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether fa:16:3e:11:8d:9d brd ff:ff:ff:ff:ff:ff
    inet 10.254.0.16/24 brd 10.254.0.255 scope global ns-cf787217-72
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fe11:8d9d/64 scope link
       valid_lft forever preferred_lft forever
.....
.....
[8] That's OK, you can use Manila Shared filesystem from your own instances like follows.
ubuntu@dlp ~(keystone)$
openstack server list

+--------------------------------------+-------------+---------+-------------------------------------+------------+----------+
| ID                                   | Name        | Status  | Networks                            | Image      | Flavor   |
+--------------------------------------+-------------+---------+-------------------------------------+------------+----------+
| 2dde6728-0e9a-4bd1-b10a-196162ec5e2a | Ubuntu_2004 | SHUTOFF | int_net=192.168.100.216, 10.0.0.210 | Ubuntu2004 | m1.small |
+--------------------------------------+-------------+---------+-------------------------------------+------------+----------+

# set access permission first

ubuntu@dlp ~(keystone)$
manila access-allow share01 ip 10.0.0.0/24 --access-level rw

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| id           | 3ecf6b4f-774b-484e-aa24-367a583ef023 |
| share_id     | 28ab0c70-f59a-4f90-b391-aecd23b6971b |
| access_level | rw                                   |
| access_to    | 10.0.0.0/24                          |
| access_type  | ip                                   |
| state        | queued_to_apply                      |
| access_key   | None                                 |
| created_at   | 2020-06-18T00:45:39.000000           |
| updated_at   | None                                 |
+--------------+--------------------------------------+

# OK if State turns to [active]

ubuntu@dlp ~(keystone)$
manila access-list share01

+--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+
| id                                   | access_type | access_to        | access_level | state  | access_key | created_at                 | updated_at |
+--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+
| 3ecf6b4f-774b-484e-aa24-367a583ef023 | ip          | 10.0.0.0/24      | rw           | active | None       | 2020-06-18T00:45:39.000000 | None       |
| b02a0a39-e24e-47b0-812c-26840a87024d | ip          | 192.168.100.0/24 | rw           | active | None       | 2020-06-18T00:45:55.000000 | None       |
+--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+

ubuntu@dlp ~(keystone)$
openstack server start Ubuntu_2004

# confirm access Path

ubuntu@dlp ~(keystone)$
manila show share01 | grep path | cut -d'|' -f3

 path = 10.254.0.215:/shares/share-102e10e9-8c24-42c4-b2e8-abd52af4b5d2

ubuntu@dlp ~(keystone)$
ssh ubuntu@10.0.0.210

Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-33-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu 18 Jun 2020 09:48:01 AM JST

  System load:  0.56              Processes:             104
  Usage of /:   24.2% of 8.34GB   Users logged in:       0
  Memory usage: 7%                IPv4 address for ens3: 192.168.100.216
  Swap usage:   0%


31 updates can be installed immediately.
21 of these updates are security updates.
To see these additional updates run: apt list --upgradable

# mount Manila shared storage

ubuntu@ubuntu-2004:~$
sudo mount -t nfs \
10.254.0.215:/shares/share-102e10e9-8c24-42c4-b2e8-abd52af4b5d2 /mnt

ubuntu@ubuntu-2004:~$
df -hT

Filesystem                                                      Type      Size  Used Avail Use% Mounted on
udev                                                            devtmpfs  952M     0  952M   0% /dev
tmpfs                                                           tmpfs     199M  716K  199M   1% /run
/dev/mapper/vgubuntu-root                                       ext4      8.4G  2.1G  5.9G  26% /
tmpfs                                                           tmpfs     994M     0  994M   0% /dev/shm
tmpfs                                                           tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs                                                           tmpfs     994M     0  994M   0% /sys/fs/cgroup
/dev/vda1                                                       vfat      511M  4.0K  511M   1% /boot/efi
tmpfs                                                           tmpfs     199M     0  199M   0% /run/user/1000
10.254.0.215:/shares/share-102e10e9-8c24-42c4-b2e8-abd52af4b5d2 nfs4      4.9G   20M  4.6G   1% /mnt
Matched Content