CentOS 7
Sponsored Link

OpenStack Rocky : Manila 利用方法#2
2018/09/04
 
OpenStack Shared File System(Manila)による共有の設定です。
当例では以下のような環境を例に Manila をインストールして設定しています。
例として、専用のインスタンスを利用した NFS 共有を設定します。
------------+---------------------------+---------------------------+------------
            |                           |                           |
        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]
[2] Storage ノードの設定です。
[root@storage ~]#
vi /etc/manila/manila.conf
# [DEFAULT] セクション内の任意の場所へ追記

enabled_share_backends = generic

# 最終行へ追記
[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
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
interface_driver = manila.network.linux.interface.OVSInterfaceDriver

[root@storage ~]#
systemctl start openstack-manila-share

[root@storage ~]#
systemctl enable openstack-manila-share
[3] Manila のサービスイメージをダウンロードして、Glance に登録しておきます。また Manilaサービス用のセキィリティグループも作成しておきます。作業場所はどこでも良いですが当例では Control ノード上で行います。
[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         | 529eb4279ca523edba8dc1bb23529b31                                                                                                                                                           |
| container_format | bare                                                                                                                                                                                       |
| created_at       | 2018-09-04T02:54:00Z                                                                                                                                                                       |
| disk_format      | qcow2                                                                                                                                                                                      |
| file             | /v2/images/3ed6060c-9a23-4366-aa08-ceeff5bff2cb/file                                                                                                                                       |
| id               | 3ed6060c-9a23-4366-aa08-ceeff5bff2cb                                                                                                                                                       |
| min_disk         | 0                                                                                                                                                                                          |
| min_ram          | 0                                                                                                                                                                                          |
| name             | manila-service-image                                                                                                                                                                       |
| owner            | 2cb4b9d73bcc46449f711794506c3faf                                                                                                                                                           |
| properties       | os_hash_algo='sha512', os_hash_value='e4d9703f681095bf52f13324346d87cbae2323ea51fba5c94e2ccf68e6e686a92874b49d9bfdcc2d1595d0e7607836d7e54fb0c8a6cca3950512958abdf2b654', os_hidden='False' |
| protected        | False                                                                                                                                                                                      |
| schema           | /v2/schemas/image                                                                                                                                                                          |
| size             | 338506752                                                                                                                                                                                  |
| status           | active                                                                                                                                                                                     |
| tags             |                                                                                                                                                                                            |
| updated_at       | 2018-09-04T02:54:03Z                                                                                                                                                                       |
| virtual_size     | None                                                                                                                                                                                       |
| visibility       | public                                                                                                                                                                                     |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

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

+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field           | Value                                                                                                                                                 |
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at      | 2018-09-04T02:55:04Z                                                                                                                                  |
| description     | manila-service                                                                                                                                        |
| id              | 6cf5a2e5-42ce-4695-93e0-491bef01050c                                                                                                                  |
| name            | manila-service                                                                                                                                        |
| project_id      | 2cb4b9d73bcc46449f711794506c3faf                                                                                                                      |
| revision_number | 1                                                                                                                                                     |
| rules           | created_at='2018-09-04T02:55:04Z', direction='egress', ethertype='IPv4', id='132a3152-4eb1-4fd2-98d4-cbd3501bb09f', updated_at='2018-09-04T02:55:04Z' |
|                 | created_at='2018-09-04T02:55:04Z', direction='egress', ethertype='IPv6', id='b22fdb9b-b7ed-4d47-8084-9c9e116fd170', updated_at='2018-09-04T02:55:04Z' |
| tags            | []                                                                                                                                                    |
| updated_at      | 2018-09-04T02:55:04Z                                                                                                                                  |
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
[4] デフォルトの共有タイプを作成します。
[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           | YES                                  |
| ID                   | ae750d39-a399-42f3-9a13-03fce322329b |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+

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

+--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+
| ID                                   | Name               | visibility | is_default | required_extra_specs                | optional_extra_specs | Description |
+--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+
| ae750d39-a399-42f3-9a13-03fce322329b | default_share_type | public     | YES        | driver_handles_share_servers : True |                      | None        |
+--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+
[5] 以降は共有を作成して自身が所有するインスタンスで利用したい任意のユーザーで作業します。まずは共有ネットワークを作成しておきます。
[cent@dlp ~(keystone)]$
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 2f05bc33-a661-4882-b6f3-857d14f37165 | int_net | d6c87a6c-b773-473c-8371-4220594eff2c |
| b2873d6d-3081-49f2-a893-0fa135962c9c | ext_net | 7dd8e915-6885-4ecb-8157-41e6de0b6498 |
+--------------------------------------+---------+--------------------------------------+

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

+--------------------------------------+---------+--------------------------------------+------------------+
| ID                                   | Name    | Network                              | Subnet           |
+--------------------------------------+---------+--------------------------------------+------------------+
| d6c87a6c-b773-473c-8371-4220594eff2c | subnet1 | 2f05bc33-a661-4882-b6f3-857d14f37165 | 192.168.100.0/24 |
+--------------------------------------+---------+--------------------------------------+------------------+

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

[cent@dlp ~(keystone)]$
INT_SUBNET=$(openstack subnet list | grep 'subnet1' | awk '{print $2}')
[cent@dlp ~(keystone)]$
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        | 2018-09-04T02:56:49.127449           |
| neutron_subnet_id | d6c87a6c-b773-473c-8371-4220594eff2c |
| updated_at        | None                                 |
| mtu               | None                                 |
| gateway           | None                                 |
| neutron_net_id    | 2f05bc33-a661-4882-b6f3-857d14f37165 |
| ip_version        | None                                 |
| cidr              | None                                 |
| project_id        | 3c9dc9d8d71149a7b835e1f5813d2eb8     |
| id                | 6e758fd1-e212-45de-b777-1ea9c5a1dc1e |
| description       | None                                 |
+-------------------+--------------------------------------+

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

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| 6e758fd1-e212-45de-b777-1ea9c5a1dc1e | manila_share |
+--------------------------------------+--------------+
[6] NFS 共有を作成します。
[cent@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                      | 6e758fd1-e212-45de-b777-1ea9c5a1dc1e |
| share_group_id                        | None                                 |
| 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                                    | 93e394cb-139f-423f-b2cf-87c6359665be |
| size                                  | 1                                    |
| source_share_group_snapshot_member_id | None                                 |
| user_id                               | e2252ff04be3409e8e823a0a3a925cad     |
| name                                  | share01                              |
| share_type                            | ae750d39-a399-42f3-9a13-03fce322329b |
| has_replicas                          | False                                |
| replication_type                      | None                                 |
| created_at                            | 2018-09-04T02:57:18.000000           |
| share_proto                           | NFS                                  |
| mount_snapshot_support                | False                                |
| project_id                            | 3c9dc9d8d71149a7b835e1f5813d2eb8     |
| metadata                              | {}                                   |
+---------------------------------------+--------------------------------------+

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

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

+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
| ID                                   | Name    | Size | Share Proto | Status    | Is Public | Share Type Name    | Host | Availability Zone |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
| 93e394cb-139f-423f-b2cf-87c6359665be | share01 | 1    | NFS         | available | False     | default_share_type |      | nova              |
+--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+
[7] ここまでの設定で Storage ノード上に 10.254.0.0 内から任意のネットワークが設定されます。
[cent@storage ~]$
ip addr

.....
.....
16: tapd42e7b24-9b: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether fa:16:3e:f2:7d:5b brd ff:ff:ff:ff:ff:ff
    inet 10.254.0.3/28 brd 10.254.0.15 scope global tapd42e7b24-9b
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fef2:7d5b/64 scope link
       valid_lft forever preferred_lft forever
.....
.....
[8] 以上で、共有を作成したユーザーが所有するインスタンスから Manila の共有サービスを利用することができます。
[cent@dlp ~(keystone)]$
openstack server list

+--------------------------------------+----------+---------+-----------------------------------+---------+----------+
| ID                                   | Name     | Status  | Networks                          | Image   | Flavor   |
+--------------------------------------+----------+---------+-----------------------------------+---------+----------+
| 5b30f928-8834-4ab5-a5ce-760c48d4c9b7 | CentOS_7 | SHUTOFF | int_net=192.168.100.3, 10.0.0.220 | CentOS7 | m1.small |
+--------------------------------------+----------+---------+-----------------------------------+---------+----------+

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

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

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| access_key   | None                                 |
| share_id     | 93e394cb-139f-423f-b2cf-87c6359665be |
| created_at   | 2018-09-04T03:31:36.000000           |
| updated_at   | None                                 |
| access_type  | ip                                   |
| access_to    | 10.0.0.0/24                          |
| access_level | rw                                   |
| state        | queued_to_apply                      |
| id           | c65b9ee4-c273-48a9-8ad8-a8ded39fb200 |
| metadata     | {}                                   |
+--------------+--------------------------------------+

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

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

+--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+
| id                                   | access_type | access_to        | access_level | state  | access_key | created_at                 | updated_at |
+--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+
| 580df27d-6cb1-4a66-8011-21d97c6926b1 | ip          | 192.168.100.0/24 | rw           | active | None       | 2018-09-04T03:33:09.000000 | None       |
| c65b9ee4-c273-48a9-8ad8-a8ded39fb200 | ip          | 10.0.0.0/24      | rw           | active | None       | 2018-09-04T03:31:36.000000 | None       |
+--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+

[cent@dlp ~(keystone)]$
openstack server start CentOS_7

# アクセス Path 確認

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

path = 10.254.0.7:/shares/share-6dfcc672-5e3f-4120-afa6-15e8d1f30439
[cent@dlp ~(keystone)]$
ssh centos@10.0.0.220

Last login: Tue Sep 3 19:14:52 2018 from dlp.srv.world
# Manila 共有ストレージをマウント

[centos@centos-7 ~]$
sudo mount -t nfs \
10.254.0.7:/shares/share-6dfcc672-5e3f-4120-afa6-15e8d1f30439 /mnt

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

Filesystem                                                    Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root                                       xfs       8.0G  1.1G  7.0G  14% /
devtmpfs                                                      devtmpfs  989M     0  989M   0% /dev
tmpfs                                                         tmpfs    1000M     0 1000M   0% /dev/shm
tmpfs                                                         tmpfs    1000M  8.5M  992M   1% /run
tmpfs                                                         tmpfs    1000M     0 1000M   0% /sys/fs/cgroup
/dev/vda1                                                     xfs      1014M  129M  886M  13% /boot
tmpfs                                                         tmpfs     200M     0  200M   0% /run/user/1000
10.254.0.7:/shares/share-6dfcc672-5e3f-4120-afa6-15e8d1f30439 nfs4      976M  1.3M  908M   1% /mnt
関連コンテンツ
 
Tweet