(Centos7+Packstack学习OpenstackMitaka)之(一)环境部署
(Centos7+Packstack学习OpenstackMitaka)之(一)环境部署1. 安装环境虚拟机软件: VirtualBox
Centos镜像: CentOS-7-x86_64-DVD-1511(1).iso
网络: 一张NAT网卡 (默认IP: 10.0.2.15)2. packstack安装过程2.1 增加对packstack的解析安装过程中可能会出现以下错误:* unable to connect to epmd (port 4369) on packstack原因是因为配置文件里将该进程放到了packstack这台主机上. 为了解决这个问题, 增加域名解析就行了:@packstack ~]# uname -a@packstack ~]# vim /etc/hosts10.0.2.15 packstack192.168.9.217 server
[*]1
[*]2
[*]3
[*]4
[*]1
[*]2
[*]3
[*]4
其中, server是我自己搭建的Centos7的本地源. 不使用本地源的不用增加这一项.2.2 修改Centos和epel源(1) Centos源@packstack ~]# cd /etc/yum.repos.d/@packstack ~]# mkdir bak@packstack ~]# mv CentOS-* bak/@packstack ~]# mv local_mitaka.repo /etc/yum.repos.d/
[*]1
[*]2
[*]3
[*]4
[*]1
[*]2
[*]3
[*]4
这里我使用了本地源. 没有搭建本地源的朋友直接修改成阿里云开源镜像即可. 方法类似下面的epel源.(2) epel源@packstack ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo@packstack ~]# yum clean all@packstack ~]# yum makecache
[*]1
[*]2
[*]3
[*]1
[*]2
[*]3
2.3 关防火墙和seliunx@packstack ~]# systemctl stop firewalld@packstack ~]# systemctl disable firewalld@packstack ~]# vim /etc/selinux/config SELINUX=disabled
[*]1
[*]2
[*]3
[*]4
[*]1
[*]2
[*]3
[*]4
2.4 安装packstack包@packstack ~]# yum -y install centos-release-openstack-mitaka epel-release @packstack ~]# yum -y install openstack-packstack
[*]1
[*]2
[*]1
[*]2
2.5 准备answer文件answer文件根据我自己的环境修改过, 在下一篇博客中我将给出完整的文件.@packstack ~]# touch packstack-answers-20160915-011640.txt_serverworld第二个版本有manila@packstack ~]# vim packstack-answers-20160915-011640.txt_serverworld第二个版本有manila
[*]1
[*]2
[*]1
[*]2
2.6 开始安装@packstack ~]# packstack --answer-file packstack-answers-20160915-011640.txt_serverworld第二个版本有manila
[*]1
[*]1
2.7 切换权限@packstack ~]# source keystonerc_admin @packstack ~]# cat keystonerc_admin @packstack ~(keystone_admin)]# manila pool-list+------+------+---------+------+| Name | Host | Backend | Pool |+------+------+---------+------++------+------+---------+------+
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]7
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]7
因为我的重点是研究manila模块, 所以安装成功之后第一时间检查了manila模块. 很遗憾, manila模块安装失败. 原因应该是版本的问题, 没有时间去具体研究脚本, 下面直接给出解决方案. 这一步成功安装, 或者不需要manila服务的朋友, 可以不用继续向下了.3. manila服务安装错误排查3.1 查看日志# cat /var/log/manila/share.log | grep ERROR2016-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_tasks2016-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 wrapper2016-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.
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]7
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]7
查看了manila几个进程的日志后发现, 是manila-share进程出现错误. 其实可以理解, 因为manila pool为空, 说明share进程没有成功管理后端存储. 更详细的错误信息如下:2016-09-15 17:44:06.281 2732 ERROR manila.share.manager 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, 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_host2016-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_setup2016-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_helpers2016-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_class2016-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, 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 4d96-4780-9f52-1d381654ee74 - - - - -] Error during ShareManager._report_driver_status2016-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_tasks2016-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 wrapper2016-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.
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]7
[*]8
[*]9
[*]10
[*]11
[*]12
[*]13
[*]14
[*]15
[*]16
[*]17
[*]18
[*]19
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]7
[*]8
[*]9
[*]10
[*]11
[*]12
[*]13
[*]14
[*]15
[*]16
[*]17
[*]18
[*]19
很明显, 错误的根本原因是找不到CIFSHelper这个类. 查看manila.conf配置文件, 发现对generic这个后端存储有如下配置:share_helpers = CIFS=manila.share.drivers.generic.CIFSHelper,NFS=manila.share.drivers.generic.NFSHelper
[*]1
[*]1
这个配置文件是由packstack生成的, 应该是版本不一致导致了配置文件信息有误. 查看Liberty版本的manila/manila/share/drivers/generic.py文件, 发现该文件有CIFSHelper类. 但是到了Mitaka版本, 该文件已经没有这个类了. 因此导致了错误. 配置文件是针对Liberty版本生成的.下面手动修改配置文件.3.2 杀掉share进程http://static.zybuluo.com/zzr0427/rrur7k6pxo897tt19cznxfyl/image_1asohgr3k17tarc1vqq1e9p15flm.png3.3 修改配置文件# vim /etc/manila/manila.confshare_helpers = CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,NFS=manila.share.drivers.helpers.NFSHelper
[*]1
[*]2
[*]1
[*]2
http://static.zybuluo.com/zzr0427/8xrd60vpy987dyra026n9rig/image_1asohs66n3g35kdgjhu61d313.png3.4 重启manila-share服务@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
[*]1
[*]1
此时再查看manila pool:# manila pool-list+---------------------------+-----------+---------+---------+| Name | Host | Backend | Pool |+---------------------------+-----------+---------+---------+| packstack@generic#generic | packstack | generic | generic |+---------------------------+-----------+---------+---------+
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
4. Permission denied: ‘/var/log/nova/nova-manage.log’安装成功后可能还会遇到一个问题, 如下:@packstack ~]# cat /var/spool/mail/roottime: 2016年09月15日 星期四 12时01分05秒cmdline: /usr/bin/python2 /bin/nova-manage db archive_deleted_rows --max_rows 100uid: 162 (nova)abrt_version: 2.1.11event_log: executable: /bin/nova-managehostname: packstackkernel: 3.10.0-327.el7.x86_64last_occurrence: 1473998463pid: 24458pkg_arch: noarchpkg_epoch: 1pkg_name: openstack-nova-commonpkg_release: 1.el7pkg_version: 13.1.0runlevel: N 5username: novabacktrace::__init__.py:925:_open:IOError: 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: 13] Permission denied: '/var/log/nova/nova-manage.log'
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]7
[*]8
[*]9
[*]10
[*]11
[*]12
[*]13
[*]14
[*]15
[*]16
[*]17
[*]18
[*]19
[*]20
[*]21
[*]22
[*]23
[*]24
[*]25
[*]26
[*]27
[*]28
[*]29
[*]30
[*]31
[*]32
[*]33
[*]34
[*]35
[*]36
[*]37
[*]38
[*]1
[*]2
[*]3
[*]4
[*]5
[*]6
[*]7
[*]8
[*]9
[*]10
[*]11
[*]12
[*]13
[*]14
[*]15
[*]16
[*]17
[*]18
[*]19
[*]20
[*]21
[*]22
[*]23
[*]24
[*]25
[*]26
[*]27
[*]28
[*]29
[*]30
[*]31
[*]32
[*]33
[*]34
[*]35
[*]36
[*]37
[*]38
解决如下:@packstack ~]# chmod 777 /var/log/nova/nova-manage.log@packstack ~]# su -s /bin/sh -c "nova-manage db sync" nova(Centos7+Packstack学习OpenstackMitaka)之(一)环境部署
页:
[1]