Ubuntu 22.04
Sponsored Link

OpenStack Caracal : Manila 利用 (ローカルデバイス)2024/04/10

 
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  |  |  Neutron L2/L3 Agent  |  |        Libvirt        |
|  Memcached  Nginx     |  |   Neutron Metadata    |  |      Nova Compute     |
|  Keystone   httpd     |  |     Open vSwitch      |  |    Neutron L2 Agent   |
|  Glance     Nova API  |  |     iSCSI Target      |  |      Open vSwitch     |
|  Neutron Server       |  |     Cinder Volume     |  |                       |
|  Neutron Metadata     |  |     Manila Share      |  |                       |
| Cinder API Manila API |  |                       |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] Storage ノードの設定です。
root@network:~#
apt -y install lvm2 nfs-kernel-server
# 空きデバイスに 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 restart manila-share nfs-server

root@network:~#
systemctl enable manila-share nfs-server
[2] デフォルトの共有タイプを作成します。作業は、どこでもよいですが、当例ではコントロールノード上で行います。
root@dlp ~(keystone)#
openstack share type create default_share_type False

+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| id                   | 4cbe6b50-2a87-41f3-9518-9af5948620fd |
| 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 |
+----------+----------+------------+------------+----------------------+----------------------+-------------+
| 4cbe6b50 | default_ | public     | True       | driver_handles_share |                      | None        |
| -2a87-   | share_ty |            |            | _servers : False     |                      |             |
| 41f3-    | pe       |            |            |                      |                      |             |
| 9518-    |          |            |            |                      |                      |             |
| 9af59486 |          |            |            |                      |                      |             |
| 20fd     |          |            |            |                      |                      |             |
+----------+----------+------------+------------+----------------------+----------------------+-------------+
[3] 共有を作成して自身が所有するインスタンスで利用したい任意のユーザーで、NFS 共有を作成します。
ubuntu@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-04-10T00:57:03.357548           |
| description                           | None                                 |
| has_replicas                          | False                                |
| id                                    | 44809b48-06ba-4315-a0ca-0b8f5e26a380 |
| is_public                             | False                                |
| is_soft_deleted                       | False                                |
| metadata                              | {}                                   |
| mount_snapshot_support                | False                                |
| name                                  | share01                              |
| progress                              | None                                 |
| project_id                            | 2bcdd2fecf1d4a8c8faf87f1232cf365     |
| 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                            | 4cbe6b50-2a87-41f3-9518-9af5948620fd |
| 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                               | e682843492a44937b745ef945bfacf70     |
| volume_type                           | default_share_type                   |
+---------------------------------------+--------------------------------------+

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

ubuntu@dlp ~(keystone)$
openstack share list

+----------+---------+------+-------------+----------+-----------+-----------------+------+-------------------+
| ID       | Name    | Size | Share Proto | Status   | Is Public | Share Type Name | Host | Availability Zone |
+----------+---------+------+-------------+----------+-----------+-----------------+------+-------------------+
| 44809b48 | share01 |   10 | NFS         | availabl | False     | default_share_t |      | nova              |
| -06ba-   |         |      |             | e        |           | ype             |      |                   |
| 4315-    |         |      |             |          |           |                 |      |                   |
| a0ca-    |         |      |             |          |           |                 |      |                   |
| 0b8f5e26 |         |      |             |          |           |                 |      |                   |
| a380     |         |      |             |          |           |                 |      |                   |
+----------+---------+------+-------------+----------+-----------+-----------------+------+-------------------+
[4] 以上で、共有を作成したユーザーが所有するインスタンスから Manila の共有サービスを利用することができます。
ubuntu@dlp ~(keystone)$
openstack server list

+--------------+-------------+---------+--------------+------------+----------+
| ID           | Name        | Status  | Networks     | Image      | Flavor   |
+--------------+-------------+---------+--------------+------------+----------+
| e7feb65c-    | Ubuntu-2204 | SHUTOFF | private=10.0 | Ubuntu2204 | m1.small |
| 1482-48a9-   |             |         | .0.250, 192. |            |          |
| 9d45-        |             |         | 168.100.188  |            |          |
| e74196a5ea92 |             |         |              |            |          |
+--------------+-------------+---------+--------------+------------+----------+

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

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

+--------------+--------------------------------------+
| Field        | Value                                |
+--------------+--------------------------------------+
| id           | 67095110-f4cf-4eb2-9610-350df31319a0 |
| share_id     | 44809b48-06ba-4315-a0ca-0b8f5e26a380 |
| access_level | rw                                   |
| access_to    | 10.0.0.0/24                          |
| access_type  | ip                                   |
| state        | queued_to_apply                      |
| access_key   | None                                 |
| created_at   | 2024-04-10T00:58:06.457775           |
| updated_at   | None                                 |
| properties   |                                      |
+--------------+--------------------------------------+

# State が [active] であれば OK

ubuntu@dlp ~(keystone)$
openstack share access list share01

+----------+-------------+-----------+--------------+--------+------------+------------+------------+
| ID       | Access Type | Access To | Access Level | State  | Access Key | Created At | Updated At |
+----------+-------------+-----------+--------------+--------+------------+------------+------------+
| 67095110 | ip          | 10.0.0.0/ | rw           | active | None       | 2024-04-   | 2024-04-   |
| -f4cf-   |             | 24        |              |        |            | 10T00:58:0 | 10T00:58:0 |
| 4eb2-    |             |           |              |        |            | 6.457775   | 7.479117   |
| 9610-    |             |           |              |        |            |            |            |
| 350df313 |             |           |              |        |            |            |            |
| 19a0     |             |           |              |        |            |            |            |
+----------+-------------+-----------+--------------+--------+------------+------------+------------+

ubuntu@dlp ~(keystone)$
openstack server start Ubuntu-2204

# アクセス Path 確認

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

 path = 10.0.0.50:/var/lib/manila/mnt/share-5762d49d-bdd2-4f0d-bc9f-9408a72df196

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

Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-101-generic x86_64)

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

.....
.....

# Manila 共有ストレージをマウント

ubuntu@ubuntu-2204:~$
sudo mount -t nfs \
10.0.0.50:/var/lib/manila/mnt/share-5762d49d-bdd2-4f0d-bc9f-9408a72df196 /mnt

ubuntu@ubuntu-2204:~$
df -hT

Filesystem                                                               Type   Size  Used Avail Use% Mounted on
tmpfs                                                                    tmpfs  392M  1.1M  391M   1% /run
/dev/vda1                                                                ext4   9.6G  1.7G  7.9G  17% /
tmpfs                                                                    tmpfs  2.0G     0  2.0G   0% /dev/shm
tmpfs                                                                    tmpfs  5.0M     0  5.0M   0% /run/lock
/dev/vda15                                                               vfat   105M  6.1M   99M   6% /boot/efi
tmpfs                                                                    tmpfs  392M  4.0K  392M   1% /run/user/1001
10.0.0.50:/var/lib/manila/mnt/share-5762d49d-bdd2-4f0d-bc9f-9408a72df196 nfs4   9.8G     0  9.3G   0% /mnt
関連コンテンツ