Ubuntu 18.04
Sponsored Link

OpenStack Queens : Manila 利用方法#22018/06/19

 
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  |   |     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] 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.BridgeInterfaceDriver

root@storage:~#
systemctl restart manila-share

[3] Manila のサービスイメージをダウンロードして、Glance に登録しておきます。また Manilaサービス用のセキィリティグループも作成しておきます。
root@dlp ~(keystone)#
wget 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-06-19T03:50:56Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/c2fc3333-36a9-47b3-aad0-4dc72c81c360/file |
| id               | c2fc3333-36a9-47b3-aad0-4dc72c81c360                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | manila-service-image                                 |
| owner            | 12d80218a35e4c62aa0403e92b5b649a                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 338506752                                            |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2018-06-19T03:50:58Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+

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

+-----------------+---------------------------------------------------------------------------------+
| Field           | Value                                                                           |
+-----------------+---------------------------------------------------------------------------------+
| created_at      | 2018-06-19T03:51:22Z                                                            |
| description     | manila-service                                                                  |
| id              | 5a5d677e-3e76-48e1-82bd-7e54c08d6b04                                            |
| name            | manila-service                                                                  |
| project_id      | 12d80218a35e4c62aa0403e92b5b649a                                                |
| revision_number | 2                                                                               |
| rules           | created_at='2018-06-19T03:51:22Z', direction='egress', ethertype='IPv4', id=... |
|                 | created_at='2018-06-19T03:51:22Z', direction='egress', ethertype='IPv6', id=... |
| updated_at      | 2018-06-19T03:51:22Z                                                            |
+-----------------+---------------------------------------------------------------------------------+
[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           | -                                    |
| ID                   | 561fd586-7e4b-485d-ae64-4994675f2657 |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+

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

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

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 04a14e8b-5ad8-4db7-b89c-cef830b487af | int_net | cccfe09e-6ed6-4a11-8aa5-5e56abe4e181 |
| 38f24fdf-b038-4e50-8923-a3e05f8683d0 | ext_net | ad133394-8c9f-4cd0-9db8-638f78e6f29b |
+--------------------------------------+---------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack subnet list

+--------------------------------------+---------+--------------------------------------+------------------+
| ID                                   | Name    | Network                              | Subnet           |
+--------------------------------------+---------+--------------------------------------+------------------+
| cccfe09e-6ed6-4a11-8aa5-5e56abe4e181 | subnet1 | 04a14e8b-5ad8-4db7-b89c-cef830b487af | 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                                |
+-------------------+--------------------------------------+
| network_type      | None                                 |
| name              | manila_share                         |
| segmentation_id   | None                                 |
| created_at        | 2018-06-19T03:54:15.783140           |
| neutron_subnet_id | cccfe09e-6ed6-4a11-8aa5-5e56abe4e181 |
| updated_at        | None                                 |
| mtu               | None                                 |
| gateway           | None                                 |
| neutron_net_id    | 04a14e8b-5ad8-4db7-b89c-cef830b487af |
| ip_version        | None                                 |
| cidr              | None                                 |
| project_id        | 04a16d601dc940dd845f3092ce2712e8     |
| id                | 7e198b55-f60b-411d-a242-2085f243dd54 |
| description       | None                                 |
+-------------------+--------------------------------------+

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

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| 7e198b55-f60b-411d-a242-2085f243dd54 | manila_share |
+--------------------------------------+--------------+
[6] NFS 共有を作成します。
ubuntu@dlp ~(keystone)$
manila create NFS 5 --name share01 --share-network manila_share

+---------------------------------------+--------------------------------------+
| Property                              | Value                                |
+---------------------------------------+--------------------------------------+
| status                                | creating                             |
| share_type_name                       | default_share_type                   |
| description                           | None                                 |
| availability_zone                     | None                                 |
| share_network_id                      | 7e198b55-f60b-411d-a242-2085f243dd54 |
| 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                                    | c777f7d7-1bed-4ac5-b81f-98190eb829b0 |
| size                                  | 5                                    |
| source_share_group_snapshot_member_id | None                                 |
| user_id                               | 601473fae2c444a484860046ef2484e2     |
| name                                  | share01                              |
| share_type                            | 561fd586-7e4b-485d-ae64-4994675f2657 |
| has_replicas                          | False                                |
| replication_type                      | None                                 |
| created_at                            | 2018-06-19T03:54:45.000000           |
| share_proto                           | NFS                                  |
| mount_snapshot_support                | False                                |
| project_id                            | 04a16d601dc940dd845f3092ce2712e8     |
| metadata                              | {}                                   |
+---------------------------------------+--------------------------------------+

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

ubuntu@dlp ~(keystone)$
manila list

+--------------+---------+------+-------------+----------+-----------+--------------------+------+-------------------+
| ID           | Name    | Size | Share Proto | Status   | Is Public | Share Type Name    | Host | Availability Zone |
+--------------+---------+------+-------------+----------+-----------+--------------------+------+-------------------+
| c777f7d7-... | share01 | 5    | NFS         | creating | False     | default_share_type |      | nova              |
+--------------+---------+------+-------------+----------+-----------+--------------------+------+-------------------+
[7] ここまでの設定で Storage ノード上に 10.254.0.0 内から任意のネットワークが設定されます。
root@storage:~#
ip addr

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

+--------------+-------------+---------+-----------------------------------+------------+----------+
| ID           | Name        | Status  | Networks                          | Image      | Flavor   |
+--------------+-------------+---------+-----------------------------------+------------+----------+
| 3aae02ab-... | Ubuntu_1804 | SHUTOFF | int_net=192.168.100.5, 10.0.0.205 | Ubuntu1804 | m1.small |
+--------------+-------------+---------+-----------------------------------+------------+----------+

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

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

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| access_key   | None                                 |
| share_id     | c777f7d7-1bed-4ac5-b81f-98190eb829b0 |
| created_at   | 2018-06-19T03:57:37.000000           |
| updated_at   | None                                 |
| access_type  | ip                                   |
| access_to    | 10.0.0.0/24                          |
| access_level | rw                                   |
| state        | queued_to_apply                      |
| id           | 4d4bd0f9-f560-417f-8b20-3407e32fd53e |
+--------------+--------------------------------------+

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

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

+--------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+
| id           | access_type | access_to        | access_level | state  | access_key | created_at                 | updated_at |
+--------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+
| 286ab5ae-... | ip          | 192.168.100.0/24 | rw           | active | None       | 2018-06-19T04:04:37.000000 | None       |
| 4d4bd0f9-... | ip          | 10.0.0.0/24      | rw           | active | None       | 2018-06-19T03:57:37.000000 | None       |
+--------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+

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

# アクセス Path 確認

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

path = 10.254.0.7:/shares/share-48e793a4-f0ee-48e0-9c6e-b52c96c5d8d6
ubuntu@dlp ~(keystone)$
ssh ubuntu@10.0.0.205

Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-23-generic x86_64)

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

  System information as of Tue Jun 19 12:58:54 JST 2018

  System load:  0.22              Processes:           96
  Usage of /:   19.5% of 8.80GB   Users logged in:     0
  Memory usage: 6%                IP address for ens3: 192.168.100.5
  Swap usage:   0%


23 packages can be updated.
18 updates are security updates.


Last login: Fri Jun 15 19:10:31 2018 from 10.0.0.30
# Manila 共有ストレージをマウント

ubuntu@ubuntu-1804:~$
sudo mount -t nfs 10.254.0.7:/shares/share-48e793a4-f0ee-48e0-9c6e-b52c96c5d8d6 /mnt

ubuntu@ubuntu-1804:~$
df -hT

Filesystem                                                    Type      Size  Used Avail Use% Mounted on
udev                                                          devtmpfs  968M     0  968M   0% /dev
tmpfs                                                         tmpfs     200M  636K  199M   1% /run
/dev/mapper/ubuntu--vg-root                                   ext4      8.9G  1.8G  6.7G  21% /
tmpfs                                                         tmpfs     997M     0  997M   0% /dev/shm
tmpfs                                                         tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs                                                         tmpfs     997M     0  997M   0% /sys/fs/cgroup
tmpfs                                                         tmpfs     200M     0  200M   0% /run/user/1000
10.254.0.7:/shares/share-48e793a4-f0ee-48e0-9c6e-b52c96c5d8d6 nfs4      4.8G   10M  4.6G   1% /mnt
関連コンテンツ