一、准备环境
1、预安装软件
yum insall epel-release -y yum 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 m cat /etc/sudoers.d/m Defaults:m !requiretty m ALL=(ALL) NOPASSWD:ALL
4、初始环境
su - m virtualenv ven_m source ven_m/bin/activate pip install pip --upgrade # 同步数据库时会提供缺少模块pymysql,python-memcached pip install pymysql pip 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
# user openstack user create --password 123456 manila openstack role add --project service --user manila admin # service openstack service create --name manila \ --description "OpenStack Shared File Systems" share openstack service create --name manilav2 \ --description "OpenStack Shared File Systems" sharev2 # endpoint openstack endpoint create --region RegionOne \ share public http://192.168.1.200:8786/v1/%\(tenant_id\)s openstack endpoint create --region RegionOne \ share internal http://192.168.1.200:8786/v1/%\(tenant_id\)s openstack endpoint create --region RegionOne \ share admin http://192.168.1.200:8786/v1/%\(tenant_id\)s openstack endpoint create --region RegionOne \ sharev2 public http://192.168.1.200:8786/v2/%\(tenant_id\)s openstack endpoint create --region RegionOne \ sharev2 internal http://192.168.1.200:8786/v2/%\(tenant_id\)s openstack 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.git cd manila git checkout stable/newton pip install -r requirements.txt python setup.py install
8、准备配置文件
mkdir -p ~/log/manila mkdir -p /etc/manila mkdir -p ~/var/lib/manila/tmp cp -r %git_dir%/manila/etc/manila/{api-paste.ini,policy.json,rootwrap.conf,rootwrap.d/} \ /etc/manila/ # 生成manila.conf pip install tox yum install postgresql-devel tox -e genconfig yum remove postgresql-devel -y && yum autoremove -y cp %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:[email protected] default_share_type = default_share_type share_name_template = share-%s rootwrap_config = /etc/manila/rootwrap.conf api_paste_config = /etc/manila/api-paste.ini auth_strategy = keystone my_ip = 192.168.1.200 # log_file = manila.log log_dir = /home/m/log/manila [keystone_authtoken] memcached_servers = 192.168.1.200:11211 auth_uri = http://192.168.1.200:5000 auth_url = http://192.168.1.200:35357 auth_type = password project_domain_id = default user_domain_id = default project_name = service username = manila password = 123456 [database] connection = mysql+pymysql://manila:[email protected]/manila [oslo_concurrency] # lock_path = /var/lock/manila # lock_path = /var/lib/manila/tmp lock_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/sda vgcreate manila-volumes /dev/sda
3、编辑manila-share配置文件
cp manila.conf manila-shared.conf # 编辑 manila-share.conf,在已经配置好的manila.conf上添加下面的配置 [DEFAULT] ... enabled_share_backends = lvm enabled_share_protocols = NFS [lvm] share_backend_name = LVM share_driver = manila.share.drivers.lvm.LVMShareDriver driver_handles_share_servers = False lvm_share_volume_group = manila-volumes lvm_share_export_ip = 192.168.1.200
4、复制命令
sudo cp /home/m/ven_m/bin/manila-rootwrap /usr/bin/
5、配置nfs
systemctl enable rpcbind systemctl enable nfs-server ln -s /usr/lib/systemd/system/nfs-server.service /usr/lib/systemd/system/nfs-kernel-server.service systemctl daemon-reload systemctl status nfs-kernel-server mkdir -p /var/lib/manila chown 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 False manila create NFS 2 --name share1 manila access-allow cdd7590f-b11a-4bc7-a5c1-78fccc936fe9 ip 192.168.1.16
四、配置共享节点,share server 模式
1、编辑manila-share配置文件,在已经配置好的manila.conf上添加下面的配置
[DEFAULT] ... enabled_share_backends = generic enabled_share_protocols = NFS [neutron] url = http://192.168.1.200:9696 auth_uri = http://192.168.1.200:5000 auth_url = http://192.168.1.200:35357 memcached_servers = 192.168.1.200:11211 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = NEUTRON_PASS [nova] auth_uri = http://192.168.1.200:5000 auth_url = http://192.168.1.200:35357 memcached_servers = 192.168.1.200:11211 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = NOVA_PASS [cinder] auth_uri = http://192.168.1.200:5000 auth_url = http://192.168.1.200:35357 memcached_servers = 192.168.1.200:11211 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = cinder password = CINDER_PASS [generic] share_driver = manila.share.drivers.generic.GenericShareDriver interface_driver = manila.network.linux.interface.OVSInterfaceDriver driver_handles_share_servers = True service_instance_flavor_id = 6 #service_instance_password = manila service_instance_user = centos service_p_w_picpath_name = manila-service-p_w_picpath #service_p_w_picpath_name = centos share_backend_name = GENERIC path_to_private_key = /etc/manila/ssh/id_rsa path_to_public_key = /etc/manila/ssh/id_rsa.pub
2、下载并上传mysql p_w_picpath
wget \ soure admin-rc.sh glance 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-keygen mkdir -p /etc/manila/ssh cp -r .ssh/{id_rsa,id_rsa.pub} /etc/manila/ssh chmod +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.sh manila type-create default_share_type True soure demo-rc.sh neutron net-list manila share-network-create --name demo-share-network1 \ --neutron-net-id PRIVATE_NETWORK_ID \ --neutron-subnet-id PRIVATE_NETWORK_SUBNET_ID manila create NFS 1 --name demo-share1 --share-network demo-share-network1 manila access-allow demo-share1 ip INSTANCE_IP