使用Devstack部署Openstack

DevStack简介

DevStack 是一系列可扩展的脚本,用于根据来自 git master 的所有内容的最新版本快速构建完整的 OpenStack 环境。它可交互地用作开发环境,并作为 OpenStack 项目大部分功能测试的基础。

DevStack 将在安装过程中对您的系统进行重大更改。仅在专用于此目的的服务器或虚拟机上运行 DevStack。

实验环境

Ubuntu22.04

物理环境:8 vcpus,16GiB memory

快速开始

添加Stack用户

DevStack 应该以非 root 用户身份运行,并启用 sudo。

使用如下命令创建Stack用户来运行DevStack

1
2
3
4
5
6
7
8
9
10
11
#创建用户stack,并指定其shell为bash,-d设置其家目录为/opt/stack,-m是如果不存在则创建该目录。
sudo useradd -s /bin/bash -d /opt/stack -m stack

#设置其主目录为所有人可以执行,因为RHEL默认是700,而Ubuntu21.04是750可能会在部署过程造成问题。
sudo chmod +x /opt/stack

#为Stack用户添加sudo权限来使其可以对系统进行更改。
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack

#切换至Stack用户
sudo -u stack -i

下载DevStack

1
2
git clone https://opendev.org/openstack/devstack
cd devstack

仓库包含了安装OpenStack的脚本和配置文件的模板。

创建local.conf

在devstack的根目录创建创建local.conf文件,在samples/local.conf目录下有一个示例文件。

注意密码只能使用字母数字字符,因为某些服务在使用特殊字符时无法运行。

1
2
3
4
5
6
7
8
vim local.conf

[[local|localrc]]
HOST_IP=0.0.0.0 #修改为你的ip
ADMIN_PASSWORD=secret #修改你的密码
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD

开始安装

1
./stack.sh

这将需要 15 - 30 分钟,主要取决于您的互联网连接速度。在此过程中将安装许多 git 树和包。

如下是成功的输出。

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
=========================
DevStack Component Timing
(times are in seconds)
=========================
wait_for_service 12
async_wait 171
osc 134
apt-get 250
test_with_retry 4
dbsync 11
pip_install 96
apt-get-update 1
run_process 26
git_timed 119
-------------------------
Unaccounted time 165
=========================
Total runtime 989

=================
Async summary
=================
Time spent in the background minus waits: 335 sec
Elapsed time: 989 sec
Time if we did everything serially: 1324 sec
Speedup: 1.33873


Post-stack database query stats:
+------------+-----------+-------+
| db | op | count |
+------------+-----------+-------+
| keystone | SELECT | 21508 |
| keystone | INSERT | 93 |
| glance | DESCRIBE | 4 |
| neutron | DESCRIBE | 4 |
| neutron | CREATE | 231 |
| neutron | SHOW | 6 |
| neutron | SELECT | 4842 |
| neutron | INSERT | 4114 |
| neutron | UPDATE | 153 |
| neutron | ALTER | 51 |
| neutron | DROP | 22 |
| neutron | DELETE | 27 |
| placement | SELECT | 18 |
| placement | INSERT | 59 |
| placement | SET | 2 |
| nova_api | SELECT | 50 |
| nova_cell1 | SELECT | 57 |
| nova_cell0 | SELECT | 26 |
| nova_cell0 | INSERT | 5 |
| nova_cell0 | UPDATE | 4 |
| cinder | SELECT | 53 |
| cinder | INSERT | 5 |
| placement | UPDATE | 3 |
| glance | INSERT | 14 |
| glance | SELECT | 28 |
| nova_cell1 | INSERT | 4 |
| nova_cell1 | UPDATE | 15 |
| glance | UPDATE | 2 |
| cinder | UPDATE | 1 |
| nova_api | INSERT | 20 |
| nova_api | SAVEPOINT | 10 |
| nova_api | RELEASE | 10 |
| cinder | DELETE | 1 |
+------------+-----------+-------+



This is your host IP address: 10.0.0.4
This is your host IPv6 address: ::1
Horizon is now available at http://10.0.0.4/dashboard
Keystone is serving at http://10.0.0.4/identity/
The default users are: admin and demo
The password: openstack

WARNING:
Configuring uWSGI with a WSGI file is deprecated, use module paths instead
Configuring uWSGI with a WSGI file is deprecated, use module paths instead
Configuring uWSGI with a WSGI file is deprecated, use module paths instead
Configuring uWSGI with a WSGI file is deprecated, use module paths instead


Services are running under systemd unit files.
For more information see:
https://docs.openstack.org/devstack/latest/systemd.html

DevStack Version: 2024.2
Change: b67c20eca531fbb93f86bccc5a8d61495d089d9d Merge "[Neutron] Add a new Neutron service: neutron-ovn-maintenance-worker" 2024-07-10 10:42:34 +0000
OS Version: Ubuntu 22.04 jammy

2024-07-11 09:09:58.809 | stack.sh completed in 989 seconds.

使用Devstack部署Openstack
https://steammilk.com/2024/07/11/2024-all/openstack-01/
作者
蒸奶泡
发布于
2024年7月11日
更新于
2025年1月8日
许可协议