4.3. 创建自定义 NIC 配置


每个角色都需要一个唯一的 NIC 配置。完成以下步骤以创建基本 NIC 模板集合的副本,并将新模板映射到相应的 NIC 配置资源。

流程

  1. 进入核心 heat 模板目录:

    $ cd /usr/share/openstack-tripleo-heat-templates
  2. 使用 tools/process-templates.py 脚本、自定义 network_data 文件和自定义 roles_data 文件呈现 Jinja2 模板:

    $ tools/process-templates.py \
        -n /home/stack/network_data_spine_leaf.yaml \
        -r /home/stack/roles_data_spine_leaf.yaml \
        -o /home/stack/openstack-tripleo-heat-templates-spine-leaf
  3. 进入主目录:

    $ cd /home/stack
  4. 从其中一个默认 NIC 模板复制内容,以用作您的 spine-leaf 模板的基础。例如,复制 single-nic-vlans NIC 模板:

    $ cp -r openstack-tripleo-heat-templates-spine-leaf/network/config/single-nic-vlans/* /home/stack/templates/spine-leaf-nics/.
  5. 编辑 /home/stack/templates/spine-leaf-nics/ 中的每个 NIC 配置,并将配置脚本的位置更改为绝对位置。滚动到网络配置部分,类似于以下片断:

    resources:
      OsNetConfigImpl:
        type: OS::Heat::SoftwareConfig
        properties:
          group: script
          config:
            str_replace:
              template:
                get_file: ../../scripts/run-os-net-config.sh
              params:
                $network_config:
                  network_config:

    将脚本的位置改为绝对路径:

    resources:
      OsNetConfigImpl:
        type: OS::Heat::SoftwareConfig
        properties:
          group: script
          config:
            str_replace:
              template:
                get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
              params:
                $network_config:
                  network_config:

    在每个文件中为每个 Leaf 进行这个更改并保存更改。

    注意

    有关进一步的 NIC 更改,请参阅高级 Overcloud 自定义指南中的自定义网络接口模板https://access.redhat.com/documentation/zh-cn/red_hat_openstack_platform/16.1/html/advanced_overcloud_customization/assembly_custom-network-interface-templates

  6. 创建名为 spine-leaf-nics.yaml 的文件,并编辑该文件。
  7. 在文件中创建一个 resource_registry 部分,并添加一组映射到相应 NIC 模板的 ::Net::SoftwareConfig 资源:

    resource_registry:
      OS::TripleO::Controller::Net::SoftwareConfig: /home/stack/templates/spine-leaf-nics/controller.yaml
      OS::TripleO::ComputeLeaf0::Net::SoftwareConfig: /home/stack/templates/spine-leaf-nics/computeleaf0.yaml
      OS::TripleO::ComputeLeaf1::Net::SoftwareConfig: /home/stack/templates/spine-leaf-nics/computeleaf1.yaml
      OS::TripleO::ComputeLeaf2::Net::SoftwareConfig: /home/stack/templates/spine-leaf-nics/computeleaf2.yaml
      OS::TripleO::CephStorageLeaf0::Net::SoftwareConfig: /home/stack/templates/spine-leaf-nics/ceph-storageleaf0.yaml
      OS::TripleO::CephStorageLeaf1::Net::SoftwareConfig: /home/stack/templates/spine-leaf-nics/ceph-storageleaf1.yaml
      OS::TripleO::CephStorageLeaf2::Net::SoftwareConfig: /home/stack/templates/spine-leaf-nics/ceph-storageleaf2.yaml

    这些资源映射会在部署过程中覆盖默认资源映射。

  8. 保存 spine-leaf-nics.yaml 文件。
  9. 删除渲染的模板目录:

    $ rm -rf openstack-tripleo-heat-templates-spine-leaf

    因此,您现在有一组 NIC 模板和一个环境文件,它将所需的 ::Net::SoftwareConfig 资源映射到它们。

  10. 最终运行 openstack overcloud deploy 命令时,请确保按以下顺序包含环境文件:

    1. /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml,它可启用网络隔离。请注意,director 从 network-isolation.j2.yaml Jinja2 模板呈现此文件。
    2. /usr/share/openstack-tripleo-heat-templates/environments/network-environment.yaml,它是默认的网络环境文件,包括默认的 NIC 资源映射。请注意,director 从 network-environment.j2.yaml Jinja2 模板呈现此文件。
    3. /home/stack/templates/spine-leaf-nics.yaml,其中包含您的自定义 NIC 资源映射并覆盖默认 NIC 资源映射。

      以下命令片断演示了排序:

      $ openstack overcloud deploy --templates
          ...
          -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \
          -e /usr/share/openstack-tripleo-heat-templates/environments/network-environment.yaml \
          -e /home/stack/templates/spine-leaf-nics.yaml \
          ...
  11. 完成以下部分中的步骤,在网络环境文件中添加详情,并定义 spine leaf 架构的某些方面。完成此配置后,请将此文件包含在 openstack overcloud deploy 命令中。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.