学习Openstack的前两个月, 时间都花在环境部署上了, 主要是版本的问题, 导致了一系列的麻烦. 之前使用devstack已经部署成功了, 但是manila不能用, 残念, 问题主要出在网络上, 研究完manila的网络模块之后再回头找原因吧. 不打算继续在环境上花时间了, 这里给了一套可以重复的安装部署流程, 使用packstack.
虚拟机软件: VirtualBox
Centos镜像: CentOS-7-x86_64-DVD-1511(1).iso
网络: 一张NAT网卡 (默认IP: 10.0.2.15)
packstack
的解析安装过程中可能会出现以下错误:
* unable to connect to epmd (port 4369) on packstack
原因是因为配置文件里将该进程放到了packstack
这台主机上. 为了解决这个问题, 增加域名解析就行了:
[root@packstack ~]# uname -a
[root@packstack ~]# vim /etc/hosts
10.0.2.15 packstack
192.168.9.217 server
其中, server是我自己搭建的Centos7的本地源. 不使用本地源的不用增加这一项.
(1) Centos源
[root@packstack ~]# cd /etc/yum.repos.d/
[root@packstack ~]# mkdir bak
[root@packstack ~]# mv CentOS-* bak/
[root@packstack ~]# mv local_mitaka.repo /etc/yum.repos.d/
这里我使用了本地源. 没有搭建本地源的朋友直接修改成阿里云开源镜像即可. 方法类似下面的epel源.
(2) epel源
[root@packstack ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@packstack ~]# yum clean all
[root@packstack ~]# yum makecache
[root@packstack ~]# systemctl stop firewalld
[root@packstack ~]# systemctl disable firewalld
[root@packstack ~]# vim /etc/selinux/config
SELINUX=disabled
[root@packstack ~]# yum -y install centos-release-openstack-mitaka epel-release
[root@packstack ~]# yum -y install openstack-packstack
answer文件根据我自己的环境修改过, 在下一篇博客中我将给出完整的文件.
[root@packstack ~]# touch packstack-answers-20160915-011640.txt_serverworld第二个版本有manila
[root@packstack ~]# vim packstack-answers-20160915-011640.txt_serverworld第二个版本有manila
[root@packstack ~]# packstack --answer-file packstack-answers-20160915-011640.txt_serverworld第二个版本有manila
[root@packstack ~]# source keystonerc_admin
[root@packstack ~]# cat keystonerc_admin
[root@packstack ~(keystone_admin)]# manila pool-list
+------+------+---------+------+
| Name | Host | Backend | Pool |
+------+------+---------+------+
+------+------+---------+------+
因为我的重点是研究manila模块, 所以安装成功之后第一时间检查了manila模块. 很遗憾, manila模块安装失败. 原因应该是版本的问题, 没有时间去具体研究脚本, 下面直接给出解决方案. 这一步成功安装, 或者不需要manila服务的朋友, 可以不用继续向下了.
[root@packstack ~]# cat /var/log/manila/share.log | grep ERROR
2016-09-16 11:50:08.123 15388 ERROR oslo_service.periodic_task Traceback (most recent call last):
2016-09-16 11:50:08.123 15388 ERROR oslo_service.periodic_task File "/usr/lib/python2.7/site-packages/oslo_service/periodic_task.py", line 220, in run_periodic_tasks
2016-09-16 11:50:08.123 15388 ERROR oslo_service.periodic_task task(self, context)
2016-09-16 11:50:08.123 15388 ERROR oslo_service.periodic_task File "/usr/lib/python2.7/site-packages/manila/utils.py", line 615, in wrapper
2016-09-16 11:50:08.123 15388 ERROR oslo_service.periodic_task raise exception.DriverNotInitialized(driver=driver_name)
2016-09-16 11:50:08.123 15388 ERROR oslo_service.periodic_task DriverNotInitialized: Share driver 'GenericShareDriver' not initialized.
查看了manila几个进程的日志后发现, 是manila-share进程出现错误. 其实可以理解, 因为manila pool为空, 说明share进程没有成功管理后端存储. 更详细的错误信息如下:
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager [req-c7388245-8da4-44d8-b11a-0788defc2fcc - - - - -] Error encountered during initialization of driver 'GenericShareDriver' on 'packstack@generic' host. Class CIFSHelper cannot be found (['Traceback (most recent call last):\n', ' File "/usr/lib/python2.7/site-packages/oslo_utils/importutils.py", line 32, in import_class\n return getattr(sys.modules[mod_str], class_str)\n', "AttributeError: 'module' object has no attribute 'CIFSHelper'\n"])
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager Traceback (most recent call last):
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager File "/usr/lib/python2.7/site-packages/manila/share/manager.py", line 248, in init_host
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager self.driver.do_setup(ctxt)
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager File "/usr/lib/python2.7/site-packages/manila/share/drivers/generic.py", line 177, in do_setup
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager self._setup_helpers()
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager File "/usr/lib/python2.7/site-packages/manila/share/drivers/generic.py", line 208, in _setup_helpers
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager helper = importutils.import_class(import_str)
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager File "/usr/lib/python2.7/site-packages/oslo_utils/importutils.py", line 36, in import_class
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager traceback.format_exception(*sys.exc_info())))
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager ImportError: Class CIFSHelper cannot be found (['Traceback (most recent call last):\n', ' File "/usr/lib/python2.7/site-packages/oslo_utils/importutils.py", line 32, in import_class\n return getattr(sys.modules[mod_str], class_str)\n', "AttributeError: 'module' object has no attribute 'CIFSHelper'\n"])
2016-09-15 17:44:06.281 2732 ERROR manila.share.manager
2016-09-15 17:45:44.317 2732 ERROR oslo_service.periodic_task [req-a24899f7-4d96-4780-9f52-1d381654ee74 - - - - -] Error during ShareManager._report_driver_status
2016-09-15 17:45:44.317 2732 ERROR oslo_service.periodic_task Traceback (most recent call last):
2016-09-15 17:45:44.317 2732 ERROR oslo_service.periodic_task File "/usr/lib/python2.7/site-packages/oslo_service/periodic_task.py", line 220, in run_periodic_tasks
2016-09-15 17:45:44.317 2732 ERROR oslo_service.periodic_task task(self, context)
2016-09-15 17:45:44.317 2732 ERROR oslo_service.periodic_task File "/usr/lib/python2.7/site-packages/manila/utils.py", line 615, in wrapper
2016-09-15 17:45:44.317 2732 ERROR oslo_service.periodic_task raise exception.DriverNotInitialized(driver=driver_name)
2016-09-15 17:45:44.317 2732 ERROR oslo_service.periodic_task DriverNotInitialized: Share driver 'GenericShareDriver' not initialized.
很明显, 错误的根本原因是找不到CIFSHelper这个类. 查看manila.conf配置文件, 发现对generic这个后端存储有如下配置:
share_helpers = CIFS=manila.share.drivers.generic.CIFSHelper,NFS=manila.share.drivers.generic.NFSHelper
这个配置文件是由packstack生成的, 应该是版本不一致导致了配置文件信息有误. 查看Liberty版本的manila/manila/share/drivers/generic.py
文件, 发现该文件有CIFSHelper类. 但是到了Mitaka版本, 该文件已经没有这个类了. 因此导致了错误. 配置文件是针对Liberty版本生成的.
下面手动修改配置文件.
[root@packstack ~(keystone_admin)]# vim /etc/manila/manila.conf
share_helpers = CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,NFS=manila.share.drivers.helpers.NFSHelper
[root@packstack ~]# /usr/bin/python2 /usr/bin/manila-share --config-file /usr/share/manila/manila-dist.conf --config-file /etc/manila/manila.conf --logfile /var/log/manila/share.log
此时再查看manila pool:
[root@packstack ~(keystone_admin)]# manila pool-list
+---------------------------+-----------+---------+---------+
| Name | Host | Backend | Pool |
+---------------------------+-----------+---------+---------+
| packstack@generic#generic | packstack | generic | generic |
+---------------------------+-----------+---------+---------+
安装成功后可能还会遇到一个问题, 如下:
[root@packstack ~]# cat /var/spool/mail/root
time: 2016年09月15日 星期四 12时01分05秒
cmdline: /usr/bin/python2 /bin/nova-manage db archive_deleted_rows --max_rows 100
uid: 162 (nova)
abrt_version: 2.1.11
event_log:
executable: /bin/nova-manage
hostname: packstack
kernel: 3.10.0-327.el7.x86_64
last_occurrence: 1473998463
pid: 24458
pkg_arch: noarch
pkg_epoch: 1
pkg_name: openstack-nova-common
pkg_release: 1.el7
pkg_version: 13.1.0
runlevel: N 5
username: nova
backtrace:
:__init__.py:925:_open:IOError: [Errno 13] Permission denied: '/var/log/nova/nova-manage.log'
:
:Traceback (most recent call last):
: File "/bin/nova-manage", line 10, in <module>
: sys.exit(main())
: File "/usr/lib/python2.7/site-packages/nova/cmd/manage.py", line 1517, in main
: logging.setup(CONF, "nova")
: File "/usr/lib/python2.7/site-packages/oslo_log/log.py", line 243, in setup
: _setup_logging_from_conf(conf, product_name, version)
: File "/usr/lib/python2.7/site-packages/oslo_log/log.py", line 319, in _setup_logging_from_conf
: filelog = file_handler(logpath)
: File "/usr/lib64/python2.7/logging/handlers.py", line 392, in __init__
: logging.FileHandler.__init__(self, filename, mode, encoding, delay)
: File "/usr/lib64/python2.7/logging/__init__.py", line 902, in __init__
: StreamHandler.__init__(self, self._open())
: File "/usr/lib64/python2.7/logging/__init__.py", line 925, in _open
: stream = open(self.baseFilename, self.mode)
:IOError: [Errno 13] Permission denied: '/var/log/nova/nova-manage.log'
解决如下:
[root@packstack ~]# chmod 777 /var/log/nova/nova-manage.log
[root@packstack ~]# su -s /bin/sh -c "nova-manage db sync" nova