千家信息网

使用Kolla部署Stein版本OpenStack(含Ceph存储部分)

发表于:2024-11-11 作者:千家信息网编辑
千家信息网最后更新 2024年11月11日,这是我的微信,有问题可以添加交流并于Kolla的介绍这里不进行过多的阐述,网上有很多文档。本文主要是针对最新版本的Kolla,解决单节点无法部署ceph-osd问题(在测试时发现多节点也无法部署Cep
千家信息网最后更新 2024年11月11日使用Kolla部署Stein版本OpenStack(含Ceph存储部分)


这是我的微信,有问题可以添加交流
并于Kolla的介绍这里不进行过多的阐述,网上有很多文档。本文主要是针对最新版本的Kolla,解决单节点无法部署ceph-osd问题(在测试时发现多节点也无法部署Ceph-osd)。在最新版本的kolla中,官网已经给出要下架Ceph的公告,具体信息如下图:

此片文章会通过修改kolla-ansible源码解决不能部署ceph问题。
部署具体过程如下:

1. 准备工作

1.1 安装Centos7.5系统,过程略。本人使用virtualbox创建虚拟机,使用两张网卡即可。第一张为管理网络,可以访问外网,第二张为实例使用网络,启动即可,无需配置IP。
[root@openstack ~]# cat /etc/centos-releaseCentOS Linux release 7.5.1804 (Core)
1.2 关闭防火墙、设置selinux
[root@localhost ~]# systemctl disable firewalld[root@localhost ~]# systemctl stop firewalld[root@localhost ~]# getenforce Disabled
1.3 重启机器
[root@localhost ~]# reboo7
1.4 设置主机名
[root@localhost ~]# hostnamectl set-hostname openstack[root@localhost ~]# cat /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.137.2 openstack
1.5 配置DNS
[root@openstack ~]# cat /etc/resolv.confnameserver 114.114.114.114
1.6 添加阿里yum源
[root@openstack ~]# rm -rfv * /etc/yum.repos.d/*[root@openstack ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

2. 系统基本配置

2.1 安装常用工具
[root@openstack ~]# yum install vim bash-completion net-tools
2.2 安装epel
[root@openstack ~]# yum install epel-release
2.3 安装依赖
[root@openstack ~]#yum install python-devel libffi-devel gcc openssl-devel libselinux-python -y
2.4 安装pip
[root@openstack ~]# yum install python-pip
2.5 配置pip,使用阿里源
[root@openstack ~]# mkdir ~/.pip[root@openstack ~]# vim ~/.pip/pip.conf [global]index-url = https://mirrors.aliyun.com/pypi/simple/[install]trusted-host=mirrors.aliyun.com
2.6 更新pip
[root@openstack ~]# pip install -U pip

3. 安装docker

3.1 添加docker源,使用阿里源
[root@openstack ~]#yum install -y yum-utils device-mapper-persistent-data lvm2[root@openstack ~]#yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3.2 安装docker
[root@openstack ~]#yum -y install docker-ce
3.3 配置docker,使用阿里加速器
[root@openstack ~]# mkdir -p /etc/docker/[root@openstack ~]# vim /etc/docker/daemon.json {  "registry-mirrors": ["https://fl791z1h.mirror.aliyuncs.com"]}
3.4 添加kolla.conf
[root@openstack ~]# mkdir -p /etc/systemd/system/docker.service.d/[root@openstack ~]# vim /etc/systemd/system/docker.service.d/kolla.conf [Service]MountFlags=shared
3.5 启动docker
[root@openstack ~]# systemctl daemon-reload [root@openstack ~]# systemctl enable docker [root@openstack ~]# systemctl start docker

4. 安装ansible

4.1 安装ansible
[root@openstack ~]# yum install ansible
4.2 配置ansible
[root@openstack ~]# vim /etc/ansible/ansible.cfg [defaults]host_key_checking=Falsepipelining=Trueforks=100

5. 安装kolla-ansible

5.1 安装依赖

kolla分为两个仓库,一个为https://github.com/openstack/kolla , 另一个为https://github.com/openstack/kolla-ansible 在这两个仓库中有requirements.txt文件,需要将其中的依赖安装

[root@openstack ~]# vim 1.txt pbr!=2.1.0,>=2.0.0 # Apache-2.0docker>=2.4.2 # Apache-2.0Jinja2>=2.8 # BSD License (3 clause)GitPython>=1.0.1 # BSD License (3 clause)six>=1.10.0 # MIToslo.config>=5.1.0 # Apache-2.0oslo.utils>=3.33.0 # Apache-2.0setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0 # PSF/ZPLnetaddr>=0.7.18 # BSD
[root@openstack ~]# vim 2.txt pbr!=2.1.0,>=2.0.0 # Apache-2.0docker>=2.4.2 # Apache-2.0Jinja2>=2.10 # BSD License (3 clause)six>=1.10.0 # MIToslo.config>=5.2.0 # Apache-2.0oslo.utils>=3.33.0 # Apache-2.0setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPLPyYAML>=3.12 # MITnetaddr>=0.7.18 # BSDcryptography>=2.1 # BSD/Apache-2.0jmespath>=0.9.3 # MIT

以上两个文件,是我直接新requirements.txt,复制过来的,直接安装即可

root@openstack ~]# pip install -r 1.txt DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-supportLooking in indexes: https://mirrors.aliyun.com/pypi/simple/Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/lib/python2.7/site-packages (from -r 1.txt (line 1)) (5.4.2)Requirement already satisfied: docker>=2.4.2 in /usr/lib/python2.7/site-packages (from -r 1.txt (line 2)) (4.0.2)Requirement already satisfied: Jinja2>=2.8 in /usr/lib64/python2.7/site-packages (from -r 1.txt (line 3)) (2.10.1)Requirement already satisfied: GitPython>=1.0.1 in /usr/lib/python2.7/site-packages (from -r 1.txt (line 4)) (3.0.2)ERROR: Package 'GitPython' requires a different Python: 2.7.5 not in '>=3.0, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'

在安装的时候会提示GitPython无法安装,可以使用pip指定GitPython进行安装

[root@openstack ~]# pip install GitPython==3.0.2

安装第二个依赖

[root@openstack ~]# pip install -r 2.txt
5.2 安装kolla-ansible
[root@openstack ~]# pip install kolla-ansible

在安装kolla-ansible的时候会出现下面的错误

ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

解决方法,在安装kolla-ansible的时候忽略PyYAML

[root@openstack ~]# pip install kolla-ansible --ignore-installed PyYAML
5.3 安装kolla
[root@openstack ~]# pip install kolla

6. 配置kolla-ansible

6.1 创建kolla目录,复制globals.yml,passwords.yml
[root@openstack ~]# mkdir -p /etc/kolla/[root@openstack ~]# cp /usr/share/kolla-ansible/etc_examples/kolla/* /etc/kolla/
6.2 由于此环境在虚拟机部署,所以virt_type的类型设置为qemu
[root@openstack ~]# mkdir -p /etc/kolla/config/nova/[root@openstack ~]# vim /etc/kolla/config/nova/nova-compute.conf [libvirt]virt_type = qemucpu_mode = none
6.3 配置ceph.conf,设备ceph副本数,此环境为一台节点,3个OSD盘,设置副本为1即可,如果是三台节点,9OSD盘,副本为3。
[root@openstack ~]# vim /etc/kolla/config/ceph.conf[global]osd pool default size = 1osd pool default min size = 1
6.4 配置globals.yml
[root@openstack ~]# cat /etc/kolla/globals.yml  | grep -v ^$| grep -v ^#kolla_base_distro: "centos"kolla_install_type: "source"openstack_release: "stein"kolla_internal_vip_address: "192.168.137.254"docker_registry: "registry.cn-hangzhou.aliyuncs.com"docker_namespace: "openstackbl"network_interface: "enp0s3"neutron_external_interface: "enp0s8"neutron_plugin_agent: "linuxbridge"enable_ceph: "yes"ceph_osd_store_type: "bluestore"enable_ceph_rgw: "yes"enable_cinder: "yes"enable_neutron_qos: "yes"enable_ceph_rgw_keystone: "yes"glance_backend_ceph: "yes"glance_enable_rolling_upgrade: "no"cinder_backend_ceph: "{{ enable_ceph }}"nova_backend_ceph: "{{ enable_ceph }}"ironic_dnsmasq_dhcp_range:tempest_image_id:tempest_flavor_ref_id:tempest_public_network_id:tempest_floating_network_name:

以上的配置中,本人使用了自己在阿里上搭建的docker仓库。里面的镜像,是从docker的官网push而来。这个仓库是私有仓库,要是需要使用的话,请联系本作者。
注:如果此环境所在的网络中还有其它使用Kolla部署的openstack,那么需要修改globals.yml中的

#keepalived_virtual_router_id: "51"

把51改成1到99的之间的整数即可。

7 部署openstack

7.1 本环境使用Ceph作为后端存储,需要添加磁盘,做OSD,并且修改硬盘标签
[root@openstack ~]# lsblk NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsda               8:0    0  200G  0 disk ├─sda1            8:1    0    1G  0 part /boot└─sda2            8:2    0  199G  0 part   ├─centos-root 253:0    0  150G  0 lvm  /  ├─centos-swap 253:1    0  7.9G  0 lvm  [SWAP]  └─centos-home 253:2    0 41.1G  0 lvm  /homesdb               8:16   0  100G  0 disk sdc               8:32   0  100G  0 disk sdd               8:48   0    100G  0 disk 

可以看到有三块空白盘,修改这三块盘的标签

[root@openstack ~]# parted /dev/sdb -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP 1 -1[root@openstack ~]# parted /dev/sdc -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP 1 -1[root@openstack ~]# parted /dev/sdd -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP 1 -1[root@openstack ~]# lsblk NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsda               8:0    0  200G  0 disk ├─sda1            8:1    0    1G  0 part /boot└─sda2            8:2    0  199G  0 part   ├─centos-root 253:0    0  150G  0 lvm  /  ├─centos-swap 253:1    0  7.9G  0 lvm  [SWAP]  └─centos-home 253:2    0 41.1G  0 lvm  /homesdb               8:16   0  100G  0 disk └─sdb1            8:17   0  100G  0 part sdc               8:32   0  100G  0 disk └─sdc1            8:33   0  100G  0 part sdd               8:48   0    100G  0 disk └─sdd1            8:49   0    100G  0 part 
7.2 生成openstack密码
[root@openstack ~]# kolla-genpwd
7.3 pull镜像
[root@openstack ~]# kolla-ansible pull...........PLAY RECAP ************************************************************************************************************************************************localhost                  : ok=40   changed=0    unreachable=0    failed=0    skipped=77   rescued=0    ignored=0 

出现以上提示,pull成功。如果在pull中出现问题,可以在评论中留言

7.4 检查Kolla
[root@openstack ~]# kolla-ansible prechecksPLAY RECAP ************************************************************************************************************************************************localhost                  : ok=102  changed=0    unreachable=0    failed=0    skipped=147  rescued=0    ignored=0 

出现以上提示,prechecks成功。如果在检查的过程中,有遇到问题,请在评论区留言。

7.5 部署Kolla
[root@openstack ~]# kolla-ansible deploy -vvv
TASK [ceph : Enable ceph dashboard] ***************************************************************************************************************************************task path: /usr/share/kolla-ansible/ansible/roles/ceph/tasks/start_ceph_dashboard.yml:2 ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~root && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1567411390.78-165388867051828 `" && echo ansible-tmp-1567411390.78-165388867051828="` echo /root/.ansible/tmp/ansible-tmp-1567411390.78-165388867051828 `" ) && sleep 0'Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py PUT /root/.ansible/tmp/ansible-local-7809exM0Cg/tmpteinHV TO /root/.ansible/tmp/ansible-tmp-1567411390.78-165388867051828/AnsiballZ_command.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1567411390.78-165388867051828/ /root/.ansible/tmp/ansible-tmp-1567411390.78-165388867051828/AnsiballZ_command.py && sleep 0' EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1567411390.78-165388867051828/AnsiballZ_command.py && sleep 0' EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1567411390.78-165388867051828/ > /dev/null 2>&1 && sleep 0'fatal: [localhost]: FAILED! => {    "changed": false,     "cmd": [        "docker",         "exec",         "ceph_mon",         "ceph",         "mgr",         "module",         "enable",         "dashboard"    ],     "delta": "0:00:00.990347",     "end": "2019-09-02 04:03:11.952770",     "invocation": {        "module_args": {            "_raw_arams": "docker exec ceph_mon ceph mgr module enable dashboard",             "_uses_shell": false,             "argv": null,             "chdir": null,             "creates": null,             "executable": null,             "removes": null,             "stdin": null,             "stdin_add_newline": true,             "strip_empty_ends": true,             "warn": true        }    },     "msg": "non-zero return code",     "rc": 2,     "start": "2019-09-02 04:03:10.962423",     "stderr": "Error ENOENT: all mgr daemons do not support module 'dashboard', pass --force to force enablement",     "stderr_lines": [        "Error ENOENT: all mgr daemons do not support module 'dashboard', pass --force to force enablement"    ],     "stdout": "",     "stdout_lines": []}NO MORE HOSTS LEFT ********************************************************************************************************************************************************PLAY RECAP ****************************************************************************************************************************************************************localhost                  : ok=194  changed=111  unreachable=0    failed=1    skipped=105  rescued=0    ignored=0 

加入-vvv参数可以在部署的过程进行调试。在部署此步时提示如上错误,部署中断。解决方法:

[root@openstack ~]# vim /usr/share/kolla-ansible/ansible/roles/ceph/tasks/start_ceph_dashboard.yml ---- name: Enable ceph dashboard  become: true  command: docker exec ceph_mon ceph mgr module enable dashboard  --force  changed_when: false  run_once: true

在command最后加上 --force,即可解决此问题。
把刚才部署好的容器卸载,然后重新部署:

[root@openstack ~]# kolla-ansible destroy --yes-i-really-really-mean-itDestroy Kolla containers, volumes and host configuration : ansible-playbook -i /usr/share/kolla-ansible/ansible/inventory/all-in-one -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla  /usr/share/kolla-ansible/ansible/destroy.yml [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will change, but still be user configurable on deprecation. This feature will be removed in version 2.10. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see detailsPLAY [Apply role destroy] *************************************************************************************************************************************************TASK [Gathering Facts] ****************************************************************************************************************************************************ok: [localhost]TASK [destroy : include_tasks] ********************************************************************************************************************************************included: /usr/share/kolla-ansible/ansible/roles/destroy/tasks/validate_docker_execute.yml for localhostTASK [destroy : Ensure the docker service is running] *********************************************************************************************************************changed: [localhost]TASK [destroy : include_tasks] ********************************************************************************************************************************************included: /usr/share/kolla-ansible/ansible/roles/destroy/tasks/cleanup_containers.yml for localhostTASK [destroy : Destroying all Kolla containers and volumes] **************************************************************************************************************changed: [localhost]TASK [destroy : include_tasks] ********************************************************************************************************************************************included: /usr/share/kolla-ansible/ansible/roles/destroy/tasks/cleanup_images.yml for localhostTASK [destroy : Removing Kolla images] ************************************************************************************************************************************skipping: [localhost]TASK [destroy : include_tasks] ********************************************************************************************************************************************included: /usr/share/kolla-ansible/ansible/roles/destroy/tasks/cleanup_host.yml for localhostTASK [destroy : Destroying Kolla host configuration] **********************************************************************************************************************changed: [localhost]PLAY RECAP ****************************************************************************************************************************************************************localhost                  : ok=8    changed=3    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   [root@openstack ~]#
[root@openstack ~]# kolla-ansible deploy -vvv



在部署的过程中,我们可以看到在执行ceph-osd相关任务时,没有正确执行的反馈,具体如上图。此时我们可以通过ceph osd tree 命令来查看

[root@openstack ~]# docker exec ceph_mon ceph osd treeID CLASS WEIGHT TYPE NAME    STATUS REWEIGHT PRI-AFF -1            0 root default[root@openstack ~]# docker exec ceph_mon ceph dfRAW STORAGE:    CLASS     SIZE     AVAIL     USED     RAW USED     %RAW USED     TOTAL      0 B       0 B      0 B          0 B             0 POOLS:    POOL          ID     STORED     OBJECTS     USED     %USED     MAX AVAIL     .rgw.root      1        0 B           0      0 B         0           0 B     images         2        0 B           0      0 B         0           0 B     volumes        3        0 B           0      0 B         0           0 B     backups        4        0 B           0      0 B         0           0 B

通过查看,我们得知目前ceph集群没有运行的osd。
等待一段时间后,部署完成,也没有报错。

PLAY [Apply role blazar] **************************************************************************************************************************************************skipping: no hosts matchedPLAY RECAP ****************************************************************************************************************************************************************localhost                  : ok=411  changed=234  unreachable=0    failed=0    skipped=238  rescued=0    ignored=0   [root@openstack ~]#

大概十分钟多一点,openstack部署完成,也没报错。

7.6 生成admin-openrc.sh
[root@openstack ~]# kolla-ansible post-deploy
7.7 上传镜像

ceph作为glance存储,镜像格式要使用raw,操作如下

[root@openstack ~]# yum install qemu-img -y[root@openstack ~]# qemu-img convert -f qcow2 -O raw cirros-0.3.4-x86_64-disk.img cirros.raw[root@openstack ~]# source /etc/kolla/admin-openrc.sh[root@openstack ~]# glance image-create --name cirros --disk-format raw --container-format bare --progress < cirros.raw [========>                     ] 29%

在上传到29%的时候,无法上传。通过查找原因,得出,glance使用Ceph作为后端存储,可用空间为零,下面是glance的日志与ceph状态

2019-09-02 04:24:15.349 24 WARNING glance_store._drivers.rbd [req-7ee511be-930b-4e41-9c08-e1a90c375fe2 1148205e534a4832ba8700ea8b410534 d722008e46fa4ef799c68c766b26781b - default default] since image size is zero we will be doing resize-before-write for each chunk which will be considerably slower than normal[root@openstack ~]# docker exec ceph_mon ceph -s  cluster:    id:     055889bd-64a5-4129-a853-340d82bcddc5    health: HEALTH_WARN            Reduced data availability: 40 pgs inactive  services:    mon: 1 daemons, quorum 192.168.137.2 (age 14m)    mgr: localhost(active, since 14m)    osd: 0 osds: 0 up, 0 in  data:    pools:   5 pools, 40 pgs    objects: 0 objects, 0 B    usage:   0 B used, 0 B / 0 B avail    pgs:     100.000% pgs unknown             40 unknown[root@openstack ~]#

可以看到ceph的pg属于unknown状态,说明这个ceph集群不能使用。

8. 修改kolla-ansible源码

8.1 在修改源码之前,我们把已经部署的好集群卸载
[root@openstack ~]# kolla-ansible destroy --yes-i-really-really-mean-itDestroy Kolla containers, volumes and host configuration : ansible-playbook -i /usr/share/kolla-ansible/ansible/inventory/all-in-one -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla  /usr/share/kolla-ansible/ansible/destroy.yml [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will change, but still be user configurable on deprecation. This feature will be removed in version 2.10. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see detailsPLAY [Apply role destroy] *************************************************************************************************************************************************TASK [Gathering Facts] ****************************************************************************************************************************************************ok: [localhost]TASK [destroy : include_tasks] ********************************************************************************************************************************************included: /usr/share/kolla-ansible/ansible/roles/destroy/tasks/validate_docker_execute.yml for localhostTASK [destroy : Ensure the docker service is running] *********************************************************************************************************************changed: [localhost]TASK [destroy : include_tasks] ********************************************************************************************************************************************included: /usr/share/kolla-ansible/ansible/roles/destroy/tasks/cleanup_containers.yml for localhostTASK [destroy : Destroying all Kolla containers and volumes] **************************************************************************************************************changed: [localhost]TASK [destroy : include_tasks] ********************************************************************************************************************************************included: /usr/share/kolla-ansible/ansible/roles/destroy/tasks/cleanup_images.yml for localhostTASK [destroy : Removing Kolla images] ************************************************************************************************************************************skipping: [localhost]TASK [destroy : include_tasks] ********************************************************************************************************************************************included: /usr/share/kolla-ansible/ansible/roles/destroy/tasks/cleanup_host.yml for localhostTASK [destroy : Destroying Kolla host configuration] **********************************************************************************************************************changed: [localhost]PLAY RECAP ****************************************************************************************************************************************************************localhost                  : ok=8    changed=3    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
8.2 修改bootstrap_osds.yml

修改第6行、第19行

[root@openstack ~]# vim /usr/share/kolla-ansible/ansible/roles/ceph/tasks/bootstrap_osds.yml-a "partition_name='KOLLA_CEPH_OSD_BOOTSTRAP' match_mode='prefix' use_udev={{ kolla_ceph_use_udev }}"
-a "partition_name='KOLLA_CEPH_OSD_CACHE_BOOTSTRAP' match_mode='prefix' use_udev={{ kolla_ceph_use_udev }}"

注释39-42行、注释100-102行。在42、102行后面添加

#    - not item.external_journal | bool#    - item.device.split('/')[2] in ansible_devices  # if there is no device in setup (like loopback, we don't need to warn user#    - ansible_devices[item.device.split('/')[2]].partitions|count > 1#    - ceph_osd_wipe_disk != "yes-i-really-really-mean-it"     - item.external_journal | bool == False     - ansible_devices[item.device.split('/')[2]].partitions|count > 1     - ceph_osd_wipe_disk != "yes-i-really-really-mean-it"#     - not item.external_journal | bool#     - ansible_devices[item.device.split('/')[2]].partitions|count > 1#     - ceph_osd_wipe_disk != "yes-i-really-really-mean-it"      - item.external_journal | bool == False      - ansible_devices[item.device.split('/')[2]].partitions|count > 1      -  ceph_osd_wipe_disk != "yes-i-really-really-mean-it"
8.3 修改start_osds.yml

修改第六行

[root@openstack ~]# vim /usr/share/kolla-ansible/ansible/roles/ceph/tasks/start_osds.yml-a "partition_name='KOLLA_CEPH_DATA_BS' match_mode='prefix' use_udev={{ kolla_ceph_use_udev }}"

9. 重新部署openstack

执行部署命令

[root@openstack ~]# kolla-ansible deploy -vvv

部署过程中查看是不启动osd,如下图


通过任务可以看到,osd盘已经创建成功。可以通过下面命令来查看osd容器,ceph状态

[root@openstack ~]# docker ps | grep ceph3b765534475d        registry.cn-hangzhou.aliyuncs.com/openstackbl/centos-source-ceph-rgw:stein          "dumb-init --single-…"   About a minute ago   Up About a minute                       ceph_rgw7b326a2844f2        registry.cn-hangzhou.aliyuncs.com/openstackbl/centos-source-ceph-osd:stein          "dumb-init --single-…"   About a minute ago   Up About a minute                       ceph_osd_26abde420cd43        registry.cn-hangzhou.aliyuncs.com/openstackbl/centos-source-ceph-osd:stein          "dumb-init --single-…"   About a minute ago   Up About a minute                       ceph_osd_13576d8cf558c        registry.cn-hangzhou.aliyuncs.com/openstackbl/centos-source-ceph-osd:stein          "dumb-init --single-…"   About a minute ago   Up About a minute                       ceph_osd_02658dfc87737        registry.cn-hangzhou.aliyuncs.com/openstackbl/centos-source-ceph-mgr:stein          "dumb-init --single-…"   2 minutes ago        Up 2 minutes                            ceph_mgrc3a97ff4a395        registry.cn-hangzhou.aliyuncs.com/openstackbl/centos-source-ceph-mon:stein          "dumb-init --single-…"   2 minutes ago        Up 2 minutes                            ceph_mon[root@openstack ~]# docker exec -it ceph_mon ceph -s  cluster:    id:     055889bd-64a5-4129-a853-340d82bcddc5    health: HEALTH_WARN            too few PGs per OSD (18 < min 30)  services:    mon: 1 daemons, quorum 192.168.137.2 (age 3m)    mgr: localhost(active, since 3m)    osd: 3 osds: 3 up (since 2m), 3 in (since 2m)    rgw: 1 daemon active (radosgw.gateway)  data:    pools:   7 pools, 56 pgs    objects: 219 objects, 1.2 KiB    usage:   3.0 GiB used, 297 GiB / 300 GiB avail    pgs:     56 active+clean[root@openstack ~]#

大概十几分钟后,openstack部署成功

PLAY [Apply role blazar] **************************************************************************************************************************************************skipping: no hosts matchedPLAY RECAP ****************************************************************************************************************************************************************localhost                  : ok=415  changed=237  unreachable=0    failed=0    skipped=234  rescued=0    ignored=0

至此ceph-osd创建成功。稍等片刻后,openstack部署成功后,接着下面的操作

10. 测试openstack

10.1 上传镜像
[root@openstack ~]# kolla-ansible post-deploy[root@openstack ~]# source /etc/kolla/admin-openrc.sh [root@openstack ~]# glance image-create --name cirros --disk-format raw --container-format bare --progress < cirros.raw [=============================>] 100%+------------------+----------------------------------------------------------------------------------+| Property         | Value                                                                            |+------------------+----------------------------------------------------------------------------------+| checksum         | 56730d3091a764d5f8b38feeef0bfcef                                                 || container_format | bare                                                                             || created_at       | 2019-09-02T09:18:32Z                                                             || disk_format      | raw                                                                              || id               | 07ab1c4e-d16d-4b55-b1f1-017a0699662e                                             || locations        | [{"url": "rbd://055889bd-64a5-4129-a853-340d82bcddc5/images/07ab1c4e-d16d-       ||                  | 4b55-b1f1-017a0699662e/snap", "metadata": {}}]                                   || min_disk         | 0                                                                                || min_ram          | 0                                                                                || name             | cirros                                                                           || os_hash_algo     | sha512                                                                           || os_hash_value    | 34f5709bc2363eafe857ba1344122594a90a9b8cc9d80047c35f7e34e8ac28ef1e14e2e3c13d55a4 ||                  | 3b841f533435e914b01594f2c14dd597ff9949c8389e3006                                 || os_hidden        | False                                                                            || owner            | 544d94b977234b0295726b0c7163c3e8                                                 || protected        | False                                                                            || size             | 41126400                                                                         || status           | active                                                                           || tags             | []                                                                               || updated_at       | 2019-09-02T09:18:34Z                                                             || virtual_size     | Not available                                                                    || visibility       | shared                                                                           |+------------------+----------------------------------------------------------------------------------+[root@openstack ~]#

可以看到镜像可以上传成功

10.2 在ceph中查看镜像
[root@openstack ~]# docker exec ceph_mon rbd -p images ls07ab1c4e-d16d-4b55-b1f1-017a0699662e[root@openstack ~]# docker exec ceph_mon rbd -p images info 07ab1c4e-d16d-4b55-b1f1-017a0699662erbd image '07ab1c4e-d16d-4b55-b1f1-017a0699662e':    size 39 MiB in 5 objects    order 23 (8 MiB objects)    snapshot_count: 1    id: 11939304e103    block_name_prefix: rbd_data.11939304e103    format: 2    features: layering, exclusive-lock, object-map, fast-diff, deep-flatten    op_features:     flags:     create_timestamp: Mon Sep  2 05:18:33 2019    access_timestamp: Mon Sep  2 05:18:33 2019    modify_timestamp: Mon Sep  2 05:18:33 2019[root@openstack ~]#

可以看到镜像的存储路径为ceph images pool

11. Q&A

0