try devstack

举报
黄生 发表于 2023/03/08 14:49:13 2023/03/08
【摘要】 root@ecs-os:~# apt-get updateReading package lists... Done #就完了,感觉也没做什么root@ecs-os:~# git clone https://git.openstack.org/openstack-dev/devstackCloning into 'devstack'...fatal: unable to access 'h...
root@ecs-os:~# apt-get update
Reading package lists... Done  #就完了,感觉也没做什么

root@ecs-os:~# git clone https://git.openstack.org/openstack-dev/devstack
Cloning into 'devstack'...
fatal: unable to access 'https://git.openstack.org/openstack-dev/devstack/': Could not resolve host: git.openstack.org
再试一次,不行
fatal: unable to access 'https://git.openstack.org/openstack-dev/devstack/': GnuTLS recv error (-9): Error decoding the received TLS packet.

换个源
root@ecs-os:~# git clone https://github.com/openstack-dev/devstack.git
Cloning into 'devstack'...
remote: Enumerating objects: 49734, done.
remote: Counting objects: 100% (161/161), done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 49734 (delta 85), reused 148 (delta 83), pack-reused 49573
Receiving objects: 100% (49734/49734), 15.72 MiB | 8.12 MiB/s, done.
Resolving deltas: 100% (34759/34759), done.

运行./stack.sh,用root不行;创建一个非root用户

DevStack should be run as a user with sudo permissions,
not root.
A "stack" user configured correctly can be created with:
 /root/devstack/tools/create-stack-user.sh

root@ecs-os:~/devstack# tools/create-stack-user.sh
[Call Trace]
tools/create-stack-user.sh:32:source
/root/devstack/stackrc:839:die
[ERROR] /root/devstack/stackrc:839 Could not determine host ip address.  See local.conf for suggestions on setting HOST_IP.

root@ecs-os:~/devstack# export HOST_IP=10.0.0.92
root@ecs-os:~/devstack# tools/create-stack-user.sh
Creating a group called stack
Creating a user called stack
Giving stack user passwordless sudo privileges

之前建立了local.conf文件,写入了一些配置
root@ecs-os:~/devstack# cat local.conf

[[local|localrc]]
ADMIN_PASSWORD=1qaz@WSX
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
HOST_IP=10.0.0.92
SERVICE_HOST=10.0.0.92

不知道为什么建用户时的local.conf里的HOST_IP没有发生效果

运行./stack.sh,卡在网络上
+functions-common:git_timed:726            timeout -s SIGINT 0 git clone https://opendev.org/openstack/requirements.git /opt/stack/requirements --branch master
Cloning into '/opt/stack/requirements'...
...
[ERROR] /home/os/devstack/functions-common:730 git call failed: [git clone https://opendev.org/openstack/requirements.git /opt/stack/requirements --branch master]
Error on exit
World dumping... see /opt/stack/logs/worlddump-2023-03-06-160530.txt for details #这个log记录了系统环境信息

通过设置镜像环境变量来解决
export GIT_BASE=https://github.com

然后是报错
+inc/python:pip_install:190                sudo -H LC_ALL=en_US.UTF-8 SETUPTOOLS_USE_DISTUTILS=stdlib http_proxy= https_proxy= no_proxy= PIP_FIND_LINKS= python3.8 -m pip install -c /opt/stack/requirements/upper-constraints.txt -U os-testr
Collecting os-testr===3.0.0
  Downloading os_testr-3.0.0-py3-none-any.whl (32 kB)
ERROR: Could not find a version that satisfies the requirement pbr===5.11.1 (from -c /opt/stack/requirements/upper-constraints.txt (line 45)) (from versions: none)
ERROR: No matching distribution found for pbr===5.11.1 (from -c /opt/stack/requirements/upper-constraints.txt (line 45))
+inc/python:pip_install:1                  exit_trap

添加阿里Python镜像搞定
stack@ecs-os:~$ cat .pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
trusted-host = mirrors.aliyun.com
timeout = 120
stack@ecs-os:~$ pip install pbr==5.11.1  #华为的镜像老一些,最新版本只到5.10.0

问题是,./stack.sh安装没有使用python镜像,做如下配置,你觉得可以解决吗?

export PIP_GET_PIP_URL=https://mirrors.aliyun.com/pip/get-pip.py
export PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/

然后下载11M的 files/etcd-v3.3.12-linux-amd64.tar.gz 慢的要死,手工下载下来核对sha256sum正确

接下来,仍然没有从Python镜像下载
+inc/python:pip_install:190                sudo -H LC_ALL=en_US.UTF-8 SETUPTOOLS_USE_DISTUTILS=stdlib http_proxy= https_proxy= no_proxy= PIP_FIND_LINKS= python3.8 -m pip install -c /opt/stack/requirements/upper-constraints.txt etcd3
Collecting etcd3===0.12.0
  Using cached etcd3-0.12.0.tar.gz (63 kB)
Collecting grpcio===1.49.1
  Downloading grpcio-1.49.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB)
     |███▊                            | 542 kB 3.7 kB/s eta 0:18:40^C
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

破案了,在root用户目录下添加.pip/pip.conf的配置即可,因为上面的sudo -H是会切换到root用户的HOME执行的
所以仅仅在stack用户目录下添加python镜像是没有用的

接下来到了安装openstack的多个服务
+lib/stack:stack_install_service:20 local service=cinder
会很慢,配置使用镜像,在local.conf里添加以下就快了
# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git

git了不少项目下来:

stack@ecs-os:~$ sudo du -sm */
1       async/
34      bin/
11      bindep-venv/
123     data/
27      glance/
251     horizon/
46      keystone/
1       logs/
137     neutron/
233     nova/
12      novnc/
22      placement/
33      requirements/
112     tempest/
好像少了点,比如cinder记得有个目录的,怎么后来又没有了
123     cinder/

接下来连接Mysql尝试10次失败并结束

+lib/keystone:init_keystone:489            /usr/local/bin/keystone-manage --config-file /etc/keystone/keystone.conf db_sync
INFO dbcounter [-] Registered counter for database keystone
WARNING oslo_db.sqlalchemy.engines [-] SQL connection failed. 10 attempts left.: oslo_db.exception.DBConnectionError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'WSX@127.0.0.1' ([Errno -2] Name or service not known)")

看到WSX,怀疑和local.conf里配置的有关
ADMIN_PASSWORD=1qaz@WSX

于是修改为
ADMIN_PASSWORD=Pass1234

报错:

+lib/databases/mysql:configure_database_mysql:108  sudo mysqladmin -u root password Pass1234
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
+lib/databases/mysql:configure_database_mysql:108  true

改不了密码,因为不是初始的没有密码的状态了。
sudo mysqladmin -u root password Pass1234

参考一下这块代码的注释
# Set the root password - only works the first time. For Ubuntu, we already
# did that with debconf before installing the package, but we still try,
# because the package might have been installed already.

手工修改密码
sudo mysqladmin -u root -p password Pass1234

又添加了些配置到local.conf
# Define images to be automatically downloaded during the DevStack built process.
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS=http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

# only support IP v4
SERVICE_IP_VERSION=4
再次执行终于成功
=========================
DevStack Component Timing
 (times are in seconds)
=========================
wait_for_service      12
pip_install          133
apt-get               22
run_process           19
dbsync                 4
apt-get-update         9
test_with_retry        4
async_wait           348
osc                  168
-------------------------
Unaccounted time     870
=========================
Total runtime        1589

=================
 Async summary
=================
 Time spent in the background minus waits: 386 sec
 Elapsed time: 1589 sec
 Time if we did everything serially: 1975 sec
 Speedup:  1.24292

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

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

DevStack Version: 2023.1
Change: ab8e51eb49068a8c5004007c18fdfb9b1fcc0954 Merge "Disable memory_tracker and file_tracker in unstask.sh properly" 2023-02-28 06:13:08 +0000
OS Version: Ubuntu 20.04 focal

2023-03-08 02:58:00.149 | stack.sh completed in 1589 seconds.

访问horizon登录后是这个样子

用最小的flavor启动cirros镜像(128M)


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。