CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了<Centos7+Packstack学习Openstack Mitaka>之(一) 环境部署大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

学习Openstack的前两个月, 时间都花在环境部署上了, 主要是版本的问题, 导致了一系列的麻烦. 之前使用devstack已经部署成功了, 但是manila不能用, 残念, 问题主要出在网络上, 研究完manila的网络模块之后再回头找原因吧. 不打算继续在环境上花时间了, 这里给了一套可以重复的安装部署流程, 使用packstack. 1. 安装环境 虚拟机软件: VirtualBox C

1. 安装环境

虚拟机软件: VirtualBox
Centos镜像: CentOS-7-x86_64-DVD-1511(1).iso
网络: 一张NAT网卡 (@L_675_1@认IP: 10.0.2.15)

2. packstack安装过程

2.1 增加packstack的解析

@R_982_9382@可能会出现以下错误:

原因是因配置文件里将该进程放到了packstack这台主机上. 为了解决这个问题,增加域名解析就行了:

[root@packstack ~]# uname -a
[root@packstack ~]# vim /etc/hosts
10.0.2.15   packstack
192.168.9.217   server

其中,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/

这里我使用了本地源. 没有搭建本地源的朋友直接修改阿里云开源镜像即可. 方法类似下面的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

2.3 关防火墙和seliunx

[root@packstack ~]# systemctl stop firewalld
[root@packstack ~]# systemctl disable firewalld
[root@packstack ~]# vim /etc/selinux/config 
SELINUX=disabled

2.4 安装packstack包

[root@packstack ~]# yum -y install centos-release-openstack-mitaka epel-release 
[root@packstack ~]# yum -y install openstack-packstack

2.5 准备answer文件

answer文件根据我自己的环境修改过,在下一篇博客中我将给出完整的文件.

[root@packstack ~]# touch packstack-answers-20160915-011640.txt_serverworld第二个版本有manila
[root@packstack ~]# vim packstack-answers-20160915-011640.txt_serverworld第二个版本有manila 

2.6 开始安装

[root@packstack ~]# packstack --answer-file packstack-answers-20160915-011640.txt_serverworld第二个版本有manila 

2.7 切换权限

[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服务的朋友,可以不用继续向下了.

3. manila服务安装错误排查

3.1 查看日志

[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',"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",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",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版本的@H_482_24@manila/manila/share/drivers/generic.py文件,发现该文件有CIFSHelper类. 但是到了Mitaka版本,@L_674_36@已经没有这个类了. 因此导致了错误. 配置文件是针对Liberty版本生成的.

下面手动修改配置文件.

3.2 杀掉share进程

3.3 修改配置文件

[root@packstack ~(keystone_admin)]# vim /etc/manila/manila.conf
share_Helpers = CIFS=manila.share.drivers.Helpers.CIFSHelperIPAccess,NFS=manila.share.drivers.Helpers.NFSHelper

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

此时再查看manila pool:

[root@packstack ~(keystone_admin)]# manila pool-list
+---------------------------+-----------+---------+---------+
| Name                      | Host      | BACkend | Pool    |
+---------------------------+-----------+---------+---------+
| packstack@generic#generic | packstack | generic | generic |
+---------------------------+-----------+---------+---------+

4. Permission denied: ‘/var/log/nova/nova-manage.log’

安装成功后可能还会遇到一个问题,如下:

[root@packstack ~]# cat /var/spool/mail/root
time:           2016年09月15日 星期四 120105cmdline:        /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 <@H_110_180@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

大佬总结

以上是大佬教程为你收集整理的<Centos7+Packstack学习Openstack Mitaka>之(一) 环境部署全部内容,希望文章能够帮你解决<Centos7+Packstack学习Openstack Mitaka>之(一) 环境部署所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。