4.2. 定义叶角色和附加网络

Red Hat OpenStack Platform (RHOSP) director 为每个叶创建一个可组合角色,并从您构建的角色模板中将可组合网络附加到每个对应角色。首先从 director 核心模板复制默认 Controller、Compute 和 Ceph Storage 角色,并修改它们以满足您的环境需求。创建所有单独的角色后,您将运行 openstack overcloud roles generate 命令将它们连接到一个大型自定义角色数据文件。

先决条件

  • 访问 stack 用户的 undercloud 主机和凭据。

流程

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

    $ source ~/stackrc
  3. 将 RHOSP 附带的 Controller、Compute 和 Ceph Storage 角色的默认角色复制到 stack 用户的主目录。重命名文件以反映它们是叶 0:

    $ cp /usr/share/openstack-tripleo-heat-templates/roles/Controller.yaml ~/roles/Controller0.yaml
    $ cp /usr/share/openstack-tripleo-heat-templates/roles/Compute.yaml ~/roles/Compute0.yaml
    $ cp /usr/share/openstack-tripleo-heat-templates/roles/CephStorage.yaml ~/roles/CephStorage0.yaml
  4. 将叶 0 文件复制到您的叶 1 和叶 2 文件的基础:

    $ cp ~/roles/Compute0.yaml ~/roles/Compute1.yaml
    $ cp ~/roles/Compute0.yaml ~/roles/Compute2.yaml
    $ cp ~/roles/CephStorage0.yaml ~/roles/CephStorage1.yaml
    $ cp ~/roles/CephStorage0.yaml ~/roles/CephStorage2.yaml
  5. 编辑每个文件中的参数,使其与对应的叶参数一致。

    提示

    有关角色数据模板中各种参数的详情,请参考 Director 安装和使用指南中的 检查 角色参数。

    Example - ComputeLeaf0

    - name: ComputeLeaf0
      HostnameFormatDefault: '%stackname%-compute-leaf0-%index%'

    示例 - CephStorageLeaf0

    - name: CephStorageLeaf0
      HostnameFormatDefault: '%stackname%-cephstorage-leaf0-%index%'

  6. 编辑叶 1 和叶 2 文件中的 network 参数,使它们与对应的叶网络参数一致。

    Example - ComputeLeaf1

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

    示例 - CephStorageLeaf1

    - name: CephStorageLeaf1
      networks:
        Storage:
          subnet: storage_leaf1
        StorageMgmt:
          subnet: storage_mgmt_leaf1

    注意

    这只适用于叶 1 和叶 2。leaf 0 的 network 参数保留基本子网值,这些值是每个子网的小写名称和 _subnet 后缀。例如,leaf 0 的内部 API 是 internal_api_subnet

  7. 完成角色配置后,运行 overcloud roles generate 命令来生成完整的角色数据文件。

    示例

    $ openstack overcloud roles generate --roles-path ~/roles -o spine-leaf-roles-data.yaml Controller Compute Compute1 Compute2 CephStorage CephStorage1 CephStorage2

    这会创建一个自定义角色数据文件,其中包含每个对应叶网络的所有自定义角色。

后续步骤

  1. 请注意 overcloud 角色 generate 命令输出的自定义角色数据文件 的路径和文件名。部署 overcloud 时,您将需要此信息。
  2. 继续下一步,为叶角色创建自定义 NIC 配置

其他资源

  • 检查 Director 安装和使用指南中的 角色参数