Red Hat Training

A Red Hat training course is available for Red Hat OpenStack Platform

第9章 異種混在のコンピュートクラスターの設定

本項では、SR-IOV コンピュートノードと OVS-DPDK コンピュートノードを同じ環境にデプロイする方法について説明します。このデプロイメントでは、network-environment.yaml ファイルでロール固有のパラメーターを定義して、OVS-DPDK と SR-IOV 用のカスタムロールを使用しています。コンポーザブルロールの作成とデプロイには、以下のプロセスが含まれます。

  • roles_data.yaml ファイルのローカルコピーに SR-IOV と OVS-DPDK のカスタムロールを定義します。
  • network_environment.yaml ファイルで、SR-IOV ロールと OVS-DPDK ロール向けにロール固有のパラメーターを設定します。
  • 更新したロールセットでオーバークラウドをデプロイします。

オーバークラウドで異種混在のコンピュートクラスターをデプロイする前には、アンダークラウドをインストールして設定する必要があります。詳しくは、『director のインストールと使用方法』を参照してください。

注記

これらのカスタムロールに対応した OpenStack フレーバーを作成するようにしてください。

重要

OVS-DPDK 向けの OpenStack ネットワークを最適化するには、network-environment.yaml ファイルで設定する OVS-DPDK パラメーターの最も適切な値を決定する必要があります。詳しくは、「ワークフローを使用した DPDK パラメーターの算出」を参照してください。

9.1. 命名規則

OpenStack デプロイメントにおいて、特に異種混在のコンピュートクラスターでカスタムロールを使用する場合には、一貫性のある命名規則に従うことを推奨します。この命名規則は、以下のファイルと設定の作成時に役立てることができます。

  • instackenv.json: SR-IOV インターフェースを使用するコンピュートノードと DPDK インターフェースを使用するコンピュートノードを区別します。

    "name":"computeovsdpdk-0"
  • roles_data.yaml: SR-IOV をサポートするコンピュートベースのロールと、DPDK をサポートするコンピュートベースのロールを区別します。

    `ComputeOvsDpdk`
  • network_environment.yaml -

    • カスタムロールが、正しいフレーバー名に対応するようにします。

       `OvercloudComputeOvsDpdkFlavor: computeovsdpdk`
    • ロール固有のパラメーターには、正しいカスタムロール名を含めます。

      `ComputeOvsDpdkParameters`
  • nic-config ファイルの名前: SR-IOV をサポートするコンピュートノードの NIC yaml ファイルと DPDK インターフェースをサポートするコンピュートノードの yaml ファイルを区別します。
  • フレーバーの作成: フレーバーと capabilities:profile の値が適切なベアメタルノードとカスタムロールに対応するようにします。

    # openstack flavor create --id auto --ram 4096 --disk 40 --vcpus 4 computeovsdpdk
    # openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" --property "capabilities:profile"="computeovsdpdk" computeovsdpdk
  • ベアメタルノード: ベアメタルノードが適切なハードウェアと capability:profile の値に対応するようにします。

     # openstack baremetal node update computeovsdpdk-0 add properties/capabilities='profile:computeovsdpdk,boot_option:local'
注記

フレーバー名は、そのフレーバーの capabilities:profile の値に対応する必要はありませんが、フレーバーの capabilities:profile 値はベアメタルノードの properties/capabilities='profile 値に対応する必要があります。上記の例では、これらの 3 つにすべて computeovsdpdk を使用しています。

注記

カスタムロールとプロファイルに使用するノードはすべて CPU、RAM、PCI ハードウェアトポロジーが同じになるようにします。

以下の例では、ComputeOvsDpdkComputeSriov は、コンピュートノード用のカスタムロールで、適切な NIC が搭載されたノードでのみ DPDK または SR-IOV を有効にします。Red Hat OpenStack Platform によって提供される既存のデフォルトロールセットは、/home/stack/roles_data.yaml ファイルに保管されます。

9.2. SR-IOV および OVS-DPDK カスタムロールの作成

Red Hat OpenStack Platform は roles_data.yaml ファイルでデフォルトロールのセットを提供しています。必要なロールをサポートするには、独自の roles_data.yaml ファイルを作成することができます。

SR-IOV と OVS-DPDK をサポートするカスタムロールを作成するには、以下の手順を実行します。

  1. ローカルディレクトリーに ComputeSriov.yaml ファイルを作成して、このロールの定義を追加します。

    ###############################################################################
    # Role: ComputeSriov                                                          #
    ###############################################################################
    - name: ComputeSriov
      description: |
        Compute SR-IOV role
      CountDefault: 1
      networks:
        - InternalApi
        - Tenant
        - Storage
      HostnameFormatDefault: 'computesriov-%index%'
      disable_upgrade_deployment: True
      ServicesDefault:
        - OS::TripleO::Services::AuditD
        - OS::TripleO::Services::CACerts
        - OS::TripleO::Services::CephClient
        - OS::TripleO::Services::CephExternal
        - OS::TripleO::Services::CertmongerUser
        - OS::TripleO::Services::Collectd
        - OS::TripleO::Services::ComputeCeilometerAgent
        - OS::TripleO::Services::ComputeNeutronCorePlugin
        - OS::TripleO::Services::ComputeNeutronL3Agent
        - OS::TripleO::Services::ComputeNeutronMetadataAgent
        - OS::TripleO::Services::ComputeNeutronOvsAgent
        - OS::TripleO::Services::Docker
        - OS::TripleO::Services::FluentdClient
        - OS::TripleO::Services::Iscsid
        - OS::TripleO::Services::Kernel
        - OS::TripleO::Services::MySQLClient
        - OS::TripleO::Services::NeutronLinuxbridgeAgent
        - OS::TripleO::Services::NeutronSriovAgent
        - OS::TripleO::Services::NeutronVppAgent
        - OS::TripleO::Services::NovaCompute
        - OS::TripleO::Services::NovaLibvirt
        - OS::TripleO::Services::NovaMigrationTarget
        - OS::TripleO::Services::Ntp
        - OS::TripleO::Services::OpenDaylightOvs
        - OS::TripleO::Services::Securetty
        - OS::TripleO::Services::SensuClient
        - OS::TripleO::Services::Snmp
        - OS::TripleO::Services::Sshd
        - OS::TripleO::Services::Timezone
        - OS::TripleO::Services::TripleoFirewall
        - OS::TripleO::Services::TripleoPackages
        - OS::TripleO::Services::Tuned
        - OS::TripleO::Services::Vpp
        - OS::TripleO::Services::OVNController
  2. ローカルディレクトリーに ComputeOvsDpdk.yaml ファイルを作成して、このロールの定義を追加します。

    ###############################################################################
    # Role: ComputeOvsDpdk                                                        #
    ###############################################################################
    - name: ComputeOvsDpdk
      description: |
        Compute OVS DPDK Role
      CountDefault: 1
      networks:
        - InternalApi
        - Tenant
        - Storage
      HostnameFormatDefault: 'computeovsdpdk-%index%'
      disable_upgrade_deployment: True
      ServicesDefault:
        - OS::TripleO::Services::AuditD
        - OS::TripleO::Services::CACerts
        - OS::TripleO::Services::CephClient
        - OS::TripleO::Services::CephExternal
        - OS::TripleO::Services::CertmongerUser
        - OS::TripleO::Services::Collectd
        - OS::TripleO::Services::ComputeCeilometerAgent
        - OS::TripleO::Services::ComputeNeutronCorePlugin
        - OS::TripleO::Services::ComputeNeutronL3Agent
        - OS::TripleO::Services::ComputeNeutronMetadataAgent
        - OS::TripleO::Services::ComputeNeutronOvsDpdk
        - OS::TripleO::Services::Docker
        - OS::TripleO::Services::FluentdClient
        - OS::TripleO::Services::Iscsid
        - OS::TripleO::Services::Kernel
        - OS::TripleO::Services::MySQLClient
        - OS::TripleO::Services::NovaCompute
        - OS::TripleO::Services::NovaLibvirt
        - OS::TripleO::Services::Ntp
        - OS::TripleO::Services::OpenDaylightOvs
        - OS::TripleO::Services::Securetty
        - OS::TripleO::Services::SensuClient
        - OS::TripleO::Services::Snmp
        - OS::TripleO::Services::Sshd
        - OS::TripleO::Services::Timezone
        - OS::TripleO::Services::TripleoFirewall
        - OS::TripleO::Services::TripleoPackages
  3. ComputeSriov および ComputeOvsDpdk ロールと、デプロイメントに必要なその他のロール用に roles_data.yaml を生成します。

    # openstack overcloud roles generate --roles-path templates/openstack-tripleo-heat-templates/roles -o roles_data.yaml Controller ComputeSriov ComputeOvsDpdk

9.3. CPU アフィニティー向けの tuned の設定

以下の例では、サンプルの post-install.yaml ファイルを使用しています。

  1. tuned の設定で CPU アフィニティーを有効にするように設定します。

      resources:
    
        ExtraDeployments:
          type: OS::Heat::StructuredDeployments
          properties:
            servers:  {get_param: servers}
            config: {get_resource: ExtraConfig}
            actions: ['CREATE','UPDATE']
    
        ExtraConfig:
          type: OS::Heat::SoftwareConfig
          properties:
            group: script
            config: |
              #!/bin/bash
              set -x
              function tuned_service_dependency() {
                tuned_service=/usr/lib/systemd/system/tuned.service
                grep -q "network.target" $tuned_service
                if [ "$?" -eq 0 ]; then
                    sed -i '/After=.*/s/network.target//g' $tuned_service
                fi
                grep -q "Before=.*network.target" $tuned_service
                if [ ! "$?" -eq 0 ]; then
                    grep -q "Before=.*" $tuned_service
                    if [ "$?" -eq 0 ]; then
                        sed -i 's/^\(Before=.*\)/\1 network.target openvswitch.service/g' $tuned_service
                    else
                        sed -i '/After/i Before=network.target openvswitch.service' $tuned_service
                    fi
                fi
              }
    
              if hiera -c /etc/puppet/hiera.yaml service_names | grep -q neutron_ovs_dpdk_agent; then
                  tuned_service_dependency
              fi

9.4. SR-IOV と OVS-DPDK のロール固有のパラメーターの定義

重要

OVS-DPDK 向けの OpenStack ネットワークを最適化するには、network-environment.yaml ファイルに設定する OVS-DPDK パラメーターに最も適した値を判断する必要があります。詳しくは、「OVS-DPDK デプロイメントのプランニング」を参照してください。

SR-IOV と OVS-DPDK のロール固有のパラメーターを network-environment.yaml ファイルで設定します。

  1. network-environment.yaml ファイルに OVS-DPDK および SR-IOV サービス向けのリソースマッピングと、それらのノードのネットワーク設定を追加します。

      resource_registry:
        # Specify the relative/absolute path to the config files you want to use for override the default.
        OS::TripleO::ComputeSriov::Net::SoftwareConfig: nic-configs/compute-sriov.yaml
        OS::TripleO::ComputeOvsDpdk::Net::SoftwareConfig: nic-configs/compute-ovs-dpdk.yaml
        OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml
        OS::TripleO::NodeExtraConfigPost: post-install.yaml
  2. 各ロールのフレーバーを指定します。

    OvercloudControlFlavor: controller
    OvercloudComputeOvsDpdkFlavor: computeovsdpdk
    OvercloudComputeSriovFlavor: computesriov
  3. 各ロール用にデプロイするノード数を指定します。

      #Number of nodes to deploy.
      ControllerCount: 1
      ComputeOvsDpdkCount: 1
      ComputeSriovCount: 1
  4. SR-IOV パラメーターを設定します。

    1. Compute の pci_passthrough_whitelist パラメーターを設定し、SR-IOV インターフェース用の devname を指定します。ホワイトリストにより、インスタンスが利用可能な PCI デバイスが設定されます。

        NovaPCIPassthrough:
          - devname: "ens2f0"
            physical_network: "tenant"
          - devname: "ens2f1"
            physical_network: "tenant"
    2. 物理ネットワークと SR-IOV インターフェースを PHYSICAL_NETWORK:PHYSICAL DEVICE の形式で指定します。

      サーバー上にある network_vlan_ranges に表示されている物理ネットワークにはすべて、各エージェントの適切なインターフェースへのマッピングが必要です。

        NeutronPhysicalDevMappings: "tenant:ens2f0,tenant:ens2f1"

      この例では、physical_network 名に tenant を使用しています。

    3. 各 SR-IOV インターフェースに確保する Virtual Function (VF) の数を指定します。

        NeutronSriovNumVFs: "ens2f0:5,ens2f1:5"

      この例では、SR-IOV インターフェース用に 5 つの VF を確保しています。

      注記

      NFV を実装した Red Hat OpenStack Platform で現在サポートされている VF 数は 30 以下となっています。

  5. SR-IOV のロール固有のパラメーターを設定します。

      # SR-IOV compute node.
      ComputeSriovParameters:
        KernelArgs: default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on
        TunedProfileName: "cpu-partitioning"
        IsolCpusList: "1,2,3,4,5,6,7,9,10,17,18,19,20,21,22,23,11,12,13,14,15,25,26,27,28,29,30,31"
        NovaVcpuPinSet: ['2,3,4,5,6,7,18,19,20,21,22,23,10,11,12,13,14,15,26,27,28,29,30,31']
        NovaReservedHostMemory: 4096
  6. OVS-DPDK のロール固有のパラメーターを設定します。

      # DPDK compute node.
      ComputeOvsDpdkParameters:
        KernelArgs: default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on
        TunedProfileName: "cpu-partitioning"
        IsolCpusList: "1,2,3,4,5,6,7,9,10,17,18,19,20,21,22,23,11,12,13,14,15,25,26,27,28,29,30,31"
        NovaVcpuPinSet: ['2,3,4,5,6,7,18,19,20,21,22,23,10,11,12,13,14,15,26,27,28,29,30,31']
        NovaReservedHostMemory: 4096
        OvsDpdkSocketMemory: "1024,1024"
        OvsDpdkMemoryChannels: "4"
        OvsDpdkCoreList: "0,16,8,24"
        OvsPmdCoreList: "1,17,9,25"
    注記

    DPDK PMD 向けに DPDK NIC のある場合またはない場合も、各 NUMA ノードで少なくとも 1 CPU を (シブリングスレッドとともに) 割り当てて、ゲストインスタンスの作成でエラーが発生するのを回避する必要があります。

  7. DHCP メタデータのパラメーターを設定します。

    # DHCP provide metadata route to VM.
    NeutronEnableIsolatedMetadata: true
    # DHCP always provides metadata route to VM.
    NeutronEnableForceMetadata: true
  8. network-environment.yaml ファイルの残りを設定して、OpenStack デプロイメントの必要に応じて neutron-ovs-dpdk-agent.yaml および neutron-sriov-agent.yaml のファイルからのデフォルトのパラメーターを上書きします。

9.5. SR-IOV および DPDK のコンピュートノードの設定

SR-IOV コンピュートノードと OVS-DPDK コンピュートをサポートするには、以下の手順を実行します。

  1. SR-IOV インターフェースをサポートするための compute-sriov.yaml ファイルを作成します。

    1. 分離ネットワーク用にコントロールプレーンの Linux ボンディングを作成します。

        - type: linux_bond
          name: bond_api
          bonding_options: "mode=active-backup"
          use_dhcp: false
          dns_servers:
            get_param: DnsServers
          members:
          - type: interface
            name: nic3
            primary: true
          - type: interface
            name: nic4
    2. この Linux ボンディングに VLAN を割り当てます。

        - type: vlan
          vlan_id:
            get_param: InternalApiNetworkVlanID
          device: bond_api
          addresses:
          - ip_netmask:
              get_param: InternalApiIpSubnet
      
        - type: vlan
          vlan_id:
            get_param: TenantNetworkVlanID
          device: bond_api
          addresses:
          - ip_netmask:
              get_param: TenantIpSubnet
      
        - type: vlan
          vlan_id:
            get_param: StorageNetworkVlanID
          device: bond_api
          addresses:
          - ip_netmask:
              get_param: StorageIpSubnet
    3. コントローラーへの SR-IOV インターフェースを作成します。

        - type: interface
          name: ens2f0
          mtu: 9000
          use_dhcp: false
          defroute: false
          nm_controlled: true
          hotplug: true
      
        - type: interface
          name: ens2f1
          mtu: 9000
          use_dhcp: false
          defroute: false
          nm_controlled: true
          hotplug: true
  2. DPDK インターフェースをサポートする compute-ovsdpdk.yaml ファイルを作成します。

    1. 分離ネットワーク用にコントロールプレーンの Linux ボンディングを作成します。

        - type: linux_bond
          name: bond_api
          bonding_options: "mode=active-backup"
          use_dhcp: false
          dns_servers:
            get_param: DnsServers
          members:
          - type: interface
            name: nic3
            primary: true
          - type: interface
            name: nic4
    2. この Linux ボンディングに VLAN を割り当てます。

        - type: vlan
          vlan_id:
            get_param: InternalApiNetworkVlanID
          device: bond_api
          addresses:
          - ip_netmask:
              get_param: InternalApiIpSubnet
      
        - type: vlan
          vlan_id:
            get_param: TenantNetworkVlanID
          device: bond_api
          addresses:
          - ip_netmask:
              get_param: TenantIpSubnet
      
        - type: vlan
          vlan_id:
            get_param: StorageNetworkVlanID
          device: bond_api
          addresses:
          - ip_netmask:
              get_param: StorageIpSubnet
    3. コントローラーにリンクするための OVS-DPDK ボンディングを使用するブリッジを設定します。

        - type: ovs_user_bridge
          name: br-link0
          use_dhcp: false
          members:
            - type: ovs_dpdk_bond
              name: dpdkbond0
              mtu: 9000
              rx_queue: 2
              members:
                - type: ovs_dpdk_port
                  name: dpdk0
                  mtu: 9000
                  members:
                    - type: interface
                      name: nic5
                - type: ovs_dpdk_port
                  name: dpdk1
                  mtu: 9000
                  members:
                    - type: interface
                      name: nic6
      注記

      複数の DPDK デバイスが含まれるようにするには、追加する各 DPDK デバイスごとに type コードセクションを繰り返してください。

    注記

    OVS-DPDK を使用する場合には、同じコンピュートノード上の すべて のブリッジが ovs_user_bridge の種別である必要があります。director は設定を受け入れることができますが、Red Hat OpenStack Platform は同じノード上で ovs_bridgeovs_user_bridge が混在する構成はサポートしていません。

9.6. オーバークラウドのデプロイ

以下の例では、コンポーザブルロールを使用する openstack overcloud deploy の Bash スクリプトを定義しています。

#!/bin/bash

openstack overcloud deploy \
--templates \
-r /home/stack/ospd-12-sriov-dpdk-heterogeneous-cluster/roles_data.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/host-config-and-reboot.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/neutron-sriov.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml \
-e /home/stack/ospd-12-vlan-sriov-two-ports-ctlplane-bonding/docker-images.yaml \
-e /home/stack/ospd-12-sriov-dpdk-heterogeneous-cluster/network-environment.yaml

ここで

  • /home/stack/ospd-12-sriov-dpdk-heterogeneous-cluster/roles_data.yaml は、更新された roles_data.yaml ファイルの場所です。このファイルが OVS-DPDK と SR-IOV のコンポーザブルロールを定義します。
  • /home/stack/ospd-12-sriov-dpdk-heterogeneous-cluster/network-environment.yaml には、SR-IOV コンピュートノードと OVS-DPDK コンピュートノード向けのロール固有のパラメーターが含まれています。