DevStack is a series of extensible scripts used to quickly bring up a complete OpenStack environment based on the latest versions of everything from git master. It is used interactively as a development environment and as the basis for much of the OpenStack project’s functional testing.

The source is available at https://git.openstack.org/cgit/openstack-dev/devstack.

DevStack是一系列可扩展脚本,他能帮我们以最近git master的版本快速的搭建一个openstack环境,可以用作一个交互式的开发环境,用来对openstack的单元功能测试。

  1. 添加stack用户


  2. $ sudo useradd -s /bin/bash -d /opt/stack -m stack

        Since this user will be making many changes to your system, it should have sudo privileges:

        tee 功能说明:读取标准输入的数据,并将其内容输出成文件。

$ echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
$ sudo su - stack


2.下载 

Download DevStack

$ git clone https://git.openstack.org/openstack-dev/devstack
$ cd devstack

Create a local.conf

3.创建local.conf配置文件

Create a local.conf file with 4 passwords preset at the root of the devstack git repo.

[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD

This is the minimum required config to get started with DevStack. 这是需要开启一个devstack的最小的配置

Start the install

4.安装

./stack.sh

This will take a 15 - 20 minutes, largely depending on the speed of your internet connection. Many git trees and packages will be installed during this process.

Profit!

You now have a working DevStack! Congrats!

Your devstack will have installed keystoneglancenovacinderneutron, and horizon. Floating IPs will be available, guests have access to the external world.

You can access horizon to experience the web interface to OpenStack, and manage vms, networks, volumes, and images from there.

You can source openrc in your shell, and then use the openstack command line tool to manage your devstack.

You can cd /opt/stack/tempest and run tempest tests that have been configured to work with your devstack.

You can make code changes to OpenStack and validate them.

现在devstack已经工作了,已经安装了好多模块,浮动ip也是可以使用的,猜已经可以访问外部世界了。

你也可以用web接口访问openstack,管理虚拟机,网络,容量,映像。

也可以使用命令行管理devstack,也可以打开/opt/stack/tempest运行测试,是配置生效。

Going further

Learn more about our configuration system to customize devstack for your needs. Including making adjustments to the default networking.

Read guides for specific setups people have (note: guides are point in time contributions, and may not always be kept up to date to the latest devstack).

Enable devstack plugins to support additional services, features, and configuration not present in base devstack.


Note, selecting 'libjpeg8-dev' instead of 'libjpeg-dev'

E: Unable to locate package apache2-dev

E: Unable to locate package libapache2-mod-proxy-uwsgi

E: Unable to locate package python3-systemd

E: Unable to locate package thin-provisioning-tools

+functions-common:apt_get:1                exit_trap

+./stack.sh:exit_trap:492                  local r=100

++./stack.sh:exit_trap:493                  jobs -p

+./stack.sh:exit_trap:493                  jobs=

+./stack.sh:exit_trap:496                  [[ -n '' ]]

+./stack.sh:exit_trap:502                  kill_spinner

+./stack.sh:kill_spinner:388               '[' '!' -z '' ']'

+./stack.sh:exit_trap:504                  [[ 100 -ne 0 ]]

+./stack.sh:exit_trap:505                  echo 'Error on exit'

Error on exit

+./stack.sh:exit_trap:506                  generate-subunit 1493111031 17 fail

./stack.sh: line 506: generate-subunit: command not found


实际安装过程中错误百出,centos跟ubuntu的出错也是不一样。本文将持续更新。

sudo pip install -U os-testr

Collecting os-testr

/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.

  SNIMissingWarning

/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.

  InsecurePlatformWarning

  Downloading os_testr-0.8.1-py2-none-any.whl (42kB)

    100% |████████████████████████████████| 51kB 155kB/s 

Collecting testrepository>=0.0.18 (from os-testr)

  Downloading testrepository-0.0.20.tar.gz (84kB)

    100% |████████████████████████████████| 92kB 296kB/s 

Collecting testtools>=1.4.0 (from os-testr)

  Downloading testtools-2.2.0-py2.py3-none-any.whl (195kB)

    100% |████████████████████████████████| 204kB 594kB/s 

Collecting pbr>=2.0.0 (from os-testr)

  Downloading pbr-3.0.0-py2.py3-none-any.whl (98kB)

    100% |████████████████████████████████| 102kB 559kB/s 

Collecting Babel>=2.3.4 (from os-testr)

  Downloading Babel-2.4.0-py2.py3-none-any.whl (6.8MB)

    100% |████████████████████████████████| 6.8MB 118kB/s 

Collecting python-subunit>=0.0.18 (from os-testr)

  Downloading python_subunit-1.2.0-py2.py3-none-any.whl (112kB)

    100% |████████████████████████████████| 122kB 308kB/s 

Collecting fixtures (from testrepository>=0.0.18->os-testr)

  Downloading fixtures-3.0.0-py2.py3-none-any.whl (67kB)

    100% |████████████████████████████████| 71kB 412kB/s 

Collecting six>=1.4.0 (from testtools>=1.4.0->os-testr)

  Downloading six-1.10.0-py2.py3-none-any.whl

Collecting python-mimeparse (from testtools>=1.4.0->os-testr)

  Downloading python_mimeparse-1.6.0-py2.py3-none-any.whl

Collecting traceback2 (from testtools>=1.4.0->os-testr)

  Downloading traceback2-1.4.0-py2.py3-none-any.whl

Collecting extras>=1.0.0 (from testtools>=1.4.0->os-testr)

  Downloading extras-1.0.0-py2.py3-none-any.whl

Collecting unittest2>=1.0.0 (from testtools>=1.4.0->os-testr)

  Downloading unittest2-1.1.0-py2.py3-none-any.whl (96kB)

    100% |████████████████████████████████| 102kB 545kB/s 

Collecting pytz>=0a (from Babel>=2.3.4->os-testr)

  Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)

    100% |████████████████████████████████| 491kB 303kB/s 

Collecting linecache2 (from traceback2->testtools>=1.4.0->os-testr)

  Downloading linecache2-1.0.0-py2.py3-none-any.whl

Collecting argparse (from unittest2>=1.0.0->testtools>=1.4.0->os-testr)

  Downloading argparse-1.4.0-py2.py3-none-any.whl

Installing collected packages: pbr, six, python-mimeparse, linecache2, traceback2, extras, argparse, unittest2, testtools, fixtures, python-subunit, testrepository, pytz, Babel, os-testr

  Found existing installation: argparse 1.2.1

    Not uninstalling argparse at /usr/lib/python2.7, as it is in the standard library.

  Running setup.py install for testrepository ... done

Successfully installed Babel-2.4.0 argparse-1.4.0 extras-1.0.0 fixtures-3.0.0 linecache2-1.0.0 os-testr-0.8.1 pbr-3.0.0 python-mimeparse-1.6.0 python-subunit-1.2.0 pytz-2017.2 six-1.10.0 testrepository-0.0.20 testtools-2.2.0 traceback2-1.4.0 unittest2-1.1.0


Linux lnx-air-230-4 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

/opt/stack/devstack/lib/databases/mysql: line 20: is_fedora: command not found

/opt/stack/devstack/lib/database: line 46: is_service_enabled: command not found

/opt/stack/devstack/lib/database: line 46: is_service_enabled: command not found

/opt/stack/devstack/lib/rpc_backend: line 28: is_service_enabled: command not found

/opt/stack/devstack/stackrc: line 550: fetch_plugins: command not found

stack.sh failed

Error on exit

Traceback (most recent call last):

  File "/usr/bin/generate-subunit", line 7, in <module>

    from os_testr.generate_subunit import main

  File "/usr/lib/python2.6/site-packages/os_testr/generate_subunit.py", line 21, in <module>

    import subunit

  File "/usr/lib/python2.6/site-packages/subunit/__init__.py", line 130, in <module>

    from testtools import content, content_type, ExtendedToOriginalDecorator

ImportError: cannot import name content