devstack环境搭建

Posted gushiren

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了devstack环境搭建相关的知识,希望对你有一定的参考价值。

1. devstack部署

参考Quick Start,推荐使用ubuntu16.04进行安装

1.1 配置ubuntu国内源

修改/etc/apt/sources.list内容为
技术分享图片
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源码
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
View Code

执行命令更新源

$ sudo apt-get update

1.2 添加stack用户

$ sudo useradd -s /bin/bash -d /opt/stack -m stack
$ echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
$ sudo su - stack

1.3 配置pip国内源

同样需要在~/root下进行修改

$ mkdir .pip
$ cat >.pip/pip.conf <<EOF
[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
EOF

1.4 下载DevStack

$ git clone https://git.openstack.org/openstack-dev/devstack
$ cd devstack
$ git checkout -b stable/pike origin/stable/pike

1.5 创建local.conf文件

[[local|localrc]]
 
GIT_BASE=http://git.trystack.cn
  
HORIZON_BRANCH=stable/pike
KEYSTONE_BRANCH=stable/pike
NOVA_BRANCH=stable/pike
NEUTRON_BRANCH=stable/pike
GLANCE_BRANCH=stable/pike
CINDER_BRANCH=stable/pike
 
ADMIN_PASSWORD=123
DATABASE_PASSWORD=123
RABBIT_PASSWORD=123
SERVICE_PASSWORD=123

使用公司的git源

[[local|localrc]]
 
GIT_BASE=http://git.trystack.cn
 
NOVA_REPO=X.X.X.X
pike/nova
NOVA_BRANCH=master
HORIZON_BRANCH=stable/pike
KEYSTONE_BRANCH=stable/pike
NEUTRON_BRANCH=stable/pike
GLANCE_BRANCH=stable/pike
CINDER_BRANCH=stable/pike
 
ADMIN_PASSWORD=123
DATABASE_PASSWORD=123
RABBIT_PASSWORD=123
SERVICE_PASSWORD=123

1.6 创建lvm

$ sudo pvcreate /dev/vdb
$ sudo vgcreate stack-volumes-lvmdriver-1 /dev/vdb

1.7 安装

$ ./stack.sh

1.8 配置nfs

不使用lvm后端,配置nfs

挂载目录
sudo mkdir /storage
sudo mount /dev/sdb1 /storage
sudo chown stack:stack /storage

修改/etc/fstab,添加
/dev/sdb1   /storage    ext4    defaults    0   0

安装nfs-kernel-server: sudo apt install nfs-kernel-server
配置nfs,修改/etc/exports添加
/storage *(rw,sync,no_root_squash)

添加/etc/cinder/nfsshares,内容为
192.168.21.142:/storage

修改/etc/cinder/cinder.conf,添加nfs
enabled_backends = nfs
 
[nfs]
nfs_shares_config = /etc/cinder/nfsshares
volume_driver = cinder.volume.drivers.nfs.NfsDriver

2.  devstack管理

devstack使用systemd管理服务,服务名称为: [email protected]$servicename.service

2.1 查看服务状态

$ sudo systemctl status "[email protected]*"

2.2 控制服务

重启nova-api服务

sudo systemctl restart [email protected]

2.3 查看日志

查看nova-api日志
$ sudo journalctl -f --unit [email protected]
查看nova相关服务的日志
$ sudo journalctl -f -u [email protected]*

 

以上是关于devstack环境搭建的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7使用DevStack快速搭建OpenStack实验环境

devstack搭建环境

Devstack搭建openstack hacking 环境

如何搭建本地的PIP源提高Devstack和venv环境的安装速度

Cloud ComputingOpenstack(IAAS) All In One搭建 -- DevStack

devstack安装openstack newton版本