OpenStack  File Share Service(Manila) For Centos

Introduction:

Manila is the File Shareservice project for OpenStack. To administer the OpenStack File Share service,it is helpful to understand a number of concepts like share networks, shares,multi-tenancy and back ends that can be configured with Manila. Whenconfiguring the File Share service, it is required to declare at least one backend. Manila can be configured to run in a single-node configuration or acrossmultiple nodes. Manila can be configured to provision shares from one or moreback ends. The OpenStack File Share service allows you to offer file-shareservices to users of an OpenStack installation.


1.Create the database.

mysql -u root -p
CREATE DATABASE manila;
GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'localhost'IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'%'IDENTIFIED BY 'password';

2.Create users, roles,service and API endpoint.

openstack user create --password-prompt manila
openstack role add --project service --user manila admin
openstack service create --name manila --description"OpenStack Shared Filesystems" share
openstack endpoint create \
  --publicurl http://x.x.x.x:8786/v1/%\(tenant_id\)s \
  --internalurl http://x.x.x.x:8786/v1/%\(tenant_id\)s \
  --adminurl http://x.x.x.x:8786/v1/%\(tenant_id\)s \
  --region RegionOne \
  share

3.Install required packages on controller node.openstack-manila-api and openstack-manila-scheduler services will run on thecontroller node.

yum install openstack-manila python-manilapython-manilaclient

4.Installed required packages on compute node.openstack-manila-share service will run on the compute node.

yum install openstack-mania-share python-manila

5. Edit the /etc/manila/manila.conf file and api-paste.ini

[DEFAULT]
osapi_share_listen=0.0.0.0
api_paste_config=/etc/manila/api-paste.ini
state_path=/var/lib/manila
glance_host=X.X.X.X
storage_availability_zone=nova
rootwrap_config=/etc/manila/rootwrap.conf
auth_strategy=keystone
enabled_share_backends=backend1
nova_catalog_info=compute:nova:publicURL
nova_catalog_admin_info=compute:nova:adminURL
nova_api_insecure=False
nova_admin_username=nova
nova_admin_password=password
nova_admin_tenant_name=service
nova_admin_auth_url=http://X.X.X.X:5000/v2.0
network_api_class=manila.network.neutron.neutron_network_plugin.NeutronNetworkPlugin
debug=True
verbose=True
log_dir=/var/log/manila
use_syslog=False
rpc_backend=rabbit
control_exchange=openstack
amqp_durable_queues=False
cinder_catalog_info=volume:cinder:publicURL
neutron_api_insecure=False
cinder_admin_username=cinder
neutron_auth_strategy=keystone
cinder_admin_password=password
notification_driver=messaging
neutron_admin_tenant_name=service
cinder_cross_az_attach=True
neutron_url=http://X.X.X.X:9696
cinder_api_insecure=False
cinder_admin_auth_url=http://X.X.X.X:5000/v2.0
cinder_http_retries=3
cinder_admin_tenant_name=service
neutron_admin_password=password
neutron_admin_username=neutron
neutron_admin_auth_url=http://X.X.X.X:5000/v2.0
neutron_url_timeout=30
default_share_type = default
sql_connection = mysql://manila:password@x.x.x.x/manila
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = password
[oslo_concurrency]
lock_path=/var/lock/manila

Warning!!!

This Manila Share Backend is configure on Manila Share node,So Manila-api and Manila-scheduler not configure.


[backend1]
service_network_division_mask=28
volume_name_template=manila-share-%s
service_instance_network_helper_type=neutron
max_time_to_build_instance=300
share_mount_path=/shares
manila_service_keypair_name=manila-service
service_network_name=manila_service_network
interface_driver=manila.network.linux.interface.OVSInterfaceDriver
service_network_cidr=10.254.0.0/16
service_instance_flavor_id=100
service_instance_smb_config_path=$share_mount_path/smb.conf
volume_snapshot_name_template=manila-snapshot-%s
share_backend_name=backend1
smb_template_config_path=$state_path/smb.conf
service_instance_name_template=manila_service_instance_%s
driver_handles_share_servers = True
service_instance_user = manila
service_instance_password=manila
service_p_w_picpath_name = manila-service-p_w_picpath
path_to_private_key = /root/.ssh/id_rsa
path_to_public_key = /root/.ssh/id_rsa.pub
share_backend_name = GENERIC1
share_driver = manila.share.drivers.generic.GenericShareDriver
share_helpers=CIFS=manila.share.drivers.generic.CIFSHelper,NFS=manila.share.drivers.generic.NFSHelper
share_volume_fstype=ext4
max_time_to_attach=120
service_instance_security_group=manila-service
connect_share_server_to_tenant_network=False
Replace /etc/manila/api-paste.ini,Configure Keystone authtoken.
service_protocol = http
service_host = X.X.X.X
service_port = 5000
auth_host = X.X.X.X
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = manila
admin_password = password
signing_dir = /var/lib/manila
auth_uri=http://X.X.X.X:5000/



6.Populate the Manila Database.

su -s /bin/sh -c "manila-manage db sync" manila

7.Start and enable manila services.

systemctl start openstack-manila-api
systemctl start openstack-manila-scheduler
systemctl enable openstack-manila-api
systemctl enable openstack-manila-scheduler
systemctl start openstack-manila-share
systemctl enable openstack-manila-share

8.Upload manila service p_w_picpathto glance.

wget https://github.com/uglide/manila-p_w_picpath-elements/releases/download/0.1.0/manila-service-p_w_picpath.qcow2
glance p_w_picpath-create --name "manila-service-p_w_picpath-new" --file manila-service-p_w_picpath.qcow2 --disk-format qcow2 --container-format bare --visibility public --progress

9.Create default share type.

manila type-create default True

10. Create Manila flavor type.

nova flavor-create manila-service-flavor 100 128 0 1

11. Create nova for manila Security Group.

nova secgroup-create manila-service 'manila-service description'
nova secgroup-add-rule manila-service icmp -1 -1 0.0.0.0/0
nova secgroup-add-rule manila-service tcp 22 22 0.0.0.0/0
nova secgroup-add-rule manila-service tcp 2049 2049 0.0.0.0/0
nova secgroup-add-rule manila-service udp 2049 2049 0.0.0.0/0
nova secgroup-add-rule manila-service udp 445 445 0.0.0.0/0
nova secgroup-add-rule manila-service tcp 445 445 0.0.0.0/0
nova secgroup-add-rule manila-service tcp 137 139 0.0.0.0/0
nova secgroup-add-rule manila-service udp 137 139 0.0.0.0/0

12. Create share network.

manila share-network-create --name devinshare --neutron-net-id XXXXXXX --neutron-subnet-id XXXXXXX

13. Create NFS share.

manila create NFS 1 --name devin --share-network devinshare

14. Configure Manila access.

manila access-allow devin ip XXX(instance_ip) --access-level rw