OpenStack Rocky : Manila 利用方法#22018/09/18 |
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
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
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-09-18T02:35:26Z | | disk_format | qcow2 | | file | /v2/images/055ffc4e-685d-4308-8122-703405ce4a5f/file | | id | 055ffc4e-685d-4308-8122-703405ce4a5f | | min_disk | 0 | | min_ram | 0 | | name | manila-service-image | | owner | a4307ece2969492eb795f64da4006b2d | | properties | os_hash_algo='sha512', os_hash_value='e4d9703f681095bf52f13324346d87cbae2323ea51fba5c94e2ccf68e6e686a92874b49d9bfdcc2d1595d0e7607836d7e54fb0c8a6cca3950512958abdf2b654', os_hidden='False' | | protected | False | | schema | /v2/schemas/image | | size | 338506752 | | status | active | | tags | | | updated_at | 2018-09-18T02:35:29Z | | virtual_size | None | | visibility | public | +------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+root@dlp ~(keystone)# openstack security group create manila-service +-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ | created_at | 2018-09-18T02:35:57Z | | description | manila-service | | id | 52b768a1-5051-4712-92e0-3a3597ea5418 | | name | manila-service | | project_id | a4307ece2969492eb795f64da4006b2d | | revision_number | 1 | | rules | created_at='2018-09-18T02:35:57Z', direction='egress', ethertype='IPv4', id='023d3457-4703-44ef-be11-b7fc2ebea49e', updated_at='2018-09-18T02:35:57Z' | | | created_at='2018-09-18T02:35:57Z', direction='egress', ethertype='IPv6', id='ce99096c-82b2-4c58-811d-14ce3017e733', updated_at='2018-09-18T02:35:57Z' | | tags | [] | | updated_at | 2018-09-18T02:35:57Z | +-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |
[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 | 6d2c0dfe-3135-4169-a464-c1e6515b1126 | | optional_extra_specs | | | Description | None | +----------------------+--------------------------------------+root@dlp ~(keystone)# manila type-list +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ | ID | Name | visibility | is_default | required_extra_specs | optional_extra_specs | Description | +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ | 6d2c0dfe-3135-4169-a464-c1e6515b1126 | default_share_type | public | YES | driver_handles_share_servers : True | | None | +--------------------------------------+--------------------+------------+------------+-------------------------------------+----------------------+-------------+ |
[5] | 以降は共有を作成して自身が所有するインスタンスで利用したい任意のユーザーで作業します。まずは共有ネットワークを作成しておきます。 |
ubuntu@dlp ~(keystone)$ openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 59845493-39f0-44ac-af69-4db727beaeaf | int_net | ee13f5fc-fc2c-4853-beb7-6cb911c69cb4 | | a52a1645-55fb-4600-b42e-67bbdedae320 | ext_net | b81200dc-c6fb-491f-80b6-9176d5b4e48a | +--------------------------------------+---------+--------------------------------------+ubuntu@dlp ~(keystone)$ openstack subnet list +--------------------------------------+---------+--------------------------------------+------------------+ | ID | Name | Network | Subnet | +--------------------------------------+---------+--------------------------------------+------------------+ | ee13f5fc-fc2c-4853-beb7-6cb911c69cb4 | subnet1 | 59845493-39f0-44ac-af69-4db727beaeaf | 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 | +-------------------+--------------------------------------+ | network_type | None | | name | manila_share | | segmentation_id | None | | created_at | 2018-09-18T02:37:44.711531 | | neutron_subnet_id | ee13f5fc-fc2c-4853-beb7-6cb911c69cb4 | | updated_at | None | | mtu | None | | gateway | None | | neutron_net_id | 59845493-39f0-44ac-af69-4db727beaeaf | | ip_version | None | | cidr | None | | project_id | 5f54b0ad76274f06b13f29458cc1c036 | | id | be965098-c418-4659-b296-4e80f5fbf433 | | description | None | +-------------------+--------------------------------------+ubuntu@dlp ~(keystone)$ manila share-network-list +--------------------------------------+--------------+ | id | name | +--------------------------------------+--------------+ | be965098-c418-4659-b296-4e80f5fbf433 | 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 | be965098-c418-4659-b296-4e80f5fbf433 | | 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 | 903a96df-38c3-4e15-87a6-62c0c601e4b4 | | size | 5 | | source_share_group_snapshot_member_id | None | | user_id | 54951d6863024516a19ed9bda53be12f | | name | share01 | | share_type | 6d2c0dfe-3135-4169-a464-c1e6515b1126 | | has_replicas | False | | replication_type | None | | created_at | 2018-09-18T02:38:18.000000 | | share_proto | NFS | | mount_snapshot_support | False | | project_id | 5f54b0ad76274f06b13f29458cc1c036 | | metadata | {} | +---------------------------------------+--------------------------------------+ # Status が available になれば作成完了 ubuntu@dlp ~(keystone)$ manila list +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone | +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ | 903a96df-38c3-4e15-87a6-62c0c601e4b4 | share01 | 5 | NFS | available | False | default_share_type | | nova | +--------------------------------------+---------+------+-------------+-----------+-----------+--------------------+------+-------------------+ |
[7] | ここまでの設定で Storage ノード上に 10.254.0.0 内から任意のネットワークが設定されます。 |
root@storage:~# ip addr ..... ..... 8: ns-177b82c6-5c@tap177b82c6-5c: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether fa:16:3e:99:a0:42 brd ff:ff:ff:ff:ff:ff inet 10.254.0.6/28 brd 10.254.0.15 scope global ns-177b82c6-5c valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:fe99:a042/64 scope link valid_lft forever preferred_lft forever ..... ..... |
[8] | 以上で、共有を作成したユーザーが所有するインスタンスから Manila の共有サービスを利用することができます。 |
ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+---------+------------------------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+---------+------------------------------------+------------+----------+ | e402a282-c5ae-4532-ad08-0a2f0d7803ac | Ubuntu_1804 | SHUTOFF | int_net=192.168.100.10, 10.0.0.214 | 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 | 903a96df-38c3-4e15-87a6-62c0c601e4b4 | | created_at | 2018-09-18T02:41:51.000000 | | updated_at | None | | access_type | ip | | access_to | 10.0.0.0/24 | | access_level | rw | | state | queued_to_apply | | id | 3904854a-2bac-43ff-b807-232749b24c2f | | metadata | {} | +--------------+--------------------------------------+ # State が active であれば問題なし ubuntu@dlp ~(keystone)$ manila access-list share01 +--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+ | id | access_type | access_to | access_level | state | access_key | created_at | updated_at | +--------------------------------------+-------------+------------------+--------------+--------+------------+----------------------------+------------+ | 3904854a-2bac-43ff-b807-232749b24c2f | ip | 10.0.0.0/24 | rw | active | None | 2018-09-18T02:41:51.000000 | None | | 4677ac9c-42f6-4952-b26b-2d2ac5127db6 | ip | 192.168.100.0/24 | rw | active | None | 2018-09-18T02:42:29.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-0f06fefe-96b0-47b3-9b39-1230eb5db2e3 ssh ubuntu@10.0.0.214 Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-34-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Tue Sep 18 11:43:55 JST 2018 System load: 0.1 Processes: 93 Usage of /: 19.7% of 8.80GB Users logged in: 0 Memory usage: 6% IP address for ens3: 192.168.100.10 Swap usage: 0% * Read about Ubuntu updates for L1 Terminal Fault Vulnerabilities (L1TF). - https://ubu.one/L1TF * Want to make a highly secure kiosk, smart display or touchscreen? Here's a step-by-step tutorial for a rainy weekend, or a startup. - https://bit.ly/secure-kiosk 9 packages can be updated. 3 updates are security updates. # Manila 共有ストレージをマウント ubuntu@ubuntu-1804:~$ sudo mount -t nfs 10.254.0.7:/shares/share-0f06fefe-96b0-47b3-9b39-1230eb5db2e3 /mnt ubuntu@ubuntu-1804:~$ df -hT Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 967M 0 967M 0% /dev tmpfs tmpfs 200M 644K 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-0f06fefe-96b0-47b3-9b39-1230eb5db2e3 nfs4 4.8G 10M 4.6G 1% /mnt |
Sponsored Link |