Ubuntu 16.04
Sponsored Link

OpenStack Queens : Manila 利用方法#22018/03/15

 
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-03-16T05:16:05Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/19ef1901-b9f8-4695-b127-7c01503a14fe/file |
| id               | 19ef1901-b9f8-4695-b127-7c01503a14fe                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | manila-service-image                                 |
| owner            | 1ab4e37f25d14d4d8e8f5745c53bc885                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 338506752                                            |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2018-03-16T05:16:07Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+

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

+-----------------+------------------------------------------------------------------------------+
| Field           | Value                                                                        |
+-----------------+------------------------------------------------------------------------------+
| created_at      | 2018-03-16T05:16:26Z                                                         |
| description     | manila-service                                                               |
| id              | e6964efb-42e3-4ae6-b7c0-0a0428f147ed                                         |
| name            | manila-service                                                               |
| project_id      | 1ab4e37f25d14d4d8e8f5745c53bc885                                             |
| revision_number | 2                                                                            |
| rules           | created_at='2018-03-16T05:16:26Z', direction='egress', ethertype='IPv4',...' |
|                 | created_at='2018-03-16T05:16:26Z', direction='egress', ethertype='IPv6',...' |
| updated_at      | 2018-03-16T05:16:26Z                                                         |
+-----------------+------------------------------------------------------------------------------+
[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                   | 1a2f9c94-0dbb-422e-98dc-39365a1c0857 |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+

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

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

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 13a8c6d1-bb29-4aa1-b698-31630852cb87 | ext_net | 655fa742-2e84-4539-8d15-c008f1e4331e |
| 40e03738-cd4b-49b4-9e64-fabcaac64dd5 | int_net | 9fdf51fe-31a9-4f89-8e33-6e3c00a37002 |
+--------------------------------------+---------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack subnet list

+--------------------------------------+---------+--------------------------------------+------------------+
| ID                                   | Name    | Network                              | Subnet           |
+--------------------------------------+---------+--------------------------------------+------------------+
| 9fdf51fe-31a9-4f89-8e33-6e3c00a37002 | subnet1 | 40e03738-cd4b-49b4-9e64-fabcaac64dd5 | 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-03-16T05:19:44.441149           |
| neutron_subnet_id | 9fdf51fe-31a9-4f89-8e33-6e3c00a37002 |
| updated_at        | None                                 |
| mtu               | None                                 |
| gateway           | None                                 |
| neutron_net_id    | 40e03738-cd4b-49b4-9e64-fabcaac64dd5 |
| ip_version        | None                                 |
| cidr              | None                                 |
| project_id        | 142ba5a5d91c4148a4caa9227e05b504     |
| id                | 5ea4ce5f-c461-4c5c-8ee2-dddce9b5b893 |
| description       | None                                 |
+-------------------+--------------------------------------+

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

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| 5ea4ce5f-c461-4c5c-8ee2-dddce9b5b893 | 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                      | 5ea4ce5f-c461-4c5c-8ee2-dddce9b5b893 |
| 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                                    | 27da52ae-0aa0-46b7-b83a-45440dc10b37 |
| size                                  | 5                                    |
| source_share_group_snapshot_member_id | None                                 |
| user_id                               | b7b1b4b96b714e458690dd893fbbe5f5     |
| name                                  | share01                              |
| share_type                            | 1a2f9c94-0dbb-422e-98dc-39365a1c0857 |
| has_replicas                          | False                                |
| replication_type                      | None                                 |
| created_at                            | 2018-03-16T05:20:34.000000           |
| share_proto                           | NFS                                  |
| mount_snapshot_support                | False                                |
| project_id                            | 142ba5a5d91c4148a4caa9227e05b504     |
| metadata                              | {}                                   |
+---------------------------------------+--------------------------------------+

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

ubuntu@dlp ~(keystone)$
manila list

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

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

+-----------+-------------+---------+------------------------------------+------------+----------+
| ID        | Name        | Status  | Networks                           | Image      | Flavor   |
+-----------+-------------+---------+------------------------------------+------------+----------+
| f5ae3046- | Ubuntu_1604 | SHUTOFF | int_net=192.168.100.10, 10.0.0.210 | Ubuntu1604 | 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     | b5c936cf-0fed-450f-a17b-4a7e2a56cd74 |
| created_at   | 2017-09-20T08:32:14.000000           |
| updated_at   | None                                 |
| access_type  | ip                                   |
| access_to    | 10.0.0.0/24                          |
| access_level | rw                                   |
| state        | queued_to_apply                      |
| id           | d9f2e371-1ed5-4186-a0cb-ddd3bab4cbe5 |
+--------------+--------------------------------------+

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

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

+-----------+-------------+-------------+--------------+--------+------------+--------------+------------+
| id        | access_type | access_to   | access_level | state  | access_key | created_at   | updated_at |
+-----------+-------------+-------------+--------------+--------+------------+--------------+------------+
| d9f2e371- | ip          | 10.0.0.0/24 | rw           | active | None       | 2017-09-2... | None       |
+-----------+-------------+-------------+--------------+--------+------------+--------------+------------+

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

# アクセス Path 確認

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

path = 10.254.0.4:/shares/share-1219c504-da42-4bbc-a450-cc922955bbc7
ubuntu@dlp ~(keystone)$
ssh ubuntu@10.0.0.210

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-93-generic x86_64)
# Manila 共有ストレージをマウント

ubuntu@ubuntu-1604:~$
sudo mount -t nfs 10.254.0.4:/shares/share-1219c504-da42-4bbc-a450-cc922955bbc7 /mnt

ubuntu@ubuntu-1604:~$
df -hT

Filesystem                              Type      Size  Used Avail Use% Mounted on
/dev/mapper/cl-root                     xfs       8.0G 1015M  7.0G  13% /
devtmpfs                                devtmpfs  990M     0  990M   0% /dev
tmpfs                                   tmpfs    1001M     0 1001M   0% /dev/shm
tmpfs                                   tmpfs    1001M  8.3M  993M   1% /run
tmpfs                                   tmpfs    1001M     0 1001M   0% /sys/fs/cgroup
/dev/vda1                               xfs      1014M  121M  894M  12% /boot
tmpfs                                   tmpfs     201M     0  201M   0% /run/user/0
10.254.0.4:/shares/share-1219c504-da... nfs4      976M  1.3M  908M   1% /mnt
関連コンテンツ