CentOS 7
Sponsored Link

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

 
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-03-12T02:32:55Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/eacf43d6-fc7a-45e2-a342-0c56c658b19e/file |
| id               | eacf43d6-fc7a-45e2-a342-0c56c658b19e                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | manila-service-image                                 |
| owner            | 2551ca222ff54fac984a914e5beb40d1                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 338506752                                            |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2018-03-12T02:32:57Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+

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

+-----------------+-------------------------------------------------------------------------------------+
| Field           | Value                                                                               |
+-----------------+-------------------------------------------------------------------------------------+
| created_at      | 2018-03-12T02:33:15Z                                                                |
| description     | manila-service                                                                      |
| id              | d3867bbd-04cd-4d89-89ed-fa02c2fde394                                                |
| name            | manila-service                                                                      |
| project_id      | 2551ca222ff54fac984a914e5beb40d1                                                    |
| revision_number | 2                                                                                   |
| rules           | created_at='2018-03-12T02:33:15Z', direction='egress', ethertype='IPv4', id='02...' |
|                 | created_at='2018-03-12T02:33:15Z', direction='egress', ethertype='IPv6', id='c4...' |
| updated_at      | 2018-03-12T02:33:15Z                                                                |
+-----------------+-------------------------------------------------------------------------------------+
[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                   | d7dfe7a0-cfb8-4f43-b8d5-857a018af83f |
| optional_extra_specs |                                      |
| Description          | None                                 |
+----------------------+--------------------------------------+

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

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

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 56fba35e-e4c4-456b-9dc3-681db8ab73c5 | ext_net | a177a5db-723f-46fb-bd40-16619f55bd6d |
| fd95441f-4f15-418c-8a40-55a7c90d6a39 | int_net | b21b746b-1053-40b6-a2ba-bc08d3bc5d08 |
+--------------------------------------+---------+--------------------------------------+

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

+--------------------------------------+---------+--------------------------------------+------------------+
| ID                                   | Name    | Network                              | Subnet           |
+--------------------------------------+---------+--------------------------------------+------------------+
| b21b746b-1053-40b6-a2ba-bc08d3bc5d08 | subnet1 | fd95441f-4f15-418c-8a40-55a7c90d6a39 | 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-03-12T02:50:55.572755           |
| neutron_subnet_id | b21b746b-1053-40b6-a2ba-bc08d3bc5d08 |
| updated_at        | None                                 |
| mtu               | None                                 |
| gateway           | None                                 |
| neutron_net_id    | fd95441f-4f15-418c-8a40-55a7c90d6a39 |
| ip_version        | None                                 |
| cidr              | None                                 |
| project_id        | 52e02649325e4cf1b903d00cadb8fad2     |
| id                | d53f35ba-c967-416c-8695-273fbfc38811 |
| description       | None                                 |
+-------------------+--------------------------------------+

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

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| d53f35ba-c967-416c-8695-273fbfc38811 | 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                      | d53f35ba-c967-416c-8695-273fbfc38811 |
| 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                                    | 36165396-54d0-44f4-b32c-ebd06d52b3ea |
| size                                  | 1                                    |
| source_share_group_snapshot_member_id | None                                 |
| user_id                               | 3fc6c62eb5aa440aaa1eaf745faa35d6     |
| name                                  | share01                              |
| share_type                            | d7dfe7a0-cfb8-4f43-b8d5-857a018af83f |
| has_replicas                          | False                                |
| replication_type                      | None                                 |
| created_at                            | 2018-03-12T02:52:06.000000           |
| share_proto                           | NFS                                  |
| mount_snapshot_support                | False                                |
| project_id                            | 52e02649325e4cf1b903d00cadb8fad2     |
| metadata                              | {}                                   |
+---------------------------------------+--------------------------------------+

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

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

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

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

+-----------+----------+---------+-----------------------------------+---------+----------+
| ID        | Name     | Status  | Networks                          | Image   | Flavor   |
+-----------+----------+---------+-----------------------------------+---------+----------+
| 8c005287- | CentOS_7 | SHUTOFF | int_net=192.168.100.5, 10.0.0.202 | 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     | 36165396-54d0-44f4-b32c-ebd06d52b3ea |
| created_at   | 2018-03-12T02:59:32.000000           |
| updated_at   | None                                 |
| access_type  | ip                                   |
| access_to    | 192.168.100.0/24                     |
| access_level | rw                                   |
| state        | queued_to_apply                      |
| id           | 179c90e7-c080-4e1b-a117-aca45c4d8d30 |
+--------------+--------------------------------------+

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

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

+--------+-------------+------------------+--------------+--------+------------+-----------------+------------+
| id     | access_type | access_to        | access_level | state  | access_key | created_at      | updated_at |
+--------+-------------+------------------+--------------+--------+------------+-----------------+------------+
| 179... | ip          | 192.168.100.0/24 | rw           | active | None       | 2018-03-12T0... | 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.3:/shares/share-6290c4d9-9ae9-4be9-bd59-4ce8ca2e06f5
[cent@dlp ~(keystone)]$
ssh centos@10.0.0.202

Last login: Mon Mar 11 19:58:31 2018 from 10.0.0.30
# Manila 共有ストレージをマウント

[centos@centos-7 ~]$
sudo mount -t nfs \
10.254.0.3:/shares/share-6290c4d9-9ae9-4be9-bd59-4ce8ca2e06f5 /mnt

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

Filesystem                                                    Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root                                       xfs       8.0G 1017M  7.0G  13% /
devtmpfs                                                      devtmpfs  990M     0  990M   0% /dev
tmpfs                                                         tmpfs    1001M     0 1001M   0% /dev/shm
tmpfs                                                         tmpfs    1001M  8.4M  992M   1% /run
tmpfs                                                         tmpfs    1001M     0 1001M   0% /sys/fs/cgroup
/dev/vda1                                                     xfs      1014M  125M  890M  13% /boot
tmpfs                                                         tmpfs     201M     0  201M   0% /run/user/1001
10.254.0.3:/shares/share-6290c4d9-9ae9-4be9-bd59-4ce8ca2e06f5 nfs4      976M  1.3M  908M   1% /mnt
関連コンテンツ