一、准备环境
1、预安装软件
yum insall epel-release -yyum install python-virtualenv git screen -y
2、编辑/etc/pip.conf
[global]index-url = http://mirrors.aliyun.com/pypi/simple/[install]trusted-host=mirrors.aliyun.com
3、创建用户
useradd -m mcat /etc/sudoers.d/m Defaults:m !requirettym ALL=(ALL) NOPASSWD:ALL
4、初始环境
su - mvirtualenv ven_msource ven_m/bin/activatepip install pip --upgrade# 同步数据库时会提供缺少模块pymysql,python-memcachedpip install pymysqlpip install python-memcached
5、创建数据库
mysql -hmariadb_host -uroot -p create database manila;GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'%' IDENTIFIED BY '123456';
6、创建manila的user,endpoint
# useropenstack user create --password 123456 manilaopenstack role add --project service --user manila admin# serviceopenstack service create --name manila \ --description "OpenStack Shared File Systems" shareopenstack service create --name manilav2 \ --description "OpenStack Shared File Systems" sharev2# endpointopenstack endpoint create --region RegionOne \ share public http://192.168.1.200:8786/v1/%\(tenant_id\)sopenstack endpoint create --region RegionOne \ share internal http://192.168.1.200:8786/v1/%\(tenant_id\)sopenstack endpoint create --region RegionOne \ share admin http://192.168.1.200:8786/v1/%\(tenant_id\)sopenstack endpoint create --region RegionOne \ sharev2 public http://192.168.1.200:8786/v2/%\(tenant_id\)sopenstack endpoint create --region RegionOne \ sharev2 internal http://192.168.1.200:8786/v2/%\(tenant_id\)sopenstack endpoint create --region RegionOne \ sharev2 admin http://192.168.1.200:8786/v2/%\(tenant_id\)s
7、下载并安装manila
git clone https://github.com/openstack/manila.gitcd manilagit checkout stable/newtonpip install -r requirements.txtpython setup.py install
8、准备配置文件
mkdir -p ~/log/manilamkdir -p /etc/manilamkdir -p ~/var/lib/manila/tmpcp -r %git_dir%/manila/etc/manila/{api-paste.ini,policy.json,rootwrap.conf,rootwrap.d/} \ /etc/manila/# 生成manila.confpip install toxyum install postgresql-develtox -e genconfigyum remove postgresql-devel -y && yum autoremove -ycp %git_dir%/etc/manila/manila.conf.sample /etc/manila/manila.conf# 默认生成的配置的文件sed /^#/d /etc/manila/manila.conf | sed /^$/d[DEFAULT][cinder][cors][cors.subdomain][database][keystone_authtoken][matchmaker_redis][neutron][nova][oslo_concurrency][oslo_messaging_amqp][oslo_messaging_notifications][oslo_messaging_rabbit][oslo_messaging_zmq][oslo_middleware][oslo_policy]
二、配置manila控制节点
1、编辑/etc/manila/manila.conf
[DEFAULT]transport_url = rabbit://openstack:RABBIT_PASS@192.168.1.200default_share_type = default_share_typeshare_name_template = share-%srootwrap_config = /etc/manila/rootwrap.confapi_paste_config = /etc/manila/api-paste.iniauth_strategy = keystonemy_ip = 192.168.1.200# log_file = manila.loglog_dir = /home/m/log/manila[keystone_authtoken]memcached_servers = 192.168.1.200:11211auth_uri = http://192.168.1.200:5000auth_url = http://192.168.1.200:35357auth_type = passwordproject_domain_id = defaultuser_domain_id = defaultproject_name = serviceusername = manilapassword = 123456[database]connection = mysql+pymysql://manila:123456@192.168.1.200/manila[oslo_concurrency]# lock_path = /var/lock/manila# lock_path = /var/lib/manila/tmplock_path = /home/m/var/lib/manila/tmp
2、同步数据库
manila-manage db sync
三、 配置共享节点,非share server 模式
1、安装依赖
yum install lvm2 nfs-utils nfs4-acl-tools
2、创建vg
pvcreate /dev/sdavgcreate manila-volumes /dev/sda
3、编辑manila-share配置文件
cp manila.conf manila-shared.conf# 编辑 manila-share.conf,在已经配置好的manila.conf上添加下面的配置[DEFAULT]...enabled_share_backends = lvmenabled_share_protocols = NFS[lvm]share_backend_name = LVMshare_driver = manila.share.drivers.lvm.LVMShareDriverdriver_handles_share_servers = Falselvm_share_volume_group = manila-volumeslvm_share_export_ip = 192.168.1.200
4、复制命令
sudo cp /home/m/ven_m/bin/manila-rootwrap /usr/bin/
5、配置nfs
systemctl enable rpcbindsystemctl enable nfs-serverln -s /usr/lib/systemd/system/nfs-server.service /usr/lib/systemd/system/nfs-kernel-server.servicesystemctl daemon-reloadsystemctl status nfs-kernel-servermkdir -p /var/lib/manilachown m:m /var/lib/manila
6、 启动servie
screen -S manila-api manila-api \ --config-file /etc/manila/manila.conf screen -S manila-scheduler manila-scheduler \ --config-file /etc/manila/manila.conf screen -S manila-share manila-share \ --config-file /etc/manila/manila-share.conf
7、使用manila
manila type-create default_share_type Falsemanila create NFS 2 --name share1manila access-allow cdd7590f-b11a-4bc7-a5c1-78fccc936fe9 ip 192.168.1.16
四、配置共享节点,share server 模式
1、编辑manila-share配置文件,在已经配置好的manila.conf上添加下面的配置
[DEFAULT]...enabled_share_backends = genericenabled_share_protocols = NFS[neutron]url = http://192.168.1.200:9696auth_uri = http://192.168.1.200:5000auth_url = http://192.168.1.200:35357memcached_servers = 192.168.1.200:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = neutronpassword = NEUTRON_PASS[nova]auth_uri = http://192.168.1.200:5000auth_url = http://192.168.1.200:35357memcached_servers = 192.168.1.200:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = novapassword = NOVA_PASS[cinder]auth_uri = http://192.168.1.200:5000auth_url = http://192.168.1.200:35357memcached_servers = 192.168.1.200:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = cinderpassword = CINDER_PASS[generic]share_driver = manila.share.drivers.generic.GenericShareDriverinterface_driver = manila.network.linux.interface.OVSInterfaceDriverdriver_handles_share_servers = Trueservice_instance_flavor_id = 6#service_instance_password = manilaservice_instance_user = centosservice_p_w_picpath_name = manila-service-p_w_picpath#service_p_w_picpath_name = centosshare_backend_name = GENERICpath_to_private_key = /etc/manila/ssh/id_rsapath_to_public_key = /etc/manila/ssh/id_rsa.pub
2、下载并上传mysql p_w_picpath
wget \soure admin-rc.shglance p_w_picpath-create --name "manila-service-p_w_picpath" \ --disk-format qcow2 \ --container-format bare \ --file manila-service-p_w_picpath-master.qcow2 \ --progress
3、生成 ssh key
ssh-keygenmkdir -p /etc/manila/sshcp -r .ssh/{id_rsa,id_rsa.pub} /etc/manila/sshchmod +r /etc/manila/ssh/id_rsa*
4、启动servie
screen -S manila-api manila-api \ --config-file /etc/manila/manila.conf screen -S manila-scheduler manila-scheduler \ --config-file /etc/manila/manila.conf screen -S manila-share manila-share \ --config-file /etc/manila/manila-share.conf
5、使用manila
soure admin-rc.shmanila type-create default_share_type Truesoure demo-rc.shneutron net-listmanila share-network-create --name demo-share-network1 \--neutron-net-id PRIVATE_NETWORK_ID \--neutron-subnet-id PRIVATE_NETWORK_SUBNET_IDmanila create NFS 1 --name demo-share1 --share-network demo-share-network1manila access-allow demo-share1 ip INSTANCE_IP