OpenStack Stein : Manila 利用方法#22019/04/16 |
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] |
バックエンドに Cinder ストレージを利用するため、事前に設定しておきます。(Cinder のバックエンドは何でも OK)
|
[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
interface_driver = manila.network.linux.interface.BridgeInterfaceDriver
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
service_network_cidr = 10.254.0.0/16
service_network_division_mask = 24
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 | df9d9b8b5e829aa89b9eb3484919a905 | | container_format | bare | | created_at | 2019-04-17T04:17:51Z | | disk_format | qcow2 | | file | /v2/images/fff6eb37-66ea-433a-b1a0-54fbc8965344/file | | id | fff6eb37-66ea-433a-b1a0-54fbc8965344 | | min_disk | 0 | | min_ram | 0 | | name | manila-service-image | | owner | e52584cf60234bc090c7d437b8ca7b62 | | properties | os_hash_algo='sha512', os_hash_value='8db4fe6b8f04ed2dccd9fea6f73016c22f...' | | protected | False | | schema | /v2/schemas/image | | size | 438073344 | | status | active | | tags | | | updated_at | 2019-04-17T04:17:55Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------------------------------+ # [service] プロジェクトで専用のセキィリティグループ作成 root@dlp ~(keystone)# openstack security group create --project service manila-service +-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | created_at | 2019-04-17T06:35:58Z | | description | manila-service | | id | 45bf44cc-d087-495d-a76d-483e07b46e17 | | location | Munch({'cloud': '', 'region_name': '', 'zone': None, 'project': Munch({'id': 'efc5c6a05d444cae80c0a80f49ba87d4', 'name': None, 'domain_id': None, 'domain_name': None})}) | | name | manila-service | | project_id | efc5c6a05d444cae80c0a80f49ba87d4 | | revision_number | 1 | | rules | created_at='2019-04-17T06:35:58Z', direction='egress', ethertype='IPv6', id='076f09a0-76f7-4904-8174-4cafadb10a4f', updated_at='2019-04-17T06:35:58Z' | | | created_at='2019-04-17T06:35:58Z', direction='egress', ethertype='IPv4', id='47ffc278-7e58-41a1-9b12-6f26fc7a29d1', updated_at='2019-04-17T06:35:58Z' | | tags | [] | | updated_at | 2019-04-17T06:35:58Z | +-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ # 作成したセキィリティグループに必要なポートを許可 root@dlp ~(keystone)# openstack security group rule create --protocol icmp --ingress manila-service root@dlp ~(keystone)# openstack security group rule create --protocol tcp --dst-port 22:22 manila-service root@dlp ~(keystone)# openstack security group rule create --protocol tcp --dst-port 2049:2049 manila-service |
[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 | 8a844596-8ce8-42e1-a092-e410da890c79 | | optional_extra_specs | | | Description | None | +----------------------+--------------------------------------+root@dlp ~(keystone)# manila type-list +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ | ID | Name | visibility | is_default | required_extra_specs | optional_extra_specs | Description | +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ | 8a844596-8ce8-42e1-a092-e410da890c79 | default_share_type | public | YES | driver_handles_share_servers : True | | None | +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ |
[5] | 以降は共有を作成して自身が所有するインスタンスで利用したい任意のユーザーで作業します。まずは共有ネットワークを作成しておきます。 |
ubuntu@dlp ~(keystone)$ openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 4ac44922-6ee9-4f99-9901-06cd69bcb64b | ext_net | 19f83d21-e41f-4e96-8da1-84bfba298fc7 | | 596c0921-5acb-42e1-8b44-ff549c30cded | int_net | d09f2fd8-07d9-4365-9e5b-5aeb471a1b72 | +--------------------------------------+---------+--------------------------------------+ubuntu@dlp ~(keystone)$ openstack subnet list +--------------------------------------+---------+--------------------------------------+------------------+ | ID | Name | Network | Subnet | +--------------------------------------+---------+--------------------------------------+------------------+ | d09f2fd8-07d9-4365-9e5b-5aeb471a1b72 | subnet1 | 596c0921-5acb-42e1-8b44-ff549c30cded | 192.168.100.0/24 | +--------------------------------------+---------+--------------------------------------+------------------+
ubuntu@dlp ~(keystone)$
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}')
manila share-network-create --neutron-net-id $INT_NET --neutron-subnet-id $INT_SUBNET --name manila_share +-------------------+--------------------------------------+ | Property | Value | +-------------------+--------------------------------------+ | name | manila_share | | neutron_net_id | 596c0921-5acb-42e1-8b44-ff549c30cded | | created_at | 2019-04-17T06:38:49.104616 | | neutron_subnet_id | d09f2fd8-07d9-4365-9e5b-5aeb471a1b72 | | updated_at | None | | id | 251f2030-9b62-4d72-954c-85752b418674 | | mtu | None | | gateway | None | | segmentation_id | None | | ip_version | None | | cidr | None | | project_id | ff03eefa265b423aa3375acb46a8e4e0 | | network_type | None | | description | None | +-------------------+--------------------------------------+ubuntu@dlp ~(keystone)$ manila share-network-list +--------------------------------------+--------------+ | id | name | +--------------------------------------+--------------+ | 251f2030-9b62-4d72-954c-85752b418674 | 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 | 251f2030-9b62-4d72-954c-85752b418674 | | 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 | 3281d0e0-d456-4784-b111-b26d6b4a6a27 | | size | 5 | | source_share_group_snapshot_member_id | None | | user_id | 5ed13a6b898b412383faf11ab2099a66 | | name | share01 | | share_type | 8a844596-8ce8-42e1-a092-e410da890c79 | | has_replicas | False | | replication_type | None | | created_at | 2019-04-17T06:39:30.000000 | | share_proto | NFS | | mount_snapshot_support | False | | project_id | ff03eefa265b423aa3375acb46a8e4e0 | | metadata | {} | +---------------------------------------+--------------------------------------+ # Status が available になれば作成完了 ubuntu@dlp ~(keystone)$ manila list +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone | +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | 3281d0e0-d456-4784-b111-b26d6b4a6a27 | share01 | 5 | NFS | available | False | default_share_type | | nova | +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ |
[7] | ここまでの設定で Storage ノード上に 10.254.0.0 内から任意のネットワークが設定されます。 |
root@storage:~# ip addr ..... ..... 11: ns-850b1e5d-af@tap850b1e5d-af: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether fa:16:3e:98:3f:3c brd ff:ff:ff:ff:ff:ff inet 10.254.0.180/24 brd 10.254.0.255 scope global ns-850b1e5d-af valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:fe98:3f3c/64 scope link valid_lft forever preferred_lft forever ..... ..... |
[8] | 以上で、共有を作成したユーザーが所有するインスタンスから Manila の共有サービスを利用することができます。 |
ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+---------+-------------------------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+---------+-------------------------------------+------------+----------+ | c714d070-f035-42b8-9660-999088da37b1 | Ubuntu_1804 | SHUTOFF | int_net=192.168.100.136, 10.0.0.202 | 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 | 3281d0e0-d456-4784-b111-b26d6b4a6a27 | | created_at | 2019-04-17T06:47:12.000000 | | updated_at | None | | access_type | ip | | access_to | 10.0.0.0/24 | | access_level | rw | | state | queued_to_apply | | id | 03e6d153-8316-4d73-8977-80627729289f | | metadata | {} | +--------------+--------------------------------------+ ^C # State が active であれば問題なし ubuntu@dlp ~(keystone)$ manila access-list share01 +--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+ | id | access_type | access_to | access_level | state | access_key | created_at | updated_at | +--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+ | 03e6d153-8316-4d73-8977-80627729289f | ip | 10.0.0.0/24 | rw | active | None | 2019-04-17T06:47:12.000000 | None | | ae3c9ac3-aac9-4b40-9279-fabf64a12fbe | ip | 192.168.100.0/24 | rw | active | None | 2019-04-17T06:47:41.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.233:/shares/share-177a1235-5806-4b22-a5e9-a7905a237702 ssh ubuntu@10.0.0.202 Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-47-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Wed Apr 17 15:48:48 JST 2019 System load: 0.43 Processes: 91 Usage of /: 19.6% of 8.80GB Users logged in: 0 Memory usage: 8% IP address for ens3: 192.168.100.136 Swap usage: 0% 4 packages can be updated. 0 updates are security updates. # Manila 共有ストレージをマウント ubuntu@ubuntu-1804:~$ sudo mount -t nfs 10.254.0.233:/shares/share-177a1235-5806-4b22-a5e9-a7905a237702 /mnt ubuntu@ubuntu-1804:~$ df -hT Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 967M 0 967M 0% /dev tmpfs tmpfs 200M 656K 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.233:/shares/share-177a1235-5806-4b22-a5e9-a7905a237702 nfs4 4.9G 20M 4.6G 1% /mnt |
Sponsored Link |