4.11. 在 spine-leaf 部署中添加新的树(leaf)

当增加网络容量或添加新物理站点时,您可能需要向 Red Hat OpenStack Platform (RHOSP) spine-leaf 网络添加新的叶。

先决条件

  • 您的 RHOSP 部署使用 spine-leaf 网络拓扑。

流程

  1. stack 用户身份登录 undercloud 主机。
  2. 查找 stackrc undercloud 凭据文件:

    $ source ~/stackrc
  3. 打开网络定义模板,例如 /home/stack/templates/Demoe-leaf-networks-data.yaml。在适当的基础网络中,为要添加的新叶添加一个叶子网作为可组合网络项。

    示例

    在本例中,添加了新 leaf(leaf3)的子网条目:

    - name: InternalApi
      name_lower: internal_api
      vip: true
      vlan: 10
      ip_subnet: '172.18.0.0/24'
      allocation_pools: [{'start': '172.18.0.4', 'end': '172.18.0.250'}]
      gateway_ip: '172.18.0.1'
      subnets:
        internal_api_leaf1:
          vlan: 11
          ip_subnet: '172.18.1.0/24'
          allocation_pools: [{'start': '172.18.1.4', 'end': '172.18.1.250'}]
          gateway_ip: '172.18.1.1'
        internal_api_leaf2:
          vlan: 12
          ip_subnet: '172.18.2.0/24'
          allocation_pools: [{'start': '172.18.2.4', 'end': '172.18.2.250'}]
          gateway_ip: '172.18.2.1'
        internal_api_leaf3:
          vlan: 13
          ip_subnet: '172.18.3.0/24'
          allocation_pools: [{'start': '172.18.3.4', 'end': '172.18.3.250'}]
          gateway_ip: '172.18.3.1'
  4. 为您要添加的新 leaf 创建角色数据文件。

    1. 复制用于您添加的新 leaf Compute 和 leaf Ceph Storage 文件。

      示例

      在本例中,Compute1.yamlCephStorage1.yaml 会分别为新的 leaf、Compute3.yamlCephStorage3.yaml 复制:

      $ cp ~/roles/Compute1.yaml ~/roles/Compute3.yaml
      $ cp ~/roles/CephStorage1.yaml ~/roles/CephStorage3.yaml
    2. 编辑新叶文件中的 nameHostnameFormatDefault 参数,使其与对应的 leaf 参数一致。

      示例

      例如,Leaf 1 Compute 文件中的参数具有以下值:

      - name: ComputeLeaf1
        HostnameFormatDefault: '%stackname%-compute-leaf1-%index%'

      示例

      Leaf 1 Ceph Storage 参数具有以下值:

      - name: CephStorageLeaf1
        HostnameFormatDefault: '%stackname%-cephstorage-leaf1-%index%'
    3. 编辑新 leaf 文件中的 network 参数,以便它们与对应的 Leaf 网络参数一致。

      示例

      例如,Leaf 1 Compute 文件中的参数具有以下值:

      - name: ComputeLeaf1
        networks:
          InternalApi:
            subnet: internal_api_leaf1
          Tenant:
            subnet: tenant_leaf1
          Storage:
            subnet: storage_leaf1

      示例

      Leaf 1 Ceph Storage 参数具有以下值:

      - name: CephStorageLeaf1
        networks:
          Storage:
            subnet: storage_leaf1
          StorageMgmt:
            subnet: storage_mgmt_leaf1
    4. 当您的角色配置完成后,运行以下命令来生成完整的角色数据文件。包括您的网络中的所有树和您要添加的新树叶。

      示例

      在本例中,leaf3 被添加到 leaf0, leaf1 和 leaf2:

      $ openstack overcloud roles generate --roles-path ~/roles -o roles_data_spine_leaf.yaml Controller Controller1 Controller2 Compute Compute1 Compute2 Compute3 CephStorage CephStorage1 CephStorage2 CephStorage3

      这会创建一个完整的 roles_data_spine_leaf.yaml 文件,其中包含每个各自叶网络的所有自定义角色。

  5. 为您要添加的 leaf 创建自定义 NIC 配置。

    1. 复制您要添加的新叶型计算和 leaf Ceph Storage NIC 配置文件。

      示例

      在本例中,computeleaf1.yamlceph-storageleaf1.yaml 会分别为新 leaf、computeleaf3.yamlceph-storageleaf3.yaml 复制:

      $ cp ~/templates/spine-leaf-nics/computeleaf1.yaml ~/templates/spine-leaf-nics/computeleaf3.yaml
      $ cp ~/templates/spine-leaf-nics/ceph-storageleaf1.yaml ~/templates/spine-leaf-nics/ceph-storageleaf3.yaml
  6. 打开自定义环境文件,其中包含每个角色的角色和自定义 NIC 模板映射,例如 spine-leaf-nic-roles-map.yaml。为您要添加的新叶插入每个角色的条目。

    parameter_defaults:
      %%ROLE%%NetworkConfigTemplate: <path_to_ansible_jinja2_nic_config_file>

    示例

    在本例中,添加了 ComputeLeaf3NetworkConfigTemplateCephStorage3NetworkConfigTemplate 条目:

    parameter_defaults:
      Controller0NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      Controller1NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      Controller2NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      ComputeLeaf0NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      ComputeLeaf1NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      ComputeLeaf2NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      ComputeLeaf3NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      CephStorage0NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      CephStorage1NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      CephStorage2NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
      CephStorage3NetworkConfigTemplate: '/home/stack/templates/spine-leaf-nics/single-nic-vlans.j2'
  7. 打开包含独立网络映射的自定义网络环境文件,并为 overcloud 设置 control plane 网络的访问权限,如 spine-leaf-ctlplane.yaml 并更新 control plane 参数。

    parameter_defaults 部分下,为新叶网络添加 control plane 子网映射。此外,包括新叶网络的外部网络映射。

    • 对于 flat 网络映射,列出 NeutronFlatNetworks 参数中的新 leaf(leaf3),并为新 leafs 设置 NeutronBridgeMappings 参数:

      parameter_defaults:
        NeutronFlatNetworks: leaf0,leaf1,leaf2,leaf3
        Controller0Parameters:
          NeutronBridgeMappings: "leaf0:br-ex"
        Compute0Parameters:
          NeutronBridgeMappings: "leaf0:br-ex"
        Compute1Parameters:
          NeutronBridgeMappings: "leaf1:br-ex"
        Compute2Parameters:
          NeutronBridgeMappings: "leaf2:br-ex"
        Compute3Parameters:
          NeutronBridgeMappings: "leaf3:br-ex"
    • 对于 VLAN 网络映射,还设置 NeutronNetworkVLANRanges 来映射新leaf(leaf3)网络的 VLAN:

        NeutronNetworkType: 'geneve,vlan'
        NeutronNetworkVLANRanges: 'leaf0:1:1000,leaf1:1:1000,leaf2:1:1000,leaf3:1:1000'

      示例

      本例中使用了扁平网络映射,并添加了新的叶(leaf3)条目:

      parameter_defaults:
        NeutronFlatNetworks: leaf0,leaf1,leaf2,leaf3
        Controller0Parameters:
          NeutronBridgeMappings: "leaf0:br-ex"
        ControllerControlPlaneSubnet: leaf0
        Controller1Parameters:
          NeutronBridgeMappings: "leaf0:br-ex"
        Controller1ControlPlaneSubnet: leaf0
        Controller2Parameters:
          NeutronBridgeMappings: "leaf0:br-ex"
        Controller2ControlPlaneSubnet: leaf0
        Compute0Parameters:
          NeutronBridgeMappings: "leaf0:br-ex"
        Compute0ControlPlaneSubnet: leaf0
        Compute1Parameters:
          NeutronBridgeMappings: "leaf1:br-ex"
        Compute1ControlPlaneSubnet: leaf1
        Compute2Parameters:
          NeutronBridgeMappings: "leaf2:br-ex"
        Compute2ControlPlaneSubnet: leaf2
        Compute3Parameters:
          NeutronBridgeMappings: "leaf3:br-ex"
        Compute3ControlPlaneSubnet: leaf3
  8. 按照 部署启用了 spine-leaf 的 overcloud 中的步骤重新部署启用了 spine-leaf 的 overcloud