CentOS 7
Sponsored Link

OpenStack Newton : Manila 利用方法#22016/10/31

 
OpenStack Shared File System(Manila)による共有の設定です。
ここでは以下のような環境に Manila をインストールして設定しています。
例として、当例では、専用のインスタンスを利用した NFS 共有を設定します。
前提として、バックエンドに Cinder ストレージを利用します。
ここでは例として LVM バックエンドで disk01 というストレージを 10G で作成しています
また、ネットワークは Open vSwitch バックエンドの VLAN タイプのプロバイダーネットワークを構成しています
                                    |
+----------------------+            |            +-----------------------+
|   [ Control Node ]   |            |            |   [ Storage Node ]    |
|       Keystone       |10.0.0.30   |   10.0.0.50|       DHCP Agent      |
|        Glance        |------------+------------|       L3 Agent        |
|       Nova API       |eth0        |        eth0|       L2 Agent        |
|    Neutron Server    |            |            |    Metadata Agent     |
|      Manila API      |            |            |     Manila Share      |
|      Cinder API      |            |            |     Cinder Volume     |
+----------------------+            |            +-----------------------+
                                eth0|10.0.0.51
                        +----------------------+
                        |   [ Compute Node ]   |
                        |     Nova Compute     |
                        |       L2 Agent       |
                        +----------------------+

[1] Storage ノードの設定です。
[root@storage ~]#
vi /etc/manila/manila.conf
# [DEFAULT] セクション内の任意の場所へ追記

enabled_share_backends = generic

# 最終行へ追記
[neutron]
url = http://10.0.0.30:9696
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
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_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
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_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
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 = 1
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
[2] Manila のサービスイメージをダウンロードして、Glance に登録しておきます。
[root@dlp ~(keystone)]#
curl -O http://tarballs.openstack.org/manila-image-elements/images/manila-service-image-master.qcow2

[root@dlp ~(keystone)]#
glance image-create --name "manila-service-image" --file manila-service-image-master.qcow2 --disk-format qcow2 --container-format bare --visibility public

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | f078d38fbe74cb438492f054c639d8ee     |
| container_format | bare                                 |
| created_at       | 2016-10-31T04:49:43Z                 |
| disk_format      | qcow2                                |
| id               | 5dda0938-9590-4ca8-ac53-7b889cac91ca |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | manila-service-image                 |
| owner            | 150e205a8791426e8028a94699fb8848     |
| protected        | False                                |
| size             | 389273600                            |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2016-10-31T04:49:46Z                 |
| virtual_size     | None                                 |
| visibility       | public                               |
+------------------+--------------------------------------+
[3] デフォルトの共有タイプを作成します。
[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                   | 26c44a4b-0b8c-4415-adf9-4752697112f0 |
| optional_extra_specs | snapshot_support : True              |
+----------------------+--------------------------------------+

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

+----------+--------------------+------------+------------+-------------------------------------+-------------------------+
| ID       | Name               | visibility | is_default | required_extra_specs                | optional_extra_specs    |
+----------+--------------------+------------+------------+-------------------------------------+-------------------------+
| 26c44a.. | default_share_type | public     | YES        | driver_handles_share_servers : True | snapshot_support : True |
+----------+--------------------+------------+------------+-------------------------------------+-------------------------+
[4] 共有ネットワークを作成します。
[root@dlp ~(keystone)]#
neutron net-list

+--------------------------------------+---------+-------------------------------------------------------+
| id                                   | name    | subnets                                               |
+--------------------------------------+---------+-------------------------------------------------------+
| c4adbb07-3748-468d-8d08-53af068e10fb | int_net | 4463865a-98f1-4c10-819c-22cc2c8da43f 192.168.100.0/24 |
| fd17e31e-ba7e-4bb2-a582-41def9e4734e | ext_net | 3502cde1-4d54-4aec-95ae-0def787ecc74 10.0.0.0/24      |
+--------------------------------------+---------+-------------------------------------------------------+

[root@dlp ~(keystone)]#
INT_NET=$(neutron net-list | grep 'int_net' | awk '{print $2}')

[root@dlp ~(keystone)]#
INT_SUBNET=$(neutron net-list | grep 'int_net' | awk '{print $6}')
[root@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        | 2016-11-01T07:35:14.852114           |
| neutron_subnet_id | 4463865a-98f1-4c10-819c-22cc2c8da43f |
| updated_at        | None                                 |
| mtu               | None                                 |
| gateway           | None                                 |
| neutron_net_id    | c4adbb07-3748-468d-8d08-53af068e10fb |
| ip_version        | None                                 |
| nova_net_id       | None                                 |
| cidr              | None                                 |
| project_id        | c615465cefc7455bb4b28b0be38519e3     |
| id                | 4452ecc2-6fac-4ad2-8dd1-4f4e38920b59 |
| description       | None                                 |
+-------------------+--------------------------------------+

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

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| 4452ecc2-6fac-4ad2-8dd1-4f4e38920b59 | manila_share |
+--------------------------------------+--------------+
[5] NFS 共有を作成します。
[root@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            | 4452ecc2-6fac-4ad2-8dd1-4f4e38920b59 |
| share_server_id             | None                                 |
| host                        |                                      |
| access_rules_status         | active                               |
| snapshot_id                 | None                                 |
| is_public                   | False                                |
| task_state                  | None                                 |
| snapshot_support            | True                                 |
| id                          | 1d40538a-f6a7-4e77-abe1-42c7f8d2a24d |
| size                        | 1                                    |
| user_id                     | 185dcfff08524c52b92cac84d52a92d2     |
| name                        | share01                              |
| share_type                  | 26c44a4b-0b8c-4415-adf9-4752697112f0 |
| has_replicas                | False                                |
| replication_type            | None                                 |
| created_at                  | 2016-11-01T07:35:43.000000           |
| share_proto                 | NFS                                  |
| consistency_group_id        | None                                 |
| source_cgsnapshot_member_id | None                                 |
| project_id                  | c615465cefc7455bb4b28b0be38519e3     |
| metadata                    | {}                                   |
+-----------------------------+--------------------------------------+

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

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

+----------+---------+------+-------------+-----------+-----------+--------------------+------------------------+--------+
| ID       | Name    | Size | Share Proto | Status    | Is Public | Share Type Name    | Host                   | Availa |
+----------+---------+------+-------------+-----------+-----------+--------------------+------------------------+--------+
| 1d4053.. | share01 | 1    | NFS         | available | False     | default_share_type | network.srv.world@ge.. | nova   |
+----------+---------+------+-------------+-----------+-----------+--------------------+------------------------+--------+
[6] ここまでの設定で Storage ノード上に 10.254.0.0/16 (manila.conf のデフォルト値) のネットワークが設定されます。
[root@storage ~]#
ip addr

.....
.....
15: tapae99f1d4-68: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether fa:16:3e:07:a6:28 brd ff:ff:ff:ff:ff:ff
    inet 10.254.0.5/28 brd 10.254.0.15 scope global tapae99f1d4-68
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fe07:a628/64 scope link
       valid_lft forever preferred_lft forever
.....
.....
[7] 以上の設定で、任意のインスタンスから Manila の共有サービスを利用することができます。
[root@dlp ~(keystone)]#
openstack server list

+-----------+----------+---------+-----------------------------------+------------+
| ID        | Name     | Status  | Networks                          | Image Name |
+-----------+----------+---------+-----------------------------------+------------+
| cb33e162- | CentOS_7 | SHUTOFF | int_net=192.168.100.7, 10.0.0.205 | CentOS7    |
+-----------+----------+---------+-----------------------------------+------------+

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

[root@dlp ~(keystone)]#
manila access-allow share01 ip 192.168.100.0/24 --access-level rw

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| access_key   | None                                 |
| share_id     | 1d40538a-f6a7-4e77-abe1-42c7f8d2a24d |
| access_type  | ip                                   |
| access_to    | 192.168.100.0/24                     |
| access_level | rw                                   |
| state        | new                                  |
| id           | 3516ccca-af62-4c85-b5d3-d89b376e0069 |
+--------------+--------------------------------------+

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

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

+--------------------------------------+-------------+-------------+--------------+--------+------------+
| id                                   | access_type | access_to   | access_level | state  | access_key |
+--------------------------------------+-------------+-------------+--------------+--------+------------+
| f67b3d5a-2aec-4921-9ae9-8f8da89c85e1 | ip          | 10.0.0.0/24 | rw           | active | None       |
+--------------------------------------+-------------+-------------+--------------+--------+------------+

[root@dlp ~(keystone)]#
openstack server start CentOS_7

# アクセス Path 確認

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

path = 10.254.0.6:/shares/share-44953fe8-d625-4ae9-9f22-1cfedf8d32d6
[root@dlp ~(keystone)]#
ssh 10.0.0.205

root@10.0.0.200's password:
Last login: Tue Nov 1 10:35:46 2016 from dlp.srv.world
# Manila 共有ストレージをマウント

[root@host-192-168-100-7 ~]#
mount -t nfs 10.254.0.6:/shares/share-44953fe8-d625-4ae9-9f22-1cfedf8d32d6 /mnt

[root@host-192-168-100-7 ~]#
df -hT

Filesystem                                                    Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root                                       xfs       8.5G  950M  7.6G  11% /
devtmpfs                                                      devtmpfs  991M     0  991M   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       497M  107M  390M  22% /boot
tmpfs                                                         tmpfs     201M     0  201M   0% /run/user/0
10.254.0.6:/shares/share-44953fe8-d625-4ae9-9f22-1cfedf8d32d6 nfs4      976M  1.3M  908M   1% /mnt
関連コンテンツ