CentOS Stream 9
Sponsored Link

OpenStack Zed : How to use Manila (Local Device)2022/11/11

 
This is How to use OpenStack Shared File System (Manila).
This example is based on the environment like follows.
For example, Configure local block device as shared storage on Storage Node and use it from Instances.
Therefore, it needs there is a free block device on Storage Node.
------------+-----------------------------+-----------------------------+------------
            |                             |                             |
        eth0|10.0.0.30                eth0|10.0.0.50                eth0|10.0.0.51
+-----------+-----------+     +-----------+-----------+     +-----------+-----------+
|   [ dlp.srv.world ]   |     | [ network.srv.world ] |     |  [ node01.srv.world ] |
|     (Control Node)    |     |     (Network Node)    |     |     (Compute Node)    |
|                       |     |                       |     |                       |
|  MariaDB    RabbitMQ  |     |      Open vSwitch     |     |        Libvirt        |
|  Memcached  Nginx     |     |     Neutron Server    |     |      Nova Compute     |
|  Keystone   httpd     |     |      OVN-Northd       |     |      Open vSwitch     |
|  Glance     Nova API  |     |  Nginx  iSCSI Target  |     |   OVN Metadata Agent  |
|  Cinder API           |     |     Cinder Volume     |     |     OVN-Controller    |
|  Manila API           |     |      Manila Share     |     |                       |
+-----------------------+     +-----------------------+     +-----------------------+

[1] Configure Storage Node.
[root@network ~]#
dnf -y install nfs-utils nfs4-acl-tools
# create a volume for Manila on free block device

[root@network ~]#
pvcreate /dev/sdc1

  Physical volume "/dev/sdc1" successfully created
[root@network ~]#
vgcreate manila-volumes /dev/sdc1

  Volume group "manila-volumes" successfully created
[root@network ~]#
vi /etc/manila/manila.conf
# add follows into [DEFAULT] section

enabled_share_backends = lvm
# add to the end

[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_ips = $my_ip
[root@network ~]#
systemctl enable --now openstack-manila-share nfs-server
[2] Create default share type.
It's OK to work on any node. (example below is on Control Node)
[root@dlp ~(keystone)]#
manila type-create default_share_type False

+----------------------+--------------------------------------+
| Property             | Value                                |
+----------------------+--------------------------------------+
| ID                   | 583e5373-7a15-4e52-a0fd-2c75cac1bc5b |
| Name                 | default_share_type                   |
| Visibility           | public                               |
| is_default           | YES                                  |
| required_extra_specs | driver_handles_share_servers : False |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+

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

+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
| ID                                   | Name               | visibility | is_default | required_extra_specs                 | optional_extra_specs | Description |
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
| 583e5373-7a15-4e52-a0fd-2c75cac1bc5b | default_share_type | public     | YES        | driver_handles_share_servers : False |                      | None        |
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
[3] Login as a common user to create Manila NFS Share.
[cent@dlp ~(keystone)]$
manila create NFS 10 --name share01 --share-type default_share_type

+---------------------------------------+--------------------------------------+
| Property                              | Value                                |
+---------------------------------------+--------------------------------------+
| id                                    | 8b9da165-feb8-4d0a-b8b7-1adabe937624 |
| size                                  | 10                                   |
| availability_zone                     | None                                 |
| created_at                            | 2022-11-11T02:37:44.529860           |
| status                                | creating                             |
| name                                  | share01                              |
| description                           | None                                 |
| project_id                            | 28b6e37c787240e4a975d3614821cc71     |
| snapshot_id                           | None                                 |
| share_network_id                      | None                                 |
| share_proto                           | NFS                                  |
| metadata                              | {}                                   |
| share_type                            | 583e5373-7a15-4e52-a0fd-2c75cac1bc5b |
| 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                               | 9e8824a151c949ad9105535ead452501     |
| 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                                 |
| is_soft_deleted                       | False                                |
| scheduled_to_be_deleted_at            | None                                 |
+---------------------------------------+--------------------------------------+

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

[cent@dlp ~(keystone)]$
manila list

+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
| ID                                   | Name    | Size | Share Proto | Status    | Is Public | Share Type Name    | Host | Availability Zone |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
| 8b9da165-feb8-4d0a-b8b7-1adabe937624 | share01 | 10   | NFS         | available | False     | default_share_type |      | nova              |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
[4] That's OK, you can use Manila Shared filesystem on your own instances like follows.
[cent@dlp ~(keystone)]$
openstack server list

+--------------------------------------+------------+---------+------------------------------------+----------------+----------+
| ID                                   | Name       | Status  | Networks                           | Image          | Flavor   |
+--------------------------------------+------------+---------+------------------------------------+----------------+----------+
| 158685ed-8159-4aad-a294-3227b427f7e1 | CentOS-St9 | SHUTOFF | private=10.0.0.218, 192.168.100.75 | CentOS-Stream9 | m1.small |
+--------------------------------------+------------+---------+------------------------------------+----------------+----------+

# set access permission first

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

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| id           | 345bf266-12f5-4188-b468-c9de811d3fd8 |
| share_id     | 8b9da165-feb8-4d0a-b8b7-1adabe937624 |
| access_level | rw                                   |
| access_to    | 10.0.0.0/24                          |
| access_type  | ip                                   |
| state        | queued_to_apply                      |
| access_key   | None                                 |
| created_at   | 2022-11-11T02:39:07.412864           |
| updated_at   | None                                 |
| 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 |
+--------------------------------------+-------------+-------------+--------------+--------+------------+----------------------------+------------+
| 345bf266-12f5-4188-b468-c9de811d3fd8 | ip          | 10.0.0.0/24 | rw           | active | None       | 2022-11-11T02:39:07.412864 | None       |
+--------------------------------------+-------------+-------------+--------------+--------+------------+----------------------------+------------+

[cent@dlp ~(keystone)]$
openstack server start CentOS-St9

# confirm access Path

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

 path = 10.0.0.50:/var/lib/manila/mnt/share-e3a0b046-fe16-495d-9c9d-cdfb9f22bc44

[cent@dlp ~(keystone)]$
ssh centos@10.0.0.218

Last login: Thu Nov 10 15:42:10 2022 from 10.0.0.30
[centos@centos-st9 ~]$
# mount Manila shared storage

[centos@centos-st9 ~]$
sudo mount -t nfs \
10.0.0.50:/var/lib/manila/mnt/share-e3a0b046-fe16-495d-9c9d-cdfb9f22bc44 /mnt

[centos@centos-st9 ~]$
df -hT

Filesystem                                                               Type      Size  Used Avail Use% Mounted on
devtmpfs                                                                 devtmpfs  961M     0  961M   0% /dev
tmpfs                                                                    tmpfs     981M     0  981M   0% /dev/shm
tmpfs                                                                    tmpfs     393M  5.5M  387M   2% /run
/dev/mapper/cs-root                                                      xfs       8.0G  1.7G  6.4G  21% /
/dev/vda1                                                                xfs      1014M  191M  824M  19% /boot
tmpfs                                                                    tmpfs     197M     0  197M   0% /run/user/1000
10.0.0.50:/var/lib/manila/mnt/share-e3a0b046-fe16-495d-9c9d-cdfb9f22bc44 nfs4      9.8G     0  9.3G   0% /mnt

[centos@centos-st9 ~]$
echo "manila write test" > /mnt/testfile.txt

[centos@centos-st9 ~]$
cat /mnt/testfile.txt

manila write test
Matched Content