CentOS Stream 9
Sponsored Link

OpenStack Caracal : Manila 利用方法 (ローカルデバイス)2024/08/07

 

OpenStack Shared File System(Manila)による共有の設定です。

当例では以下のような環境を例に Manila をインストールして設定しています。

例として、Storage ノードのローカルブロックデバイスを LVM バックエンドの共有ストレージとして設定し、インスタンスから利用できるようにします。 よって、前提として Storage ノードに空きブロックデバイスがある必要があります。

------------+--------------------------+--------------------------+------------
            |                          |                          |
        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 Manila API |  |     Cinder Volume     |  |     OVN-Controller    |
|                       |  |     Manila Share      |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] Storage ノードの設定です。
[root@network ~]#
dnf -y install nfs-utils nfs4-acl-tools
# 空きデバイスに Manila 用ボリューム作成

[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
# [DEFAULT] セクション内の任意の場所へ追記

enabled_share_backends = lvm
# 最終行へ追記

[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] デフォルトの共有タイプを作成します。
作業は、どこでもよいですが、当例ではコントロールノード上で行います。
[root@dlp ~(keystone)]#
openstack share type create default_share_type False

+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| id                   | 2994662e-e5ca-4e9d-b105-f0975c9ff3ea |
| name                 | default_share_type                   |
| visibility           | public                               |
| is_default           | True                                 |
| required_extra_specs | driver_handles_share_servers : False |
| optional_extra_specs |                                      |
| description          | None                                 |
+----------------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack share type list

+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
| ID                                   | Name               | Visibility | Is Default | Required Extra Specs                 | Optional Extra Specs | Description |
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
| 2994662e-e5ca-4e9d-b105-f0975c9ff3ea | default_share_type | public     | True       | driver_handles_share_servers : False |                      | None        |
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
[3] 共有を作成して自身が所有するインスタンスで利用したい任意のユーザーで、NFS 共有を作成します。
[cent@dlp ~(keystone)]$
openstack share create NFS 10 --name share01 --share-type default_share_type

+---------------------------------------+--------------------------------------+
| Field                                 | Value                                |
+---------------------------------------+--------------------------------------+
| access_rules_status                   | active                               |
| availability_zone                     | None                                 |
| create_share_from_snapshot_support    | False                                |
| created_at                            | 2024-08-07T06:49:34.554943           |
| description                           | None                                 |
| has_replicas                          | False                                |
| id                                    | 185fd0e5-b9d9-464d-859a-3bbcec0a41f4 |
| is_public                             | False                                |
| is_soft_deleted                       | False                                |
| metadata                              | {}                                   |
| mount_snapshot_support                | False                                |
| name                                  | share01                              |
| progress                              | None                                 |
| project_id                            | 03a31c43ede44dcbaacb05c870920e81     |
| replication_type                      | None                                 |
| revert_to_snapshot_support            | False                                |
| scheduled_to_be_deleted_at            | None                                 |
| share_group_id                        | None                                 |
| share_network_id                      | None                                 |
| share_proto                           | NFS                                  |
| share_type                            | 2994662e-e5ca-4e9d-b105-f0975c9ff3ea |
| share_type_name                       | default_share_type                   |
| size                                  | 10                                   |
| snapshot_id                           | None                                 |
| snapshot_support                      | False                                |
| source_backup_id                      | None                                 |
| source_share_group_snapshot_member_id | None                                 |
| status                                | creating                             |
| task_state                            | None                                 |
| user_id                               | 8a9b46168b42480f889ad4fad3ca6ee4     |
| volume_type                           | default_share_type                   |
+---------------------------------------+--------------------------------------+

# Status が [available] になれば作成完了

[cent@dlp ~(keystone)]$
openstack share list

+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
| ID                                   | Name    | Size | Share Proto | Status    | Is Public | Share Type Name    | Host | Availability Zone |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
| 185fd0e5-b9d9-464d-859a-3bbcec0a41f4 | share01 |   10 | NFS         | available | False     | default_share_type |      | nova              |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
[4] 以上で、共有を作成したユーザーが所有するインスタンスから Manila の共有サービスを利用することができます。
[cent@dlp ~(keystone)]$
openstack server list

+--------------------------------------+------------+---------+------------------------------------+----------------+----------+
| ID                                   | Name       | Status  | Networks                           | Image          | Flavor   |
+--------------------------------------+------------+---------+------------------------------------+----------------+----------+
| 1d0c2140-098d-4a1a-a705-82d7755d7c84 | CentOS-St9 | SHUTOFF | private=10.0.0.250, 192.168.100.65 | CentOS-Stream9 | m1.small |
+--------------------------------------+------------+---------+------------------------------------+----------------+----------+

# アクセス許可の設定 (IP にはインスタンスの IP アドレス または インスタンスが属するサブネットを指定)

[cent@dlp ~(keystone)]$
openstack share access create share01 ip 10.0.0.0/24 --access-level rw

+--------------+--------------------------------------+
| Field        | Value                                |
+--------------+--------------------------------------+
| id           | 6a0af25a-d7ce-4734-a3f8-ba0a82aee161 |
| share_id     | 185fd0e5-b9d9-464d-859a-3bbcec0a41f4 |
| access_level | rw                                   |
| access_to    | 10.0.0.0/24                          |
| access_type  | ip                                   |
| state        | queued_to_apply                      |
| access_key   | None                                 |
| created_at   | 2024-08-07T06:50:33.134933           |
| updated_at   | None                                 |
| properties   |                                      |
+--------------+--------------------------------------+

# State が [active] であれば問題なし

[cent@dlp ~(keystone)]$
openstack share access list share01

+--------------------------------------+-------------+-------------+--------------+--------+------------+----------------------------+----------------------------+
| ID                                   | Access Type | Access To   | Access Level | State  | Access Key | Created At                 | Updated At                 |
+--------------------------------------+-------------+-------------+--------------+--------+------------+----------------------------+----------------------------+
| 6a0af25a-d7ce-4734-a3f8-ba0a82aee161 | ip          | 10.0.0.0/24 | rw           | active | None       | 2024-08-07T06:50:33.134933 | 2024-08-07T06:50:34.506685 |
+--------------------------------------+-------------+-------------+--------------+--------+------------+----------------------------+----------------------------+

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

# アクセス Path 確認

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

 path = 10.0.0.50:/var/lib/manila/mnt/share-be643066-09c5-4845-a3e1-abe18bbc2d8e

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

Last login: Wed Aug 7 00:47:14 2024 from 10.0.0.30
[centos@centos-st9 ~]$
# Manila 共有ストレージをマウント

[centos@centos-st9 ~]$
sudo mount -t nfs \
10.0.0.50:/var/lib/manila/mnt/share-be643066-09c5-4845-a3e1-abe18bbc2d8e /mnt

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

Filesystem                                                               Type      Size  Used Avail Use% Mounted on
devtmpfs                                                                 devtmpfs  4.0M     0  4.0M   0% /dev
tmpfs                                                                    tmpfs     1.8G     0  1.8G   0% /dev/shm
tmpfs                                                                    tmpfs     732M  8.6M  723M   2% /run
/dev/mapper/cs-root                                                      xfs       8.0G  2.1G  5.9G  27% /
/dev/vda1                                                                xfs       960M  322M  639M  34% /boot
tmpfs                                                                    tmpfs     366M     0  366M   0% /run/user/1001
10.0.0.50:/var/lib/manila/mnt/share-be643066-09c5-4845-a3e1-abe18bbc2d8e 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
関連コンテンツ