第 4 章 将 overcloud 从 OpenStack Platform 版本 15 升级到 16.1


要升级 overcloud,您必须更新 overcloud 计划,为升级准备节点,准备适用于您的环境的所有容器镜像配置,并升级节点。

重要

在解决 BZ#1872404 之前,对于基于可组合角色的节点,您必须先更新 Database 角色,然后再更新 Controller, Messaging, Compute, Ceph 和其他角色。

前提条件

  • 您已将 undercloud 节点从 OpenStack Platform 版本 15 升级到 16.1。

要升级 overcloud,请完成以下任务:

4.1. 准备容器镜像以滚动升级 HA 服务

命名空间的 name_prefixname_suffix 中由 HA 服务使用时,Pacemaker 会自动重启 control plane 中该服务的所有实例,以使用新配置的容器镜像名称重新创建容器。

由于 Red Hat OpenStack 15 和 16.1 使用不同的 name_prefix 值,所以在更新集群中的节点后,剩余的节点开始使用新容器镜像,并预期在本地存在。

要允许滚动更新 HA 容器镜像名称,Red Hat OpenStack 16.1 引入了 ClusterCommonTag heat 参数,将 HA 服务配置为使用带有固定 name_prefix 的中间镜像名称,即 cluster.common.tag,以及一个固定 name_suffix,即 pcmklatest。每次 director 在节点上拉取新容器镜像时,它会更新中间镜像标签,以便它们指向新拉取的镜像。

要转换到 OpenStack 16.1 中间容器镜像命名方案,您必须手动为控制器节点上每个 HA 容器镜像创建初始容器标签。新的 cluster.common.tag/rhosp16-openstack the 容器标签将指向原始 registry/rhosp15-openstack the:pcmklatest 标签引用的相同容器镜像 ID。

流程

  1. stack 用户的身份登录 undercloud。
  2. Source stackrc 文件:

    $ source ~/stackrc
  3. 创建 overcloud 的静态清单文件:

    $ tripleo-ansible-inventory --static-yaml-inventory ~/inventory.yaml
  4. 创建使用新名称标记现有镜像的脚本:

    cat > pcmkr_common_tag.sh <<'EOF'
    #!/bin/sh
    # Due to a change in internal CI repo, we need to adjust
    # the HA relate containers before running the update.
    # See bz#1846042/PIDONE
    OLD_PREFIX=${1:-"openstack-"}
    NEW_PREFIX=${2:-"openstack-"}
    TRANSFORM=s%${OLD_PREFIX}%${NEW_PREFIX}%p
    
    # Get all images used by HA containers (disregards images with cluster common tag in their name)
    IMAGES=$(sudo podman images | awk '$1 !~ /cluster.common.tag/ && $2 ~ /pcmklatest/ {print $1}')
    
    if [ -n "$IMAGES" ]; then
        echo "Creating cluster common tags and linking them to current HA images"
    fi
    
    # i: 192.168.24.1:8787/rhosp15-rhel8/openstack-mariadb
    # image: openstack-mariadb
    # transformed: openstack-mariadb
    # full_i: 192.168.24.1:8787/rhosp15-rhel8/openstack-mariadb:pcmklatest
    # full_icommon: cluster.common.tag/openstack-mariadb:pcmklatest
    for i in $IMAGES; do
        image=$(echo "$i" | sed 's%.*/%%')
        transformed=$(echo $image | sed -n $TRANSFORM)
        full_i=$i:pcmklatest
        full_icommon=cluster.common.tag/${transformed}:pcmklatest
        # echo $i - $TRANSFORM "=>" $image - $transformed
    
        # original image points to a image hash, create a new tag
        # with cluster.common.tag and make it point to the same image hash
        echo $full_i "-->" $full_icommon
        sudo podman tag $full_i $full_icommon
    done
    EOF
  5. 要使用新名称标记现有镜像,请运行该脚本:

    $ ansible -i inventory.yaml 'overcloud' -m script -a './pcmkr_common_tag.sh'
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat, Inc.