六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 780|回复: 0

(Centos7+Packstack学习OpenstackMitaka)之(一)环境部署

[复制链接]
 楼主| 发表于 2017-7-3 23:08:49 | 显示全部楼层 |阅读模式
(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这台主机上. 为了解决这个问题, 增加域名解析就行了:
[root@packstack ~]# uname -a[root@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源
[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/
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
这里我使用了本地源. 没有搭建本地源的朋友直接修改成阿里云开源镜像即可. 方法类似下面的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
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
2.3 关防火墙和seliunx[root@packstack ~]# systemctl stop firewalld[root@packstack ~]# systemctl disable firewalld[root@packstack ~]# vim /etc/selinux/config SELINUX=disabled
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
2.4 安装packstack包[root@packstack ~]# yum -y install centos-release-openstack-mitaka epel-release [root@packstack ~]# yum -y install openstack-packstack
  • 1
  • 2
  • 1
  • 2
2.5 准备answer文件
answer文件根据我自己的环境修改过, 在下一篇博客中我将给出完整的文件.
[root@packstack ~]# touch packstack-answers-20160915-011640.txt_serverworld第二个版本有manila[root@packstack ~]# vim packstack-answers-20160915-011640.txt_serverworld第二个版本有manila
  • 1
  • 2
  • 1
  • 2
2.6 开始安装[root@packstack ~]# packstack --answer-file packstack-answers-20160915-011640.txt_serverworld第二个版本有manila
  • 1
  • 1
2.7 切换权限[root@packstack ~]# source keystonerc_admin [root@packstack ~]# cat keystonerc_admin [root@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 查看日志[root@packstack ~]# 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 [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_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[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_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进程
3.3 修改配置文件[root@packstack ~(keystone_admin)]# vim /etc/manila/manila.confshare_helpers = CIFS=manila.share.drivers.helpers.CIFSHelperIPAccess,NFS=manila.share.drivers.helpers.NFSHelper
  • 1
  • 2
  • 1
  • 2
3.4 重启manila-share服务[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
  • 1
  • 1
此时再查看manila pool:
[root@packstack ~(keystone_admin)]# 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’
安装成功后可能还会遇到一个问题, 如下:
[root@packstack ~]# cat /var/spool/mail/roottime:           2016年09月15日 星期四 120105cmdline:        /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: [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'
  • 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
解决如下:
[root@packstack ~]# chmod 777 /var/log/nova/nova-manage.log[root@packstack ~]# su -s /bin/sh -c "nova-manage db sync" nova(Centos7+Packstack学习OpenstackMitaka)之(一)环境部署
该会员没有填写今日想说内容.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表