Red Hat Training
A Red Hat training course is available for Red Hat OpenStack Platform
ネットワーク機能仮想化 (NFV) の設定ガイド
ネットワーク機能仮想化 (NFV) の OpenStack デプロイメントの設定
OpenStack Documentation Team
rhos-docs@redhat.com
概要
前書き
Red Hat OpenStack Platform は、Red Hat Enterprise Linux 上にプライベートまたはパブリックの Infrastructure-as-a-Service (IaaS) クラウドを構築するための基盤を提供します。これにより、スケーラビリティーが極めて高く、耐障害性に優れたプラットフォームをクラウド対応のワークロード開発にご利用いただくことができます。
本ガイドは、NFV デプロイメント向けに Red Hat OpenStack Platform 10 director を使用して SR-IOV および DPDK-accelerated Open vSwitch (OVS) を設定する手順を説明しています。
第1章 概要
ネットワーク機能仮想化 (NFV) とは、汎用のクラウドベースのインフラストラクチャー上でネットワーク機能を仮想化するソフトウェアベースのソリューションです。NFV により、通信事業者 (CSP) は従来のハードウェアから離れることができます。
本ガイドでは、CPU の割り当て、メモリーの確保、NIC の設定の例を紹介します。これらは、トポロジーとユースケースによって異なる場合があります。ハードウェアと設定のオプションについて理解するには、『ネットワーク機能仮想化 (NFV) の製品ガイド』および『ネットワーク機能仮想化 (NFV) のプランニングガイド』を参照してください。
Red Hat OpenStack Platform 10 director により、オーバークラウドネットワーク (外部、テナント、内部 API 等) を分離することができます。ネットワークは、単一のネットワークインターフェース上に、または複数のホストネットワークインターフェースに分散してデプロイすることが可能です。Red Hat OpenStack Platform 10 のインストールでは、ネットワークの分離はテンプレートファイルを使用して設定されます。テンプレートファイルを指定しない場合には、サービスネットワークはすべてプロビジョニングネットワーク上にデプロイされます。テンプレートの設定ファイルには、さまざまな種類があります。
-
network-environment.yaml
: オーバークラウドノードのネットワーク設定で使用するサブネット、IP アドレス範囲などのネットワークの情報が含まれます。このファイルには、さまざまなシナリオで使用できるように、デフォルトのパラメーター値を上書きする別の設定も含まれます。 -
compute.yaml
およびcontroller.yaml
等のホストのテンプレート: オーバークラウドノードのネットワークインターフェース設定が定義されます。 first-boot.yaml
: さまざまな設定ステップを提供します。以下に例を示します。- Grub 引数
- DPDK パラメーター
-
tuned のインストールと設定。
tuned
パッケージに含まれるtuned
デーモンは、システムコンポーネントの使用状況をモニターし、その情報を元にシステム設定を動的にチューニングします。OVS-DPDK および SR-IOV デプロイメントで適切な CPU アフィニティー設定を提供するには、tuned-cpu-partitioning
プロファイルを使用する必要があります。
これらの Heat テンプレートファイルは、アンダークラウドノードの /usr/share/openstack-tripleo-heat-templates/
にあります。
NFV 向けのこれらの heat テンプレートファイルの例については、YAML ファイルの例 を参照してください。
NFV の設定には、YAML ファイルが使用されます。YAML ファイル形式の概要は、「YAML in a Nutshell」を参照してください。
以下の項では、Red Hat OpenStack Platform director を使用した NFV 用 Heat テンプレートファイルの設定方法について説明します。
1.1. コンポーザブルロール
Red Hat OpenStack Platform 10 では、コンポーザブルロールを使用して、NFV 用のカスタムデプロイメントロールを作成することができます。コンポーザブルロールを使用して、各ロールにサービスを追加/削除することができます。コンポーザブルロールの詳しい情報は、『オーバークラウドの高度なカスタマイズ』の「コンポーザブルサービスとカスタムロール」を参照してください。
コンポーザブルロールの設定方法:
-
roles-data.yaml
ファイルをコピーし、これを編集して OVS-DPDK または SR-IOV 用のコンポーザブルロールを追加します。 - OpenStack フレーバーを作成し、そのフレーバーに適切な属性を割り当てます。
- この新しいフレーバーをノードに関連付けます。
-
適切な
network-environment.yaml
ファイルを更新して、カーネル引数と DPDK または SR-IOV 引数のパラメーターを追加します。 -
overcloud_deploy.sh
スクリプトを実行して、コンポーザブルロールと共にオーバークラウドをデプロイします。
第2章 NFV を実装した Red Hat OpenStack Platform の更新
OVS-DPDK を設定している場合には、Red Hat OpenStack Platform を更新する際に追加の考慮事項とステップが必要です。追加のステップについては、『Red Hat OpenStack Platform のアップグレード』の「director ベースの環境: マイナーバージョンへの更新の実行」に説明があります。
第3章 仮想ネットワークの SR-IOV サポートの設定
本章では、director を使用した Red Hat OpenStack Platform 10 環境への Single Root Input/Output Virtualization (SR-IOV) の設定について説明します。
本ガイドでは、CPU の割り当て、メモリーの確保、NIC の設定の例を紹介します。これらは、トポロジーとユースケースによって異なる場合があります。ハードウェアと設定のオプションについて理解するには、『ネットワーク機能仮想化 (NFV) の製品ガイド』および『ネットワーク機能仮想化 (NFV) のプランニングガイド』を参照してください。
etc/tuned/cpu-partitioning-variables.conf
の isolated_cores
や他の値を編集または変更しないでください。これらは、ここで説明する director の heat テンプレートにより変更されます。
以下の手順では、network-environment.yaml
ファイルを更新して、カーネルの引数、SR-IOV ドライバー、PCI パススルーなどのパラメーターを追加します。また、compute.yaml
ファイルも更新して、SR-IOV インターフェースのパラメーターを追加して、overcloud_deploy.sh
スクリプトを実行し、その SR-IOV パラメーターを使用してオーバークラウドをデプロイする必要があります。
3.1. VLAN トンネリングを使用する 2 ポート SR-IOV の設定
本項では、OpenStack 環境に VLAN トンネリングを使用する 2 ポート SR-IOV を設定する際に変更する必要のある YAML ファイルについて説明します。
3.1.1. first-boot.yaml
の変更
以前のデプロイメントで first-boot.yaml
ファイルに以下の行を追加している場合、Open vSwitch 2.9 を使用する Red Hat OpenStack Platform 10 ではこれらの行を削除してください。
ovs_service_path="/usr/lib/systemd/system/ovs-vswitchd.service" grep -q "RuntimeDirectoryMode=.*" $ovs_service_path if [ "$?" -eq 0 ]; then sed -i 's/RuntimeDirectoryMode=.*/RuntimeDirectoryMode=0775/' $ovs_service_path else echo "RuntimeDirectoryMode=0775" >> $ovs_service_path fi grep -Fxq "Group=qemu" $ovs_service_path if [ ! "$?" -eq 0 ]; then echo "Group=qemu" >> $ovs_service_path fi grep -Fxq "UMask=0002" $ovs_service_path if [ ! "$?" -eq 0 ]; then echo "UMask=0002" >> $ovs_service_path fi ovs_ctl_path='/usr/share/openvswitch/scripts/ovs-ctl' grep -q "umask 0002 \&\& start_daemon \"\$OVS_VSWITCHD_PRIORITY\"" $ovs_ctl_path if [ ! "$?" -eq 0 ]; then sed -i 's/start_daemon \"\$OVS_VSWITCHD_PRIORITY.*/umask 0002 \&\& start_daemon \"$OVS_VSWITCHD_PRIORITY\" \"$OVS_VSWITCHD_WRAPPER\" \"$@\"/' $ovs_ctl_path fi
tuned
設定を定義して CPU アフィニティーを有効にします。install_tuned: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # Install the tuned package yum install -y tuned-profiles-cpu-partitioning tuned_conf_path="/etc/tuned/cpu-partitioning-variables.conf" if [ -n "$TUNED_CORES" ]; then grep -q "^isolated_cores" $tuned_conf_path if [ "$?" -eq 0 ]; then sed -i 's/^isolated_cores=.*/isolated_cores=$TUNED_CORES/' $tuned_conf_path else echo "isolated_cores=$TUNED_CORES" >> $tuned_conf_path fi tuned-adm profile cpu-partitioning fi fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList}
カーネルの引数を設定します。
compute_kernel_args: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash set -x FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS"/g' -i /etc/default/grub ; grub2-mkconfig -o /etc/grub2.cfg sleep 5 reboot fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat}
3.1.2. network-environment.yaml
の変更
resource_registry
セクションにfirst-boot.yaml
を追加して CPU のチューニングを設定します。resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml # First boot and Kernel Args OS::TripleO::NodeUserData: first-boot.yaml
parameter_defaults
セクションにおいて、トンネル種別を無効にし (値を""
に設定)、ネットワーク種別をvlan
に設定します。NeutronTunnelTypes: '' NeutronNetworkType: 'vlan'
parameter_defaults
セクションにおいて、Open vSwitch の物理ネットワークをブリッジにマッピングします。NeutronBridgeMappings: 'tenant:br-link0'
parameter_defaults
セクションにおいて、OpenStack Networking ML2 および Open vSwitch VLAN のマッピング範囲を設定します。NeutronNetworkVLANRanges: 'tenant:22:22,tenant:25:25'
parameter_defaults
セクションにおいて、SR-IOV の設定パラメーターを定義します。SR-IOV メカニズムドライバー (
sriovnicswitch
) を有効にします。NeutronMechanismDrivers: "openvswitch,sriovnicswitch"
Compute の
pci_passthrough_whitelist
パラメーターを設定し、SR-IOV インターフェースのdevname
を設定します。ホワイトリストで、インスタンスが利用可能な PCI デバイスを設定します。NovaPCIPassthrough: - devname: "p7p1" physical_network: "tenant" - devname: "p7p2" physical_network: "tenant"
物理ネットワークおよび SR-IOV インターフェースを
PHYSICAL_NETWORK
:PHYSICAL DEVICE
の形式で指定します。サーバーの
network_vlan_ranges
に記載されるすべての物理ネットワークには、各エージェントの適切なインターフェースへのマッピングが必要です。NeutronPhysicalDevMappings: "tenant:p7p1,tenant:p7p2"
各 SR-IOV インターフェース用に確保する Virtual Function (VF) の数を指定します。
Red Hat OpenStack Platform では、NIC ベンダーがサポートする VF 数がサポートされます。その他の関連情報は、「Deployment Limits for Red Hat OpenStack Platform」を参照してください。以下の例では、各 SR-IOV インターフェースに 5 つの VF を確保しています。
NeutronSriovNumVFs: "p7p1:5,p7p2:5"
注記動作中の環境で
NeutronSriovNumVFs
パラメーターを変更すると、その PF 上の SR-IOV ポートを持つ実行中のインスタンスがすべて使用できなくなることが知られています。これらのインスタンスをハードリブートしない限り、インスタンスは SR-IOV PCI デバイスを認識しません。
parameter_defaults
セクションにおいて、ホストプロセス用の RAM を確保します。NovaReservedHostMemory: 4096
parameter_defaults
セクションにおいて、仮想マシンプロセス用に確保する物理 CPU コアのコンマ区切りリストまたは範囲を設定します。NovaVcpuPinSet: "1-19,21-39"
parameter_defaults
セクションにおいて、適用可能なフィルターの一覧を設定します。Nova スケジューラーは、ここで指定するリスト順にこれらのフィルターを適用します。ノードに対するフィルタリングのプロセスがより効率的になるように、最も制限の厳しいフィルターを最初に設定します。
NovaSchedulerDefaultFilters: - "RetryFilter" - "AvailabilityZoneFilter" - "RamFilter" - "ComputeFilter" - "ComputeCapabilitiesFilter" - "ImagePropertiesFilter" - "ServerGroupAntiAffinityFilter" - "ServerGroupAffinityFilter" - "PciPassthroughFilter" - "NUMATopologyFilter" - "AggregateInstanceExtraSpecsFilter"
parameter_defaults
セクションにおいて、初回ブート時にデフォルトのgrub
ファイルに追加するComputeKernelArgs
パラメーターを定義します。ComputeKernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=12 intel_iommu=on iommu=pt"
注記DPDK インスタンスに関連付けるフレーバーに
hw:mem_page_size=1GB
を追加する必要があります。追加しない場合、DHCP による割り当てがインスタンスに適用されません。parameter_defaults
セクションにおいて、チューニングする物理 CPU コアの一覧または範囲を設定します。指定した引数がチューニングされた
cpu-partitioning
プロファイルに追加されます。HostIsolatedCoreList: "1-19,21-39"
3.1.3. controller.yaml の変更
分離ネットワーク用の 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
この 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} - type: vlan vlan_id: {get_param: StorageMgmtNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageMgmtIpSubnet} - type: vlan vlan_id: {get_param: ExternalNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: ExternalIpSubnet} routes: - default: true next_hop: {get_param: ExternalInterfaceDefaultRoute}
neutron-dhcp-agent および neutron-metadata-agent サービスにアクセスするための OVS ブリッジを作成します。
- type: ovs_bridge name: br-link0 use_dhcp: false mtu: 9000 members: - type: ovs_bond name: bond0 use_dhcp: true members: - type: interface name: nic7 mtu: 9000 - type: interface name: nic8 mtu: 9000
3.1.4. compute.yaml
の変更
分離ネットワーク用の 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 # force the MAC address of the bridge to this interface primary: true - type: interface name: nic4
この 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}
以下の設定を
compute.yaml
ファイルに追加することで、2 つの SR-IOV インターフェースを設定します。- type: interface name: p7p1 mtu: 9000 use_dhcp: false defroute: false nm_controlled: true hotplug: true - type: interface name: p7p2 mtu: 9000 use_dhcp: false defroute: false nm_controlled: true hotplug: true
3.1.5. overcloud_deploy.sh
スクリプトの実行
VLAN 環境用の openstack overcloud deploy
コマンドの例を以下に示します。
openstack overcloud deploy \ --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-sriov.yaml \ -e /home/stack/ospd-10-vlan-sriov-two-ports-ctlplane-bonding/network-environment.yaml \ --log-file overcloud_install.log &> overcloud_install.log
-
/usr/share/openstack-tripleo-heat-templates/environments/neutron-sriov.yaml
はデフォルトのneutron-sriov.yaml
ファイルの場所です。これによりコンピュートノードの SR-IOV パラメーターを有効にします。 -
/home/stack/<relative-directory>/network-environment.yaml
はnetwork-environment.yaml
ファイルへのパスです。デフォルトのneutron-sriov.yaml
の値をnetwork-environment.yaml
ファイルでオーバーライドすることができます。
3.2. SR-IOV 用フレーバーの作成とインスタンスのデプロイ
NFV を実装する Red Hat OpenStack Platform デプロイメントの SR-IOV の設定を完了した後には、以下の手順を実施してフレーバーを作成してインスタンスをデプロイする必要があります。
SR-IOV 用にアグリゲートグループを作成し、ホストを追加します。フレーバーメタデータに一致するメタデータを定義します (例:
"aggregate_instance_extra_specs:sriov"="true"
)。# openstack aggregate create sriov_group # openstack aggregate set --property \ "aggregate_instance_extra_specs:sriov"="true" sriov_group # openstack aggregate add host sriov compute-sriov-0.localdomain
フレーバーを作成します。
# openstack flavor create <flavor> --ram <MB> --disk <GB> --vcpus <#>
追加のフレーバー属性を設定します。定義したメタデータ (
"aggregate_instance_extra_specs:sriov"="true"
) と SR-IOV アグリゲートで定義したメタデータが一致している点に注意してください。# openstack flavor set --property "aggregate_instance_extra_specs:sriov"="true" \ --property hw:cpu_policy=dedicated \ --property hw:mem_page_size=large <flavor>
ネットワークを作成します。
# openstack network create net1 --provider-physical-network tenant --provider-network-type vlan --provider-segment <VLAN-ID>
サブネットを作成します。
# openstack subnet create subnet1 --network net1 --subnet-range 192.0.2.0/24 --dhcp
ポートを作成します。
SR-IOV VF ポートを作成するには、
vnic-type
に direct を使用します。# openstack port create --network net1 --vnic-type direct sriov_port
SR-IOV PF ポートを作成するには、
vnic-type
に direct-physical を使用します。# openstack port create --network net1 --vnic-type direct-physical sriov_port
インスタンスをデプロイします。
# openstack server create --flavor <flavor> --image <glance_image> --nic port-id=sriov_port <name>
これで、NFV ユースケースで SR-IOV 用インスタンスがデプロイされました。
第4章 DPDK で高速化した Open vSwitch (OVS) のネットワーク設定
本章では、Red Hat OpenStack Platform 環境内で DPDK を Open vSwitch とともにインストールしてチューニングする方法について説明します。
OVS-DPDK を設定するのに使用されるパラメーターについて理解するには、「OVS-DPDK デプロイメントのプランニング」を参照してください。
本ガイドでは、CPU の割り当て、メモリーの確保、NIC の設定の例を紹介します。これらは、トポロジーとユースケースによって異なる場合があります。ハードウェアと設定のオプションについて理解するには、『ネットワーク機能仮想化 (NFV) の製品ガイド』および『ネットワーク機能仮想化 (NFV) のプランニングガイド』を参照してください。
etc/tuned/cpu-partitioning-variables.conf
の isolated_cores
や他の値を編集または変更しないでください。これらは、ここで説明する director の heat テンプレートにより変更されます。
以降の手順で、以下の設定を行う必要があります。
-
適切な
network-environment.yaml
ファイルを更新して、カーネル引数と DPDK 引数のパラメーターを追加する。 -
compute.yaml
ファイルを更新して、DPDK インターフェース用のブリッジを追加する。 -
controller.yaml
ファイルを更新して、DPDK インターフェースパラメーター用の同じブリッジ情報を追加する。 -
overcloud_deploy.sh
スクリプトを実行して、DPDK パラメーターを使用してオーバークラウドをデプロイする。
デプロイメントでヒュージページが使用される場合は、reserved_huge_pages を設定する必要もあります。詳しくは、「How to set reserved_huge_pages in /etc/nova/nova.conf in Red Hat OpenStack Platform」を参照してください。
手順を開始する前に、以下の項目が揃っていることを確認します。
- Red Hat Enterprise Linux 7.5 上で動作している Red Hat OpenStack Platform 10
- OVS-DPDK 2.9
- テスト済み NIC。NFV 向けのテスト済み NIC の一覧は、「テスト済み NIC」を参照してください。
OVS-DPDK デプロイメントでは、Red Hat OpenStack Platform 10 と OVS 2.9 の組み合わせは、OVS クライアントモードで稼働します。
4.1. 命名規則
OpenStack デプロイメントでカスタムロールを使用する場合、特にノードが複数あるケースでは、一貫性のある命名規則に従うことを推奨します。この命名規則は、以下のファイルおよび設定を作成する際に役立ちます。
instackenv.json
: ハードウェアまたは NIC 機能が異なるノードを区別する。"name":"computeovsdpdk-0"
roles_data.yaml
: DPDK をサポートする Compute ベースのロールを区別する。`ComputeOvsDpdk`
network-environment.yaml
: カスタムロールを正しいフレーバー名に一致させる。`OvercloudComputeOvsDpdkFlavor: computeovsdpdk`
-
nic-config
のファイル名: DPDK インターフェースをサポートするコンピュートノードの NIC 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 ハードウェアトポロジーが、同じになるようにしてください。
4.2. VLAN トンネリングを使用する 2 ポート OVS-DPDK データプレーンボンディングの設定
本項では、OpenStack 環境用に、コントロールプレーンの Linux ボンディングと共に、OVS-DPDK ボンディングの 2 つのデータプレーンポートを持つ OVS-DPDK を設定およびデプロイする手順について説明します。
4.2.1. first-boot.yaml の変更
first-boot.yaml
ファイルを変更し、OVS および DPDK パラメーターを設定し、CPU アフィニティー用に tuned
を設定します。
以前のデプロイメントで first-boot.yaml
ファイルに以下の行を追加している場合、Open vSwitch 2.9 を使用する Red Hat OpenStack Platform 10 ではこれらの行を削除してください。
ovs_service_path="/usr/lib/systemd/system/ovs-vswitchd.service" grep -q "RuntimeDirectoryMode=.*" $ovs_service_path if [ "$?" -eq 0 ]; then sed -i 's/RuntimeDirectoryMode=.*/RuntimeDirectoryMode=0775/' $ovs_service_path else echo "RuntimeDirectoryMode=0775" >> $ovs_service_path fi grep -Fxq "Group=qemu" $ovs_service_path if [ ! "$?" -eq 0 ]; then echo "Group=qemu" >> $ovs_service_path fi grep -Fxq "UMask=0002" $ovs_service_path if [ ! "$?" -eq 0 ]; then echo "UMask=0002" >> $ovs_service_path fi ovs_ctl_path='/usr/share/openvswitch/scripts/ovs-ctl' grep -q "umask 0002 \&\& start_daemon \"\$OVS_VSWITCHD_PRIORITY\"" $ovs_ctl_path if [ ! "$?" -eq 0 ]; then sed -i 's/start_daemon \"\$OVS_VSWITCHD_PRIORITY.*/umask 0002 \&\& start_daemon \"$OVS_VSWITCHD_PRIORITY\" \"$OVS_VSWITCHD_WRAPPER\" \"$@\"/' $ovs_ctl_path fi
新たなリソースを追加します。
resources: userdata: type: OS::Heat::MultipartMime properties: parts: - config: {get_resource: set_dpdk_params} - config: {get_resource: install_tuned} - config: {get_resource: compute_kernel_args}
DPDK パラメーターを設定します。
set_dpdk_params: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash set -x get_mask() { local list=$1 local mask=0 declare -a bm max_idx=0 for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) bm[$index]=0 if [ $max_idx -lt $index ]; then max_idx=$(($index)) fi done for ((i=$max_idx;i>=0;i--)); do bm[$i]=0 done for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) temp=$((1<<$(($core % 32)))) bm[$index]=$((${bm[$index]} | $temp)) done printf -v mask "%x" "${bm[$max_idx]}" for ((i=$max_idx-1;i>=0;i--)); do printf -v hex "%08x" "${bm[$i]}" mask+=$hex done printf "%s" "$mask" } FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # 42477 is the kolla hugetlbfs gid value. getent group hugetlbfs >/dev/null || \ groupadd hugetlbfs -g 42477 && groupmod -g 42477 hugetlbfs pmd_cpu_mask=$( get_mask $PMD_CORES ) host_cpu_mask=$( get_mask $LCORE_LIST ) socket_mem=$(echo $SOCKET_MEMORY | sed s/\'//g ) ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem=$socket_mem ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=$pmd_cpu_mask ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=$host_cpu_mask fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $LCORE_LIST: {get_param: HostCpusList} $PMD_CORES: {get_param: NeutronDpdkCoreList} $SOCKET_MEMORY: {get_param: NeutronDpdkSocketMemory}
tuned
設定を定義して CPU アフィニティーを提供します。install_tuned: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # Install the tuned package yum install -y tuned-profiles-cpu-partitioning tuned_conf_path="/etc/tuned/cpu-partitioning-variables.conf" if [ -n "$TUNED_CORES" ]; then grep -q "^isolated_cores" $tuned_conf_path if [ "$?" -eq 0 ]; then sed -i 's/^isolated_cores=.*/isolated_cores=$TUNED_CORES/' $tuned_conf_path else echo "isolated_cores=$TUNED_CORES" >> $tuned_conf_path fi tuned-adm profile cpu-partitioning fi fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList}
カーネルの引数を設定します。
compute_kernel_args: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS isolcpus=$TUNED_CORES"/g' -i /etc/default/grub ; grub2-mkconfig -o /etc/grub2.cfg reboot fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList}
4.2.2. network-environment.yaml の変更
resource_registry
セクションに OVS-DPDK 用のカスタムリソースを追加します。resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml OS::TripleO::NodeUserData: first-boot.yaml
parameter_defaults
セクションにおいて、トンネル種別を無効にし (値を""
に設定)、ネットワーク種別をvlan
に設定します。NeutronTunnelTypes: '' NeutronNetworkType: 'vlan'
parameter_defaults
セクションにおいて、物理ネットワークを仮想ブリッジにマッピングします。NeutronBridgeMappings: 'tenant:br-link0'
parameter_defaults
セクションにおいて、OpenStack Networking ML2 および Open vSwitch VLAN のマッピング範囲を設定します。NeutronNetworkVLANRanges: 'tenant:22:22,tenant:25:25'
上記の例では、物理ネットワーク上の VLAN 範囲を設定しています。
parameter_defaults
セクションにおいて、OVS-DPDK の設定パラメーターを定義します。注記NeutronDPDKCoreList
とNeutronDPDKMemoryChannels
は、本手順では 必須の 設定です。適切な値を設定せずに DPDK のデプロイメントを試みると、デプロイメントが失敗したり、不安定なデプロイメントになったりします。DPDK Poll Mode Driver (PMD) として使用することのできる CPU コアの一覧を、
[allowed_pattern: "'[0-9,-]+'"]
の形式で指定します。NeutronDpdkCoreList: "'2,22,3,23'"
注記ゲストインスタンス作成の失敗を避けるために、DPDK PMD 用の DPDK NIC の有無にかかわらず、各 NUMA ノード上で少なくとも 1 つの CPU を (シブリングスレッドと共に) 割り当てる必要があります。
OVS-DPDK のパフォーマンスを最適化するために、以下のオプションを検討してください。
-
DPDK インターフェースの NUMA ノードに関連付けられた CPU を選択する。インターフェースに関連付けられた NUMA ノードを一覧表示するには、
cat /sys/class/net/<interface>/device/numa_node
を使用します。その NUMA ノードに関連付けられた CPU を一覧表示するには、lscpu
を使用します。 -
CPU シブリングをまとめてグループ化する (ハイパースレッディングの場合)。CPU のシブリングを確認するには、
cat /sys/devices/system/cpu/<cpu>/topology/thread_siblings_list
を使用します。 - ホストプロセス用に CPU 0 を確保する。
- ホストプロセスが PMD に割り当てられた CPU を使用しないように、これらの CPU を分離する。
NovaVcpuPinset
を使用して、PMD に割り当てられた CPU を Compute のスケジューリングから除外する。メモリーチャネルの数を、
[allowed_pattern: "[0-9]+"]
の形式で指定します。NeutronDpdkMemoryChannels: "4"
ソケットごとに、ヒュージページプールから事前に割り当てられたメモリーを設定します。
NeutronDpdkSocketMemory: "'3072,1024'"
CPU ソケットの降順で、形式はコンマ区切り文字列です。上記の例は 2 つの NUMA ノード構成を前提とし、ソケット 0 およびソケット 1 を設定してそれぞれ 1024 MB のヒュージページを事前割り当てします。NUMA ノードが 1 つのシステムでは、この値を 1024,0 に設定します。
OVS ブリッジの DPDK ドライバーの種別を設定します。
NeutronDpdkDriverType: "vfio-pci"
parameter_defaults
セクションにおいて、OVS 用の vhost-user ソケットディレクトリーを設定します。NeutronVhostuserSocketDir: "/var/lib/vhost_sockets"
parameter_defaults
セクションにおいて、ホストプロセス用の RAM を確保します。NovaReservedHostMemory: 4096
parameter_defaults
セクションにおいて、仮想マシンプロセス用に確保する物理 CPU コアのコンマ区切りリストまたは範囲を設定します。NovaVcpuPinSet: "4-19,24-39"
parameter_defaults
セクションにおいて、適用可能なフィルターの一覧を設定します。Nova スケジューラーは、ここで指定するリスト順にこれらのフィルターを適用します。ノードに対するフィルタリングのプロセスがより効率的になるように、最も制限の厳しいフィルターを最初に設定します。
NovaSchedulerDefaultFilters: - "RetryFilter" - "AvailabilityZoneFilter" - "RamFilter" - "ComputeFilter" - "ComputeCapabilitiesFilter" - "ImagePropertiesFilter" - "ServerGroupAntiAffinityFilter" - "ServerGroupAffinityFilter" - "PciPassthroughFilter" - "NUMATopologyFilter" - "AggregateInstanceExtraSpecsFilter"
parameter_defaults
セクションにおいて、ComputeKernelArgs
パラメーターを追加して、初回ブート時にこれらのパラメーターをデフォルトのgrub
ファイルに追加します。ComputeKernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on"
注記これらのヒュージページは仮想マシンよって消費されると共に、本手順に示すように
NeutronDpdkSocketMemory
パラメーターを使用して OVS-DPDK によって消費されます。仮想マシンが利用可能なヒュージページの数は、boot
パラメーターからNeutronDpdkSocketMemory
を減算した値です。DPDK インスタンスに関連付けるフレーバーに
hw:mem_page_size=1GB
を追加する必要があります。追加しない場合、DHCP による割り当てがインスタンスに適用されません。parameter_defaults
セクションにおいて、チューニングする物理 CPU コアの一覧または範囲を設定します。指定した引数がチューニングされた
cpu-partitioning
プロファイルに追加されます。HostIsolatedCoreList: "2-19,22-39"
parameters_default
セクションにおいて、論理 OVS-DPDK コアの一覧を設定します。これらのコアは、NeutronDpdkCoreList
およびNovaVcpuPinSet
のコアの一覧と相互に排他的でなければなりません。HostCpusList: "'0,20,1,21'"
4.2.3. controller.yaml の変更
独立したプロビジョニングインターフェースを作成します。
network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp}
分離ネットワーク用のコントロールプレーンの 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
この 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} - type: vlan vlan_id: {get_param: StorageMgmtNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageMgmtIpSubnet} - type: vlan vlan_id: {get_param: ExternalNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: ExternalIpSubnet} routes: - default: true next_hop: {get_param: ExternalInterfaceDefaultRoute}
neutron-dhcp-agent および neutron-metadata-agent サービスにアクセスするための OVS ブリッジを作成します。
- type: ovs_bridge name: br-link0 use_dhcp: false mtu: 9000 members: - type: ovs_bond name: bond0 use_dhcp: true members: - type: interface name: nic7 mtu: 9000 - type: interface name: nic8 mtu: 9000
4.2.4. compute.yaml の変更
デフォルトの compute.yaml
ファイルを編集し、以下のように変更します。
独立したプロビジョニングインターフェースを作成します。
network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 use_dhcp: false addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - default: true next_hop: {get_param: ControlPlaneDefaultRoute}
分離ネットワーク用のコントロールプレーンの 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
この 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}
OVS-DPDK データプレーンボンディングの 2 つの DPDK ポートを持つ構成されるブリッジを設定し、コントローラーにリンクします。
- type: ovs_user_bridge name: br-link use_dhcp: false members: - type: ovs_dpdk_bond name: dpdkbond0 mtu: 9000 ovs_extra: - set interface dpdk0 mtu_request=$MTU - set interface dpdk1 mtu_request=$MTU - set interface dpdk0 options:n_rxq=2 - set interface dpdk1 options:n_rxq=2 members: - type: ovs_dpdk_port name: dpdk0 members: - type: interface name: nic7 - type: ovs_dpdk_port name: dpdk1 members: - type: interface name: nic8
注記複数の DPDK デバイスを含めるには、追加する DPDK デバイスごとに
type
のコードセクションを繰り返します。注記OVS-DPDK を使用する場合には、同じコンピュートノード上の 全 ブリッジが
ovs_user_bridge
の種別である必要があります。同じノード上でovs_bridge
とovs_user_bridge
が混在する構成は、director では受け入れ可能ですが、Red Hat OpenStack Platform ではサポートされていません。
4.2.5. overcloud_deploy.sh スクリプトを実行します。
bash スクリプトに記述した OVS-DPDK 環境用の openstack overcloud deploy
コマンドの例を以下に示します。
#!/bin/bash openstack overcloud deploy \ --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/ovs-dpdk-permissions.yaml \ -e /home/stack/ospd-10-vlan-dpdk-two-ports-ctlplane-dataplane-bonding/network-environment.yaml
-
/usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml
はデフォルトのneutron-ovs-dpdk.yaml
ファイルの場所です。これにより Compute ロールの OVS-DPDK パラメーターを有効にします。 -
/home/stack/<relative-directory>/network-environment.yaml
はnetwork-environment.yaml
ファイルへのパスです。このファイルを使用して、neutron-ovs-dpdk.yaml
ファイルからのデフォルト値を上書きします。
この構成の OVS-DPDK は、セキュリティーグループおよびライブマイグレーションをサポートしません。
4.3. VXLAN トンネリングを使用する単一ポート OVS-DPDK の設定
本項では、OpenStack 環境用に、コントロールプレーンの Linux ボンディングおよび VXLAN トンネリングと共に、単一ポートの OVS-DPDK を設定する手順について説明します。
4.3.1. Modify first-boot.yaml
first-boot.yaml
ファイルを変更し、OVS および DPDK パラメーターを設定し、CPU アフィニティー用に tuned
を設定します。
以前のデプロイメントで first-boot.yaml
ファイルに以下の行を追加している場合、Open vSwitch 2.9 を使用する Red Hat OpenStack Platform 10 ではこれらの行を削除してください。
ovs_service_path="/usr/lib/systemd/system/ovs-vswitchd.service" grep -q "RuntimeDirectoryMode=.*" $ovs_service_path if [ "$?" -eq 0 ]; then sed -i 's/RuntimeDirectoryMode=.*/RuntimeDirectoryMode=0775/' $ovs_service_path else echo "RuntimeDirectoryMode=0775" >> $ovs_service_path fi grep -Fxq "Group=qemu" $ovs_service_path if [ ! "$?" -eq 0 ]; then echo "Group=qemu" >> $ovs_service_path fi grep -Fxq "UMask=0002" $ovs_service_path if [ ! "$?" -eq 0 ]; then echo "UMask=0002" >> $ovs_service_path fi ovs_ctl_path='/usr/share/openvswitch/scripts/ovs-ctl' grep -q "umask 0002 \&\& start_daemon \"\$OVS_VSWITCHD_PRIORITY\"" $ovs_ctl_path if [ ! "$?" -eq 0 ]; then sed -i 's/start_daemon \"\$OVS_VSWITCHD_PRIORITY.*/umask 0002 \&\& start_daemon \"$OVS_VSWITCHD_PRIORITY\" \"$OVS_VSWITCHD_WRAPPER\" \"$@\"/' $ovs_ctl_path fi
新たなリソースを追加します。
resources: userdata: type: OS::Heat::MultipartMime properties: parts: - config: {get_resource: set_dpdk_params} - config: {get_resource: install_tuned} - config: {get_resource: compute_kernel_args}
DPDK パラメーターを設定します。
set_dpdk_params: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash set -x get_mask() { local list=$1 local mask=0 declare -a bm max_idx=0 for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) bm[$index]=0 if [ $max_idx -lt $index ]; then max_idx=$(($index)) fi done for ((i=$max_idx;i>=0;i--)); do bm[$i]=0 done for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) temp=$((1<<$(($core % 32)))) bm[$index]=$((${bm[$index]} | $temp)) done printf -v mask "%x" "${bm[$max_idx]}" for ((i=$max_idx-1;i>=0;i--)); do printf -v hex "%08x" "${bm[$i]}" mask+=$hex done printf "%s" "$mask" } FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # 42477 is the kolla hugetlbfs gid value. getent group hugetlbfs >/dev/null || \ groupadd hugetlbfs -g 42477 && groupmod -g 42477 hugetlbfs pmd_cpu_mask=$( get_mask $PMD_CORES ) host_cpu_mask=$( get_mask $LCORE_LIST ) socket_mem=$(echo $SOCKET_MEMORY | sed s/\'//g ) ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem=$socket_mem ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=$pmd_cpu_mask ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=$host_cpu_mask fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $LCORE_LIST: {get_param: HostCpusList} $PMD_CORES: {get_param: NeutronDpdkCoreList} $SOCKET_MEMORY: {get_param: NeutronDpdkSocketMemory}
tuned
設定を定義して CPU アフィニティーを提供します。install_tuned: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # Install the tuned package yum install -y tuned-profiles-cpu-partitioning tuned_conf_path="/etc/tuned/cpu-partitioning-variables.conf" if [ -n "$TUNED_CORES" ]; then grep -q "^isolated_cores" $tuned_conf_path if [ "$?" -eq 0 ]; then sed -i 's/^isolated_cores=.*/isolated_cores=$TUNED_CORES/' $tuned_conf_path else echo "isolated_cores=$TUNED_CORES" >> $tuned_conf_path fi tuned-adm profile cpu-partitioning fi fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList}
カーネルの引数を設定します。
compute_kernel_args: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS isolcpus=$TUNED_CORES"/g' -i /etc/default/grub ; grub2-mkconfig -o /etc/grub2.cfg reboot fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList}
4.3.2. network-environment.yaml の変更
resource_registry
セクションに OVS-DPDK 用のカスタムリソースを追加します。resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml OS::TripleO::NodeUserData: first-boot.yaml
parameter_defaults
セクションにおいて、トンネルの種別とテナントの種別をvxlan
に設定します。NeutronTunnelTypes: 'vxlan' NeutronNetworkType: 'vxlan'
parameter_defaults
セクションにおいて、OVS-DPDK の設定パラメーターを定義します。注記NeutronDPDKCoreList
とNeutronDPDKMemoryChannels
は、本手順では 必須の 設定です。適切な値を設定せずに DPDK のデプロイメントを試みると、デプロイメントが失敗したり、不安定なデプロイメントになったりします。DPDK Poll Mode Driver (PMD) として使用することのできる CPU コアの一覧を、
[allowed_pattern: "'[0-9,-]+'"]
の形式で指定します。NeutronDpdkCoreList: "'2,22,3,23'"
注記ゲストインスタンス作成の失敗を避けるために、DPDK PMD 用の DPDK NIC の有無にかかわらず、各 NUMA ノード上で少なくとも 1 つの CPU を (シブリングスレッドと共に) 割り当てる必要があります。
OVS-DPDK のパフォーマンスを最適化するために、以下のオプションを検討してください。
-
DPDK インターフェースの NUMA ノードに関連付けられた CPU を選択する。インターフェースに関連付けられた NUMA ノードを一覧表示するには、
cat /sys/class/net/<interface>/device/numa_node
を使用します。その NUMA ノードに関連付けられた CPU を一覧表示するには、lscpu
を使用します。 -
CPU シブリングをまとめてグループ化する (ハイパースレッディングの場合)。CPU のシブリングを確認するには、
cat /sys/devices/system/cpu/<cpu>/topology/thread_siblings_list
を使用します。 - ホストプロセス用に CPU 0 を確保する。
- ホストプロセスが PMD に割り当てられた CPU を使用しないように、これらの CPU を分離する。
NovaVcpuPinset
を使用して、PMD に割り当てられた CPU を Compute のスケジューリングから除外する。メモリーチャネルの数を、
[allowed_pattern: "[0-9]+"]
の形式で指定します。NeutronDpdkMemoryChannels: "4"
ソケットごとに、ヒュージページプールから事前に割り当てられたメモリーを設定します。
NeutronDpdkSocketMemory: "'3072,1024'"
CPU ソケットの降順で、形式はコンマ区切り文字列です。NUMA ノードが 1 つのシステムでは、この値を 3072,0 に設定します。
OVS ブリッジの DPDK ドライバーの種別を設定します。
NeutronDpdkDriverType: "vfio-pci"
parameter_defaults
セクションにおいて、OVS 用の vhost-user ソケットディレクトリーを設定します。NeutronVhostuserSocketDir: "/var/lib/vhost_sockets"
parameter_defaults
セクションにおいて、ホストプロセス用の RAM を確保します。NovaReservedHostMemory: 4096
parameter_defaults
セクションにおいて、仮想マシンプロセス用に確保する物理 CPU コアのコンマ区切りリストまたは範囲を設定します。NovaVcpuPinSet: "4-19,24-39"
parameter_defaults
セクションにおいて、適用可能なフィルターの一覧を設定します。Nova スケジューラーは、ここで指定するリスト順にこれらのフィルターを適用します。ノードに対するフィルタリングのプロセスがより効率的になるように、最も制限の厳しいフィルターを最初に設定します。
NovaSchedulerDefaultFilters: - "RetryFilter" - "AvailabilityZoneFilter" - "RamFilter" - "ComputeFilter" - "ComputeCapabilitiesFilter" - "ImagePropertiesFilter" - "ServerGroupAntiAffinityFilter" - "ServerGroupAffinityFilter" - "PciPassthroughFilter" - "NUMATopologyFilter" - "AggregateInstanceExtraSpecsFilter"
parameter_defaults
セクションにおいて、ComputeKernelArgs
パラメーターを追加して、初回ブート時にこれらのパラメーターをデフォルトのgrub
ファイルに追加します。ComputeKernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on"
注記これらのヒュージページは仮想マシンよって消費されると共に、本手順に示すように
NeutronDpdkSocketMemory
パラメーターを使用して OVS-DPDK によって消費されます。仮想マシンが利用可能なヒュージページの数は、boot
パラメーターからNeutronDpdkSocketMemory
を減算した値です。DPDK インスタンスに関連付けるフレーバーに
hw:mem_page_size=1GB
を追加する必要があります。追加しない場合、DHCP による割り当てがインスタンスに適用されません。parameter_defaults
セクションにおいて、チューニングする物理 CPU コアの一覧または範囲を設定します。指定した引数がチューニングされた
cpu-partitioning
プロファイルに追加されます。HostIsolatedCoreList: "2-19,22-39"
parameters_default
セクションにおいて、論理 OVS-DPDK コアの一覧を設定します。これらのコアは、NeutronDpdkCoreList
およびNovaVcpuPinSet
のコアの一覧と相互に排他的でなければなりません。HostCpusList: "'0,20,22-39'"
4.3.3. controller.yaml の変更
独立したプロビジョニングインターフェースを作成します。
network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp}
分離ネットワーク用のコントロールプレーンの 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
この Linux ボンディングに VLAN を割り当てます。
- type: vlan vlan_id: {get_param: InternalApiNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: InternalApiIpSubnet} - type: vlan vlan_id: {get_param: StorageNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageIpSubnet} - type: vlan vlan_id: {get_param: StorageMgmtNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageMgmtIpSubnet} - type: vlan vlan_id: {get_param: ExternalNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: ExternalIpSubnet} routes: - default: true next_hop: {get_param: ExternalInterfaceDefaultRoute}
neutron-dhcp-agent および neutron-metadata-agent サービスにアクセスするための OVS ブリッジを作成します。
- type: ovs_bridge name: br-link0 use_dhcp: false mtu: 9000 members: - type: ovs_bond name: bond0 use_dhcp: true members: - type: interface name: nic7 mtu: 9000 - type: interface name: nic8 mtu: 9000 - type: vlan vlan_id: {get_param: TenantNetworkVlanID} device: bond0 mtu: 9000 addresses: - ip_netmask: {get_param: TenantIpSubnet}
4.3.4. compute.yaml の変更
デフォルトの compute.yaml
ファイルから compute-ovs-dpdk.yaml
ファイルを作成し、次のように変更します。
独立したプロビジョニングインターフェースを作成します。
network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 use_dhcp: false addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - default: true next_hop: {get_param: ControlPlaneDefaultRoute}
分離ネットワーク用のコントロールプレーンの 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
この Linux ボンディングに VLAN を割り当てます。
- type: vlan vlan_id: {get_param: InternalApiNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: InternalApiIpSubnet} - type: vlan vlan_id: {get_param: StorageNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageIpSubnet}
コントローラーにリンクする DPDK ポートを備えたブリッジを設定します。
- type: ovs_user_bridge name: br-link0 use_dhcp: false ovs_extra: - str_replace: template: set port br-link0 tag=_VLAN_TAG_ params: _VLAN_TAG_: {get_param: TenantNetworkVlanID} addresses: - ip_netmask: {get_param: TenantIpSubnet} members: - type: ovs_dpdk_bond name: dpdkbond0 mtu: 9000 ovs_extra: - set interface dpdk0 mtu_request=$MTU - set interface dpdk1 mtu_request=$MTU - set interface dpdk0 options:n_rxq=2 - set interface dpdk1 options:n_rxq=2 members: - type: ovs_dpdk_port name: dpdk0 members: - type: interface name: nic7 - type: ovs_dpdk_port name: dpdk1 members: - type: interface name: nic8
注記複数の DPDK デバイスを含めるには、追加する DPDK デバイスごとに
type
のコードセクションを繰り返します。注記OVS-DPDK を使用する場合には、同じコンピュートノード上の 全 ブリッジが
ovs_user_bridge
の種別である必要があります。同じノード上でovs_bridge
とovs_user_bridge
が混在する構成は、director では受け入れ可能ですが、Red Hat OpenStack Platform ではサポートされていません。
4.3.5. overcloud_deploy.sh スクリプトを実行します。
bash スクリプトに記述した OVS-DPDK 環境用の openstack overcloud deploy
コマンドの例を以下に示します。
#!/bin/bash openstack overcloud deploy \ --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/ovs-dpdk-permissions.yaml \ -e /home/stack/ospd-10-vxlan-dpdk-single-port-ctlplane-bonding/network-environment.yaml
-
/usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml
はデフォルトのneutron-ovs-dpdk.yaml
ファイルの場所です。これにより Compute ロールの OVS-DPDK パラメーターを有効にします。 -
/home/stack/<relative-directory>/network-environment.yaml
はnetwork-environment.yaml
ファイルへのパスです。このファイルを使用して、neutron-ovs-dpdk.yaml
ファイルからのデフォルト値を上書きします。
この構成の OVS-DPDK は、セキュリティーグループおよびライブマイグレーションをサポートしません。
4.4. OVS-DPDK インターフェースの MTU 値の設定
Red Hat OpenStack Platform は OVS-DPDK 向けにジャンボフレームをサポートしています。ジャンボフレーム用の MTU 値を設定するには、以下の操作を行う必要があります。
-
network-environment.yaml
ファイルで、ネットワークのグローバル MTU 値を設定する。 -
compute.yaml
ファイルで、物理 DPDK ポートの MTU 値を設定する。この値は、vhost のユーザーインターフェースでも使用されます。 - コンピュートノード上の任意のゲストインスタンスで MTU 値を設定し、設定内でエンドツーエンドに同等の MTU 値が設定されるようにする。
VXLAN パケットには追加で 50 バイトがヘッダーに含まれます。MTU の必要値は、ヘッダーの追加バイト値に基づいて計算してください。たとえば、MTU 値 が 9000 の場合には、これらの追加バイト値を計算に入れると、VXLAN トンネルの MTU 値は 8950 となります。
物理 NIC は DPDK PMD によって制御され、compute.yaml
ファイルで設定されているのを同じ MTU 値が適用されるので、特別な設定は必要ありません。MTU 値には、物理 NIC でサポートされているよりも高い値を設定することはできません。
OVS-DPDK インターフェースの MTU 値を設定するには、以下の手順を実行します。
network-environment.yaml
ファイルでNeutronGlobalPhysnetMtu
パラメーターを設定します。parameter_defaults: # Global MTU configuration on Neutron NeutronGlobalPhysnetMtu: 9000
注記network-environment.yaml
ファイルの NeutronDpdkSocketMemory の値がジャンボフレームをサポートするのに十分な容量であることを確認します。詳しくは、「メモリーパラメーター」を参照してください。controller.yaml
ファイルでコンピュートノードへのブリッジ上の MTU 値を設定します。- type: ovs_bridge name: br-link0 use_dhcp: false mtu: 9000 members: - type: ovs_bond name: bond0 use_dhcp: true members: - type: interface name: nic7 mtu: 9000 - type: interface name: nic8 mtu: 9000 - type: vlan vlan_id: {get_param: TenantNetworkVlanID} device: bond0 mtu: 9000 addresses: - ip_netmask: {get_param: TenantIpSubnet}
compute.yaml
ファイルで OVS-DPDK インターフェースおよびボンディング用の MTU 値を定義するには、以下のように設定します。
- type: ovs_user_bridge name: br-link0 use_dhcp: false ovs_extra: - str_replace: template: set port br-link0 tag=VLAN_TAG params: VLAN_TAG: {get_param: TenantNetworkVlanID} addresses: - ip_netmask: {get_param: TenantIpSubnet} members: - type: ovs_dpdk_bond name: dpdkbond0 mtu: 9000 ovs_extra: - set interface dpdk0 mtu_request=$MTU - set interface dpdk1 mtu_request=$MTU - set interface dpdk0 options:n_rxq=2 - set interface dpdk1 options:n_rxq=2 members: - type: ovs_dpdk_port name: dpdk0 members: - type: interface name: nic7 - type: ovs_dpdk_port name: dpdk1 members: - type: interface name: nic8
4.5. OVS-DPDK インターフェース向けのマルチキューの設定
コンピュートノード上の OVS-DPDK ポートのキューの数を設定するには、compute.yaml
ファイルを以下のように変更します。
- type: ovs_user_bridge name: br-link0 use_dhcp: false ovs_extra: - str_replace: template: set port br-link0 tag=VLAN_TAG params: VLAN_TAG: {get_param: TenantNetworkVlanID} addresses: - ip_netmask: {get_param: TenantIpSubnet} members: - type: ovs_dpdk_bond name: dpdkbond0 mtu: 9000 ovs_extra: - set interface dpdk0 mtu_request=$MTU - set interface dpdk1 mtu_request=$MTU - set interface dpdk0 options:n_rxq=2 - set interface dpdk1 options:n_rxq=2 members: - type: ovs_dpdk_port name: dpdk0 members: - type: interface name: nic7 - type: ovs_dpdk_port name: dpdk1 members: - type: interface name: nic8
4.6. 既知の制限事項
NFV のユースケース向けに Red Hat OpenStack Platform 10 で OVS-DPDK を設定する場合には特定の制限事項があります。
- コントロールプレーンのネットワークには、Linux ボンディングを使用します。最大限のパフォーマンスを得るために、ボンディングに使用されている両方の PCI デバイスが同じ NUMA ノード上に設定されるようにしてください。Red Hat では、Neutron の Linux ブリッジ構成はサポートしていません。
- ヒュージページは OVS-DPDK を使用するホスト上で実行される全インスタンスに必要です。ゲストのヒュージページがない場合には、インターフェースは表示されても機能しません。
TAP デバイスは DPDK をサポートしないため、これらのデバイスを使用するサービスのパフォーマンスが低下します。TAP デバイスを使用するサービスの例としては、DVR、FWaaS、および LBaaS 等が挙げられます。
-
OVS-DPDK を使用する場合、
netdev datapath
により DVR を有効にすることができますが、そのパフォーマンスは低く、実稼働環境に適するものではありません。DVR は カーネル名前空間および TAP デバイスを使用してルーティングを行います。 - OVS-DPDK との組み合わせで DVR のルーティングが適切に機能するためには、OpenFlow ルールとしてルーティングを実装する ODL 等のコントローラーを使用する必要があります。OVS-DPDK を使用する場合、OpenFlow のルーティングが Linux カーネルインターフェースに起因するボトルネックを排除するので、データパスの完全なパフォーマンスが維持されます。
-
OVS-DPDK を使用する場合、
-
OVS-DPDK を使用する場合には、コンピュートノード上の 全 ブリッジの種別が
ovs_user_bridge
でなければなりません。ovs_bridge
とovs_user_bridge
が混在する構成は、director では受け入れ可能ですが、Red Hat OpenStack Platform ではサポートされていません。
4.7. OVS-DPDK 用フレーバーの作成とインスタンスのデプロイ
NFV を実装する Red Hat OpenStack Platform デプロイメントの OVS-DPDK の設定を完了した後には、以下の手順に従ってフレーバーを作成してインスタンスをデプロイすることができます。
OVS-DPDK 用にアグリゲートグループを作成し、ホストを追加します。フレーバーメタデータに一致するメタデータを定義します (例:
"aggregate_instance_extra_specs:dpdk"="true"
)。# openstack aggregate create dpdk_group # openstack aggregate set --property \ "aggregate_instance_extra_specs:dpdk"="true" dpdk_group # openstack aggregate add host dpdk compute-ovs-dpdk-0.localdomain
フレーバーを作成します。
# openstack flavor create <flavor --ram <MB> --disk <GB> --vcpus <#>
追加のフレーバー属性を設定します。定義したメタデータ (
"aggregate_instance_extra_specs:dpdk"=true"
) と DPDK アグリゲートで定義したメタデータが一致している点に注意してください。# openstack flavor set --property "aggregate_instance_extra_specs:dpdk"="true" \ --property hw:cpu_policy=dedicated \ --property hw:mem_page_size=large <flavor>
ネットワークを作成します。
# openstack network create net1 --provider-physical-network tenant --provider-network-type vlan --provider-segment <VLAN-ID>
サブネットを作成します。
# openstack subnet create subnet1 --network net1 --subnet-range 192.0.2.0/24 --dhcp
インスタンスをデプロイします。
# openstack server create --flavor <flavor> --image <glance_image> --nic net-id=net1 <name>
これで、NFV ユースケースで OVS-DPDK 用インスタンスがデプロイされました。
4.7.1. エミュレータースレッドの固定によるパフォーマンスの最適化
パフォーマンスを改善するために、Qemu エミュレータースレッドを代替のコアに固定することができます。
インスタンスの仮想 CPU として使用されているコアを把握します。
# virsh dumpxml dpdk_vm | grep cpuset <vcpupin vcpu='0' cpuset='2'/> <vcpupin vcpu='1' cpuset='18'/> <vcpupin vcpu='2' cpuset='1'/> <vcpupin vcpu='3' cpuset='17'/> <emulatorpin cpuset='1-2,17-18'/>
エミュレータースレッドを固定するコアを選択します。選択したコアが NovaVcpuPinSet の一覧に含まれることを確認します。
#virsh emulatorpin <vm-name> --cpulist 2
注記エミュレーター固定スレッドに関連付けられる物理 CPU は、
NovaVcpuPinSet
の一覧に含まれる仮想 CPU の 1 つ (ハイパースレッディングが有効な場合は 2 つのスレッド) を使用します。
4.8. 設定のトラブルシューティング
本項では、DPDK-OVS 設定のトラブルシューティングの手順を説明します。
ブリッジの設定を見直して、ブリッジが
datapath_type=netdev
で作成されたことを確認します。以下に例を示します。# ovs-vsctl list bridge br0 _uuid : bdce0825-e263-4d15-b256-f01222df96f3 auto_attach : [] controller : [] datapath_id : "00002608cebd154d" datapath_type : netdev datapath_version : "<built-in>" external_ids : {} fail_mode : [] flood_vlans : [] flow_tables : {} ipfix : [] mcast_snooping_enable: false mirrors : [] name : "br0" netflow : [] other_config : {} ports : [52725b91-de7f-41e7-bb49-3b7e50354138] protocols : [] rstp_enable : false rstp_status : {} sflow : [] status : {} stp_enable : false
neutron-ovs-agent
が自動的に起動するように設定されていることを確認して、OVS サービスを見直します。# systemctl status neutron-openvswitch-agent.service neutron-openvswitch-agent.service - OpenStack Neutron Open vSwitch Agent Loaded: loaded (/usr/lib/systemd/system/neutron-openvswitch-agent.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2015-11-23 14:49:31 AEST; 25min ago
サービスが起動しない場合には、関連する何らかのメッセージが表示されるはずです。
# journalctl -t neutron-openvswitch-agent.service
ovs-dpdk
の PMD CPU マスクが CPU にピニングされていることを確認します。HT の場合には、シブリング CPU を使用します。CPU4
の例を以下に示します。# cat /sys/devices/system/cpu/cpu4/topology/thread_siblings_list 4,20
CPU 4 と 20 を使用します。
# ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x100010
ステータスを表示します。
# tuna -t ovs-vswitchd -CP thread ctxt_switches pid SCHED_ rtpri affinity voluntary nonvoluntary cmd 3161 OTHER 0 6 765023 614 ovs-vswitchd 3219 OTHER 0 6 1 0 handler24 3220 OTHER 0 6 1 0 handler21 3221 OTHER 0 6 1 0 handler22 3222 OTHER 0 6 1 0 handler23 3223 OTHER 0 6 1 0 handler25 3224 OTHER 0 6 1 0 handler26 3225 OTHER 0 6 1 0 handler27 3226 OTHER 0 6 1 0 handler28 3227 OTHER 0 6 2 0 handler31 3228 OTHER 0 6 2 4 handler30 3229 OTHER 0 6 2 5 handler32 3230 OTHER 0 6 953538 431 revalidator29 3231 OTHER 0 6 1424258 976 revalidator33 3232 OTHER 0 6 1424693 836 revalidator34 3233 OTHER 0 6 951678 503 revalidator36 3234 OTHER 0 6 1425128 498 revalidator35 *3235 OTHER 0 4 151123 51 pmd37* *3236 OTHER 0 20 298967 48 pmd38* 3164 OTHER 0 6 47575 0 dpdk_watchdog3 3165 OTHER 0 6 237634 0 vhost_thread1 3166 OTHER 0 6 3665 0 urcu2
第5章 同一コンピュートノード上での SR-IOV および DPDK インターフェースの設定
本項では、同じコンピュートノード上に SR-IOV および DPDK インターフェースをデプロイする方法について説明します。
本ガイドでは、CPU の割り当て、メモリーの確保、NIC の設定の例を紹介します。これらは、トポロジーとユースケースによって異なる場合があります。ハードウェアと設定のオプションについて理解するには、『ネットワーク機能仮想化 (NFV) の製品ガイド』および『ネットワーク機能仮想化 (NFV) のプランニングガイド』を参照してください。
同じコンピュートノード上に SR-IOV および DPDK インターフェースを作成およびデプロイするプロセスは以下のとおりです。
-
network-environment.yaml
ファイルに SR-IOV ロールおよび OVS-DPDK ロール用のパラメーターを設定する。 -
compute.yaml
ファイルに SR-IOV インターフェースおよび DPDK インターフェースを設定する。 - 更新されたこのロールセットでオーバークラウドをデプロイする。
- これらのインターフェース種別に対応する、適切な OpenStack フレーバー、ネットワークおよびポートを作成する。
以下のネットワーク設定を推奨します。
- ゲストインスタンスに Floating IP アドレスを使用する。
- ルーターを作成し、それを DPDK VXLAN ネットワーク (管理ネットワーク) に接続する。
- プロバイダーネットワークに SR-IOV を使用する。
-
2 つのポートをアタッチしたゲストインスタンスをブートする。ゲストインスタンスに
cloud-init
を使用して、管理ネットワークのデフォルトルートを設定することを推奨します。 - ブートしたゲストインスタンスに Floating IP アドレスを追加する。
最大限のパフォーマンスを得るために、必要に応じてゲストインスタンスに SR-IOV ボンディングを使用して、両方の SR-IOV インスタンスが同じ NUMA ノード上に設定されるようにしてください。
オーバークラウドにコンピュートノードをデプロイする前に、アンダークラウドのインストールと設定が完了している必要があります。詳しくは、『director のインストールと使用方法』を参照してください。
このカスタムロールに一致する OpenStack フレーバーを作成するようにしてください。
5.1. first-boot.yaml ファイルの変更
first-boot.yaml ファイルを変更し、OVS および DPDK パラメーターを設定し、CPU アフィニティー用に tuned
を設定します。
以前のデプロイメントで first-boot.yaml
ファイルに以下の行を追加している場合、Open vSwitch 2.9 を使用する Red Hat OpenStack Platform 10 ではこれらの行を削除してください。
ovs_service_path="/usr/lib/systemd/system/ovs-vswitchd.service" grep -q "RuntimeDirectoryMode=.*" $ovs_service_path if [ "$?" -eq 0 ]; then sed -i 's/RuntimeDirectoryMode=.*/RuntimeDirectoryMode=0775/' $ovs_service_path else echo "RuntimeDirectoryMode=0775" >> $ovs_service_path fi grep -Fxq "Group=qemu" $ovs_service_path if [ ! "$?" -eq 0 ]; then echo "Group=qemu" >> $ovs_service_path fi grep -Fxq "UMask=0002" $ovs_service_path if [ ! "$?" -eq 0 ]; then echo "UMask=0002" >> $ovs_service_path fi ovs_ctl_path='/usr/share/openvswitch/scripts/ovs-ctl' grep -q "umask 0002 \&\& start_daemon \"\$OVS_VSWITCHD_PRIORITY\"" $ovs_ctl_path if [ ! "$?" -eq 0 ]; then sed -i 's/start_daemon \"\$OVS_VSWITCHD_PRIORITY.*/umask 0002 \&\& start_daemon \"$OVS_VSWITCHD_PRIORITY\" \"$OVS_VSWITCHD_WRAPPER\" \"$@\"/' $ovs_ctl_path fi
新たなリソースを追加します。
resources: userdata: type: OS::Heat::MultipartMime properties: parts: - config: {get_resource: set_dpdk_params} - config: {get_resource: install_tuned} - config: {get_resource: compute_kernel_args}
DPDK パラメーターを設定します。
set_dpdk_params: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash set -x get_mask() { local list=$1 local mask=0 declare -a bm max_idx=0 for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) bm[$index]=0 if [ $max_idx -lt $index ]; then max_idx=$(($index)) fi done for ((i=$max_idx;i>=0;i--)); do bm[$i]=0 done for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) temp=$((1<<$(($core % 32)))) bm[$index]=$((${bm[$index]} | $temp)) done printf -v mask "%x" "${bm[$max_idx]}" for ((i=$max_idx-1;i>=0;i--)); do printf -v hex "%08x" "${bm[$i]}" mask+=$hex done printf "%s" "$mask" } FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # 42477 is the kolla hugetlbfs gid value. getent group hugetlbfs >/dev/null || \ groupadd hugetlbfs -g 42477 && groupmod -g 42477 hugetlbfs pmd_cpu_mask=$( get_mask $PMD_CORES ) host_cpu_mask=$( get_mask $LCORE_LIST ) socket_mem=$(echo $SOCKET_MEMORY | sed s/\'//g ) ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem=$socket_mem ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=$pmd_cpu_mask ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=$host_cpu_mask fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $LCORE_LIST: {get_param: HostCpusList} $PMD_CORES: {get_param: NeutronDpdkCoreList} $SOCKET_MEMORY: {get_param: NeutronDpdkSocketMemory}
tuned
設定を定義して CPU アフィニティーを提供します。install_tuned: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # Install the tuned package yum install -y tuned-profiles-cpu-partitioning tuned_conf_path="/etc/tuned/cpu-partitioning-variables.conf" if [ -n "$TUNED_CORES" ]; then grep -q "^isolated_cores" $tuned_conf_path if [ "$?" -eq 0 ]; then sed -i 's/^isolated_cores=.*/isolated_cores=$TUNED_CORES/' $tuned_conf_path else echo "isolated_cores=$TUNED_CORES" >> $tuned_conf_path fi tuned-adm profile cpu-partitioning fi fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList}
カーネルの引数を設定します。
compute_kernel_args: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS isolcpus=$TUNED_CORES"/g' -i /etc/default/grub ; grub2-mkconfig -o /etc/grub2.cfg reboot fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList}
5.2. セキュリティーグループ用 openvswitch の設定 (テクノロジープレビュー)
データプレーンインターフェースのステートフルファイアウォールには、高いパフォーマンスが要求されます。これらのインターフェースを保護するためには、通信業界グレードのファイアウォール (VNF) をデプロイすることを検討してください。
コントロールプレーンインターフェースを設定するには、NeutronOVSFirewallDriver
パラメーターに openvswitch
を設定します。これにより、OpenStack Networking はフローベースの OVS ファイアウォールドライバーを使用するように設定されます。この設定は、network-environment.yaml
ファイルの parameter_defaults
セクションで行います。
以下に例を示します。
parameter_defaults: NeutronOVSFirewallDriver: openvswitch
Openvswitch はテクノロジープレビューの機能で、テスト環境でのみ使用する必要があります。サポートされる NeutronOVSFirewallDriver
パラメーターの値は noop
だけです。
OVS ファイアウォールドライバーを使用する場合には、データプレーンインターフェース用にはこのドライバーを無効にすることが重要です。そのためには、openstack port set
コマンドを使用します。
以下に例を示します。
openstack port set --no-security-group --disable-port-security ${PORT}
5.3. SR-IOV および OVS-DPDK パラメーターの定義
network-environment.yaml ファイルを変更し、SR-IOV および OVS-DPDK ロールに固有のパラメーターを設定します。
これらのノードのネットワーク設定と共に、OVS-DPDK および SR-IOV サービスのリソースマッピングを
network-environment.yaml
ファイルに追加します。resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml OS::TripleO::NodeUserData: first-boot.yaml
フレーバーを定義します。
OvercloudControlFlavor: controller OvercloudComputeFlavor: compute
トンネルの種別を定義します。
# The tunnel type for the tenant network (vxlan or gre). Set to '' to disable tunneling. NeutronTunnelTypes: 'vxlan' # The tenant network type for Neutron (vlan or vxlan). NeutronNetworkType: 'vlan'
SR-IOV のパラメーターを設定します。
lspci -nv
を実行すると、NeutronSupportedPCIVendorDevs
パラメーターに PCI ベンダーおよびデバイスの値が表示されます。注記以下の例に示すように、OpenvSwitch ファイアウォールドライバーはテクノロジープレビューの機能で、コントロールプレーンインターフェースにのみ使用する必要があります。サポートされる
NeutronOVSFirewallDriver
パラメーターの値はnoop
だけです。詳しくは、「セキュリティーグループ用 openvswitch の設定」を参照してください。NeutronSupportedPCIVendorDevs: ['8086:154d', '8086:10ed'] NovaPCIPassthrough: - devname: "p5p2" physical_network: "tenant" NeutronPhysicalDevMappings: "tenant:p5p2" NeutronSriovNumVFs: "p5p2:5" # Global MTU. NeutronGlobalPhysnetMtu: 9000 # Configure the classname of the firewall driver to use for implementing security groups. NeutronOVSFirewallDriver: openvswitch
OVS-DPDK のパラメーターを設定します。
######################## # OVS DPDK configuration ## NeutronDpdkCoreList and NeutronDpdkMemoryChannels are REQUIRED settings. ## Attempting to deploy DPDK without appropriate values will cause deployment to fail or lead to unstable deployments. # List of cores to be used for DPDK Poll Mode Driver NeutronDpdkCoreList: "'2,22,3,23'" # Number of memory channels to be used for DPDK NeutronDpdkMemoryChannels: "4" # NeutronDpdkSocketMemory NeutronDpdkSocketMemory: "'3072,1024'" # NeutronDpdkDriverType NeutronDpdkDriverType: "vfio-pci" # The vhost-user socket directory for OVS NeutronVhostuserSocketDir: "/var/lib/vhost_sockets" ######################## # Additional settings ######################## # Reserved RAM for host processes NovaReservedHostMemory: 4096 # A list or range of physical CPU cores to reserve for virtual machine processes. # Example: NovaVcpuPinSet: ['4-12','^8'] will reserve cores from 4-12 excluding 8 NovaVcpuPinSet: "4-19,24-39" # An array of filters used by Nova to filter a node.These filters will be applied in the order they are listed, # so place your most restrictive filters first to make the filtering process more efficient. NovaSchedulerDefaultFilters: - "RetryFilter" - "AvailabilityZoneFilter" - "RamFilter" - "ComputeFilter" - "ComputeCapabilitiesFilter" - "ImagePropertiesFilter" - "ServerGroupAntiAffinityFilter" - "ServerGroupAffinityFilter" - "PciPassthroughFilter" - "NUMATopologyFilter" - "AggregateInstanceExtraSpecsFilter" # Kernel arguments for Compute node ComputeKernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on" # A list or range of physical CPU cores to be tuned. # The given args will be appended to the tuned cpu-partitioning profile. HostIsolatedCoreList: "2-19,22-39" # List of logical cores to be used by ovs-dpdk processess (dpdk-lcore-mask) HostCpusList: "'2-19,22-39'"
注記ゲストインスタンス作成の失敗を避けるために、DPDK PMD 用の DPDK NIC の有無にかかわらず、各 NUMA ノード上で少なくとも 1 つの CPU を (シブリングスレッドと共に) 割り当てる必要があります。
-
実際の OpenStack デプロイメントでの必要に応じて、
network-environment.yaml
ファイルの残りのパラメーターを設定して、neutron-ovs-dpdk-agent.yaml
およびneutron-sriov-agent.yaml
ファイルからのデフォルトパラメーターをオーバーライドします。
OVS-DPDK 向けの OpenStack ネットワークを最適化するには、『ネットワーク機能仮想化 (NFV) のプランニングガイド』を参照し、network-environment.yaml
ファイルで設定する OVS-DPDK パラメーターの最適値を決定する方法を確認してください。
5.4. SR-IOV および DPDK インターフェース用のコンピュートノードの設定
以下の例では、SR-IOV および DPDK インターフェースに対応する compute.yaml ファイルのサンプルを使用しています。
分離ネットワーク用のコントロールプレーンの 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
この Linux ボンディングに VLAN を割り当てます。
- type: vlan vlan_id: {get_param: InternalApiNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: InternalApiIpSubnet} - type: vlan vlan_id: {get_param: StorageNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageIpSubnet}
DPDK ポートを持つブリッジを設定し、コントローラーにリンクします。
type: ovs_user_bridge name: br-link0 ovs_extra: - str_replace: template: set port br-link0 tag=_VLAN_TAG_ params: _VLAN_TAG_: {get_param: TenantNetworkVlanID} addresses: - ip_netmask: {get_param: TenantIpSubnet} use_dhcp: false members: - type: ovs_dpdk_port name: dpdk0 mtu: 9000 ovs_extra: - set interface $DEVICE mtu_request=$MTU - set interface $DEVICE optoins:n_rxq=2 members: - type: interface name: nic7 primary: true
注記複数の DPDK デバイスを含めるには、追加する DPDK デバイスごとに
type
のコードセクションを繰り返します。注記OVS-DPDK を使用する場合には、同じコンピュートノード上の 全 ブリッジが
ovs_user_bridge
の種別である必要があります。同じノード上でovs_bridge
とovs_user_bridge
が混在する構成は、director では受け入れ可能ですが、Red Hat OpenStack Platform ではサポートされていません。コントローラーに SR-IOV インターフェースを作成します。
- type: interface name: p7p2 mtu: 9000 use_dhcp: false defroute: false nm_controlled: true hotplug: true
5.5. オーバークラウドのデプロイ
OVS-DPDK と SR-IOV の両方をデプロイする overcloud_deploy.sh bash スクリプトの例を以下に示します。
#!/bin/bash openstack overcloud deploy \ --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-sriov.yaml \ -e /home/stack/ospd-10-vxlan-vlan-dpdk-sriov-ctlplane-bonding/network-environment.yaml
5.6. フレーバーの作成ならびに SR-IOV および DPDK インターフェースに対応したインスタンスのデプロイ
デプロイが正常に完了したオーバークラウドで、インスタンスのデプロイを開始することができます。source コマンドで /home/stack
ディレクトリーに新たに作成した overcloudrc
ファイルを読み込むことから始めます。続いて、フレーバーを作成してインスタンスをデプロイします。
フレーバーを作成します。
# source overcloudrc # openstack flavor create --vcpus 6 --ram 4096 --disk 40 compute
それぞれのオプション引数についての説明は以下のとおりです。
-
compute
: フレーバー名 -
4096
: メモリーの容量 (MB 単位) -
40
: GB 単位のディスク容量 (デフォルトは 0) -
6
: 仮想 CPU の数
-
ラージページのフレーバーを設定します。
# openstack flavor set compute --property hw:mem_page_size=1GB
外部ネットワークを作成します。
# openstack network create --share --external \ --provider-physical-network <net-mgmt-physnet> \ --provider-network-type <flat|vlan> external
SR-IOV および DPDK 用のネットワークを作成します。
# openstack network create net-dpdk # openstack network create net-sriov # openstack subnet create --subnet-range <cidr/prefix> --network net-dpdk net-dpdk-subnet # openstack subnet create --subnet-range <cidr/prefix> --network net-sriov net-sriov-subnet
SR-IOV ポートを作成します。
SR-IOV VF ポートを作成するには、
vnic-type
に direct を使用します。# openstack port create --network net-sriov --vnic-type direct sriov_port
SR-IOV PF ポートを作成するには、
vnic-type
に direct-physical を使用します。# openstack port create --network net-sriov --vnic-type direct-physical sriov_port
ルーターを作成し、DPDK VXLAN ネットワークに接続します。
# openstack router create router1 # openstack router add subnet router1 net-dpdk-subnet
Floating IP アドレスを作成し、それをゲストインスタンスのポートに関連付けます。
# openstack floating ip create --floating-ip-address FLOATING-IP external
インスタンスをデプロイします。
# openstack server create --flavor compute --image rhel_7.3 --nic port-id=sriov_port --nic net-id=NET_DPDK_ID vm1
それぞれのオプション引数についての説明は以下のとおりです。
- compute: フレーバーの名前または ID
-
rhel_7.3
: インスタンスの作成に使用されるイメージ (名前または ID) -
sriov_port
: 前のステップで作成したポートの名前 - NET_DPDK_ID: DPDK のネットワーク ID
-
vm1
: インスタンス名
これで、同じコンピュートノード上の SR-IOV インターフェース および DPDK インターフェースを使用するインスタンスがデプロイされました。
より多くのインターフェースを使用するインスタンスの場合は、cloud-init
を使用することができます。詳しくは、「インスタンスの作成」の表 3.1 を参照してください。
第6章 詳細情報
以下の表には、参考となるその他の Red Hat ドキュメントの一覧を記載しています。
Red Hat OpenStack Platform のドキュメントスイートは、Red Hat OpenStack Platform 10 の製品ドキュメント を参照してください。
表6.1 利用可能なドキュメント一覧
コンポーネント | 参考情報 |
---|---|
Red Hat Enterprise Linux | Red Hat OpenStack Platform は Red Hat Enterprise Linux 7.3 でサポートされています。Red Hat Enterprise Linux のインストールについては、Red Hat Enterprise Linux のドキュメントスイート で該当するインストールガイドを参照してください。 |
Red Hat OpenStack Platform | OpenStack のコンポーネントとそれらの依存関係をインストールするには、Red Hat OpenStack Platform director を使用します。director は、基本的な OpenStack 環境をアンダークラウドとして使用して、最終的なオーバークラウド内の OpenStack ノードをインストール、設定、管理します。アンダークラウドのインストールには、デプロイしたオーバークラウドに必要な環境に加えて、アンダークラウドのインストールには、追加のホストマシンが必要となる点に注意してください。詳しい手順は、『Red Hat OpenStack Platform director のインストールと使用方法』を参照してください。 ネットワークの分離、ストレージ設定、SSL 通信など、Red Hat OpenStack Platform director を使用して Red Hat OpenStack Platform エンタープライズ環境に高度な機能を設定する方法、および一般的な設定方法については、『オーバークラウドの高度なカスタマイズ』を参照してください。 Red Hat OpenStack Platform コンポーネントを手動でインストールすることもできます。『手動インストール手順』を参照してください。 |
NFV のドキュメント | NFV の概念に関する俯瞰的な情報は、『ネットワーク機能仮想化 (NFV) の製品ガイド』を参照してください。 NFV 対応の Red Hat OpenStack Platform デプロイメントのプランニングに関する詳しい情報は、『ネットワーク機能仮想化 (NFV) のプランニングガイド』を参照してください。 |
付録A SR-IOV YAML ファイルのサンプル
本項では、ネットワーク機能仮想化インフラストラクチャー (NFVi) 向けに、参考として Single Root I/O Virtualization (SR-IOV) の設定ファイルの例を示します。
以下のテンプレートは完全に設定された環境から取得したもので、NFV とは関係の無いパラメーターが含まれています。したがって、これらのパラメーターは、ご自分のデプロイメントには該当しない/適切ではない場合があります。
A.1. VLAN SR-IOV YAML ファイルのサンプル
A.1.1. network-environment.yaml
resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml # First boot and Kernel Args OS::TripleO::NodeUserData: first-boot.yaml parameter_defaults: # Customize all these values to match the local environment InternalApiNetCidr: 10.10.10.0/24 TenantNetCidr: 10.10.2.0/24 StorageNetCidr: 10.10.3.0/24 StorageMgmtNetCidr: 10.10.4.0/24 ExternalNetCidr: 172.20.12.112/28 # CIDR subnet mask length for provisioning network ControlPlaneSubnetCidr: '24' InternalApiAllocationPools: [{'start': '10.10.10.10', 'end': '10.10.10.200'}] TenantAllocationPools: [{'start': '10.10.2.100', 'end': '10.10.2.200'}] StorageAllocationPools: [{'start': '10.10.3.100', 'end': '10.10.3.200'}] StorageMgmtAllocationPools: [{'start': '10.10.4.100', 'end': '10.10.4.200'}] # Use an External allocation pool which will leave room for floating IPs ExternalAllocationPools: [{'start': '172.20.12.114', 'end': '172.20.12.125'}] # Set to the router gateway on the external network ExternalInterfaceDefaultRoute: 172.20.12.126 # Gateway router for the provisioning network (or Undercloud IP) ControlPlaneDefaultRoute: 192.168.24.1 # Generally the IP of the Undercloud EC2MetadataIp: 192.168.24.1 InternalApiNetworkVlanID: 10 TenantNetworkVlanID: 11 StorageNetworkVlanID: 12 StorageMgmtNetworkVlanID: 13 ExternalNetworkVlanID: 14 # Define the DNS servers (maximum 2) for the overcloud nodes DnsServers: ["8.8.8.8","8.8.4.4"] # May set to br-ex if using floating IPs only on native VLAN on bridge br-ex NeutronExternalNetworkBridge: "''" # The tunnel type for the tenant network (vxlan or gre). Set to '' to disable tunneling. NeutronTunnelTypes: '' # The tenant network type for Neutron (vlan or vxlan). NeutronNetworkType: 'vlan' # The OVS logical->physical bridge mappings to use. NeutronBridgeMappings: 'tenant:br-link0' # The Neutron ML2 and OpenVSwitch vlan mapping range to support. NeutronNetworkVLANRanges: 'tenant:22:22,tenant:25:25' # Nova flavor to use. OvercloudControlFlavor: controller OvercloudComputeFlavor: compute #Number of nodes to deploy. ControllerCount: 1 ComputeCount: 1 # Sets overcloud nodes custom names # http://docs.openstack.org/developer/tripleo-docs/advanced_deployment/node_placement.html#custom-hostnames ControllerHostnameFormat: 'controller-%index%' ComputeHostnameFormat: 'compute-%index%' CephStorageHostnameFormat: 'ceph-%index%' ObjectStorageHostnameFormat: 'swift-%index%' ####################### # SRIOV configuration # ####################### # The mechanism drivers for the Neutron tenant network. NeutronMechanismDrivers: "openvswitch,sriovnicswitch" # List of PCI Passthrough whitelist parameters. # Use ONE of the following examples. # Example 1: # NovaPCIPassthrough: # - vendor_id: "8086" # product_id: "154c" # address: "0000:05:00.0" - (optional) # physical_network: "datacentre" # # Example 2: # NovaPCIPassthrough: # - devname: "p6p1" # physical_network: "tenant" NovaPCIPassthrough: - devname: "p7p1" physical_network: "tenant" - devname: "p7p2" physical_network: "tenant" # List of supported pci vendor devices in the format VendorID:ProductID. # Not merged into RHOSP10 refer BZ 1448919 NeutronSupportedPCIVendorDevs: ['8086:154c', '8086:154d', '8086:10ed'] # List of <physical_network>:<physical device> # All physical networks listed in network_vlan_ranges on the server # should have mappings to appropriate interfaces on each agent. NeutronPhysicalDevMappings: "tenant:p7p1,tenant:p7p2" # Provide the list of VFs to be reserved for each SR-IOV interface. # Format "<interface_name1>:<numvfs1>","<interface_name2>:<numvfs2>" # Example "eth1:4096","eth2:128" NeutronSriovNumVFs: "p7p1:5,p7p2:5" ######################## # Additional settings ######################## # Reserved RAM for host processes NovaReservedHostMemory: 4096 # A list or range of physical CPU cores to reserve for virtual machine processes. # Example: NovaVcpuPinSet: ['4-12','^8'] will reserve cores from 4-12 excluding 8 NovaVcpuPinSet: "1-19,21-39" # List of scheduler available filters NovaSchedulerAvailableFilters: ["nova.scheduler.filters.all_filters","nova.scheduler.filters.pci_passthrough_filter.PciPassthroughFilter"] # An array of filters used by Nova to filter a node.These filters will be applied in the order they are listed, # so place your most restrictive filters first to make the filtering process more efficient. NovaSchedulerDefaultFilters: ['AvailabilityZoneFilter','RamFilter','ComputeFilter','ComputeCapabilitiesFilter','ImagePropertiesFilter','ServerGroupAntiAffinityFilter','ServerGroupAffinityFilter','PciPassthroughFilter'] # Kernel arguments for Compute node ComputeKernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=12 intel_iommu=on iommu=pt" # A list or range of physical CPU cores to be tuned. # The given args will be appended to the tuned cpu-partitioning profile. HostIsolatedCoreList: "1-19,21-39" # Set backend for overcloud GlanceBackend: 'file' # Global MTU NeutronGlobalPhysnetMtu: 9000 SshServerOptions: UseDns: 'no'
A.1.2. first-boot.yaml
heat_template_version: 2014-10-16 description: > This is an example showing how you can do firstboot configuration of the nodes via cloud-init. To enable this, replace the default mapping of OS::TripleO::NodeUserData in ../overcloud_resource_registry* parameters: ComputeKernelArgs: description: > Space seprated list of Kernel args to be update to grub. The given args will be appended to existing args of GRUB_CMDLINE_LINUX in file /etc/default/grub Example: "intel_iommu=on default_hugepagesz=1GB hugepagesz=1G hugepages=1" type: string default: "" ComputeHostnameFormat: type: string default: "" HostIsolatedCoreList: description: > A list or range of physical CPU cores to be tuned as isolated_cores. The given args will be appended to the tuned cpu-partitioning profile. Ex. HostIsolatedCoreList: '4-12' will tune cores from 4-12 type: string default: "" resources: userdata: type: OS::Heat::MultipartMime properties: parts: - config: {get_resource: install_tuned} - config: {get_resource: compute_kernel_args} install_tuned: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # Install the tuned package yum install -y tuned-profiles-cpu-partitioning tuned_conf_path="/etc/tuned/cpu-partitioning-variables.conf" if [ -n "$TUNED_CORES" ]; then grep -q "^isolated_cores" $tuned_conf_path if [ "$?" -eq 0 ]; then sed -i 's/^isolated_cores=.*/isolated_cores=$TUNED_CORES/' $tuned_conf_path else echo "isolated_cores=$TUNED_CORES" >> $tuned_conf_path fi tuned-adm profile cpu-partitioning fi fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList} # Verify the logs on /var/log/cloud-init.log on the overcloud node compute_kernel_args: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash set -x FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS"/g' -i /etc/default/grub ; grub2-mkconfig -o /etc/grub2.cfg sleep 5 reboot fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} outputs: # This means get_resource from the parent template will get the userdata, see: # http://docs.openstack.org/developer/heat/template_guide/composition.html#making-your-template-resource-more-transparent # Note this is new-for-kilo, an alternative is returning a value then using # get_attr in the parent template instead. OS::stack_id: value: {get_resource: userdata}
A.1.3. controller.yaml
heat_template_version: 2015-04-30 description: > Software Config to drive os-net-config to configure VLANs for the controller role. parameters: ControlPlaneIp: default: '' description: IP address/subnet on the ctlplane network type: string ExternalIpSubnet: default: '' description: IP address/subnet on the external network type: string InternalApiIpSubnet: default: '' description: IP address/subnet on the internal API network type: string StorageIpSubnet: default: '' description: IP address/subnet on the storage network type: string StorageMgmtIpSubnet: default: '' description: IP address/subnet on the storage mgmt network type: string StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number StorageMgmtNetworkVlanID: default: 40 description: Vlan ID for the storage mgmt network traffic. type: number TenantIpSubnet: default: '' description: IP address/subnet on the tenant network type: string ManagementIpSubnet: # Only populated when including environments/network-management.yaml default: '' description: IP address/subnet on the management network type: string ExternalNetworkVlanID: default: '' description: Vlan ID for the external network traffic. type: number InternalApiNetworkVlanID: default: '' description: Vlan ID for the internal_api network traffic. type: number TenantNetworkVlanID: default: '' description: Vlan ID for the tenant network traffic. type: number ManagementNetworkVlanID: default: 23 description: Vlan ID for the management network traffic. type: number ExternalInterfaceDefaultRoute: default: '' description: default route for the external network type: string ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. type: comma_delimited_list EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string resources: OsNetConfigImpl: type: OS::Heat::StructuredConfig properties: group: os-apply-config config: os_net_config: network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - 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 - 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} - type: vlan vlan_id: {get_param: StorageMgmtNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageMgmtIpSubnet} - type: vlan vlan_id: {get_param: ExternalNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: ExternalIpSubnet} routes: - default: true next_hop: {get_param: ExternalInterfaceDefaultRoute} - type: ovs_bridge name: br-link0 use_dhcp: false mtu: 9000 members: - type: ovs_bond name: bond0 use_dhcp: true members: - type: interface name: nic7 mtu: 9000 - type: interface name: nic8 mtu: 9000 outputs: OS::stack_id: description: The OsNetConfigImpl resource. value: {get_resource: OsNetConfigImpl}
A.1.4. compute.yaml
heat_template_version: 2015-04-30 description: > Software Config to drive os-net-config to configure VLANs for the compute role. parameters: ControlPlaneIp: default: '' description: IP address/subnet on the ctlplane network type: string ExternalIpSubnet: default: '' description: IP address/subnet on the external network type: string InternalApiIpSubnet: default: '' description: IP address/subnet on the internal API network type: string TenantIpSubnet: default: '' description: IP address/subnet on the tenant network type: string ManagementIpSubnet: # Only populated when including environments/network-management.yaml default: '' description: IP address/subnet on the management network type: string InternalApiNetworkVlanID: default: '' description: Vlan ID for the internal_api network traffic. type: number StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number StorageMgmtNetworkVlanID: default: 40 description: Vlan ID for the storage mgmt network traffic. type: number TenantNetworkVlanID: default: '' description: Vlan ID for the tenant network traffic. type: number ManagementNetworkVlanID: default: 23 description: Vlan ID for the management network traffic. type: number StorageIpSubnet: default: '' description: IP address/subnet on the storage network type: string StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number StorageMgmtIpSubnet: default: '' description: IP address/subnet on the storage mgmt network type: string ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. type: comma_delimited_list EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string ExternalInterfaceDefaultRoute: default: '' description: default route for the externalheat stack-list network type: string resources: OsNetConfigImpl: type: OS::Heat::StructuredConfig properties: group: os-apply-config config: os_net_config: network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - default: true next_hop: {get_param: ControlPlaneDefaultRoute} - type: linux_bond name: bond_api bonding_options: "mode=active-backup" use_dhcp: false dns_servers: {get_param: DnsServers} members: - type: interface name: nic3 # force the MAC address of the bridge to this interface primary: true - type: interface name: nic4 - 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} - type: interface name: p7p1 mtu: 9000 use_dhcp: false defroute: false nm_controlled: true hotplug: true - type: interface name: p7p2 mtu: 9000 use_dhcp: false defroute: false nm_controlled: true hotplug: true outputs: OS::stack_id: description: The OsNetConfigImpl resource. value: {get_resource: OsNetConfigImpl}
A.1.5. overcloud_deploy.sh
#!/bin/bash openstack overcloud deploy \ --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-sriov.yaml \ -e /home/stack/ospd-10-vlan-sriov-two-ports-ctlplane-bonding/network-environment.yaml \ --log-file overcloud_install.log &> overcloud_install.log
付録B OVS-DPDK YAML ファイルのサンプル
本項では、ネットワーク機能仮想化インフラストラクチャー (NFVi) 向けに、参考として Data Plane Development Kit 対応 Open vSwitch (OVS-DPDK) の設定ファイルの例を説明します。
以下のテンプレートは完全に設定された環境から取得したもので、NFV とは関係の無いパラメーターが含まれています。したがって、これらのパラメーターは、ご自分のデプロイメントには該当しない/適切ではない場合があります。
B.1. VLAN OVS-DPDK データプレーンボンディング YAML ファイルのサンプル
B.1.1. first-boot.yaml
heat_template_version: 2014-10-16 description: > This is an example showing how you can do firstboot configuration of the nodes via cloud-init. To enable this, replace the default mapping of OS::TripleO::NodeUserData in ../overcloud_resource_registry* parameters: ComputeKernelArgs: description: > Space seprated list of Kernel args to be update to grub. The given args will be appended to existing args of GRUB_CMDLINE_LINUX in file /etc/default/grub Example: "intel_iommu=on default_hugepagesz=1GB hugepagesz=1G hugepages=1" type: string default: "" ComputeHostnameFormat: type: string default: "" NeutronDpdkCoreList: description: > List of logical cores for PMD threads. Its mandatory parameter. type: string NeutronDpdkSocketMemory: description: Memory allocated for each socket default: "" type: string constraints: - allowed_pattern: "'[0-9,]+'" NeutronVhostuserSocketDir: description: The vhost-user socket directory for OVS. default: "" type: string HostIsolatedCoreList: description: > A list or range of physical CPU cores to be tuned as isolated_cores. The given args will be appended to the tuned cpu-partitioning profile. Ex. HostIsolatedCoreList: '4-12' will tune cores from 4-12 type: string default: "" HostCpusList: description: > List of logical cores to be used by ovs-dpdk processess (dpdk-lcore-mask) type: string constraints: - allowed_pattern: "'[0-9,]+'" resources: userdata: type: OS::Heat::MultipartMime properties: parts: - config: {get_resource: set_dpdk_params} - config: {get_resource: install_tuned} - config: {get_resource: compute_kernel_args} # Verify the logs on /var/log/cloud-init.log on the overcloud node set_dpdk_params: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash set -x get_mask() { local list=$1 local mask=0 declare -a bm max_idx=0 for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) bm[$index]=0 if [ $max_idx -lt $index ]; then max_idx=$(($index)) fi done for ((i=$max_idx;i>=0;i--)); do bm[$i]=0 done for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) temp=$((1<<$(($core % 32)))) bm[$index]=$((${bm[$index]} | $temp)) done printf -v mask "%x" "${bm[$max_idx]}" for ((i=$max_idx-1;i>=0;i--)); do printf -v hex "%08x" "${bm[$i]}" mask+=$hex done printf "%s" "$mask" } FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # 42477 is the kolla hugetlbfs gid value. getent group hugetlbfs >/dev/null || \ groupadd hugetlbfs -g 42477 && groupmod -g 42477 hugetlbfs pmd_cpu_mask=$( get_mask $PMD_CORES ) host_cpu_mask=$( get_mask $LCORE_LIST ) socket_mem=$(echo $SOCKET_MEMORY | sed s/\'//g ) ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem=$socket_mem ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=$pmd_cpu_mask ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=$host_cpu_mask fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $LCORE_LIST: {get_param: HostCpusList} $PMD_CORES: {get_param: NeutronDpdkCoreList} $SOCKET_MEMORY: {get_param: NeutronDpdkSocketMemory} install_tuned: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # Install the tuned package yum install -y tuned-profiles-cpu-partitioning tuned_conf_path="/etc/tuned/cpu-partitioning-variables.conf" if [ -n "$TUNED_CORES" ]; then grep -q "^isolated_cores" $tuned_conf_path if [ "$?" -eq 0 ]; then sed -i 's/^isolated_cores=.*/isolated_cores=$TUNED_CORES/' $tuned_conf_path else echo "isolated_cores=$TUNED_CORES" >> $tuned_conf_path fi tuned-adm profile cpu-partitioning fi fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList} compute_kernel_args: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS isolcpus=$TUNED_CORES"/g' -i /etc/default/grub ; grub2-mkconfig -o /etc/grub2.cfg reboot fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList} outputs: # This means get_resource from the parent template will get the userdata, see: # http://docs.openstack.org/developer/heat/template_guide/composition.html#making-your-template-resource-more-transparent # Note this is new-for-kilo, an alternative is returning a value then using # get_attr in the parent template instead. OS::stack_id: value: {get_resource: userdata}
B.1.2. network-environment.yaml
resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml OS::TripleO::NodeUserData: first-boot.yaml parameter_defaults: # Customize all these values to match the local environment InternalApiNetCidr: 10.10.10.0/24 TenantNetCidr: 10.10.2.0/24 StorageNetCidr: 10.10.3.0/24 StorageMgmtNetCidr: 10.10.4.0/24 ExternalNetCidr: 172.20.12.112/28 # CIDR subnet mask length for provisioning network ControlPlaneSubnetCidr: '24' InternalApiAllocationPools: [{'start': '10.10.10.10', 'end': '10.10.10.200'}] TenantAllocationPools: [{'start': '10.10.2.100', 'end': '10.10.2.200'}] StorageAllocationPools: [{'start': '10.10.3.100', 'end': '10.10.3.200'}] StorageMgmtAllocationPools: [{'start': '10.10.4.100', 'end': '10.10.4.200'}] # Use an External allocation pool which will leave room for floating IPs ExternalAllocationPools: [{'start': '172.20.12.114', 'end': '172.20.12.125'}] # Set to the router gateway on the external network ExternalInterfaceDefaultRoute: 172.20.12.126 # Gateway router for the provisioning network (or Undercloud IP) ControlPlaneDefaultRoute: 192.168.24.1 # Generally the IP of the Undercloud EC2MetadataIp: 192.168.24.1 InternalApiNetworkVlanID: 10 TenantNetworkVlanID: 11 StorageNetworkVlanID: 12 StorageMgmtNetworkVlanID: 13 ExternalNetworkVlanID: 14 # Define the DNS servers (maximum 2) for the overcloud nodes DnsServers: ["8.8.8.8","8.8.4.4"] # May set to br-ex if using floating IPs only on native VLAN on bridge br-ex NeutronExternalNetworkBridge: "''" # The tunnel type for the tenant network (vxlan or gre). Set to '' to disable tunneling. NeutronTunnelTypes: '' # The tenant network type for Neutron (vlan or vxlan). NeutronNetworkType: 'vlan' # The OVS logical->physical bridge mappings to use. NeutronBridgeMappings: 'tenant:br-link0' # The Neutron ML2 and OpenVSwitch vlan mapping range to support. NeutronNetworkVLANRanges: 'tenant:22:22,tenant:25:25' # Nova flavor to use. OvercloudControlFlavor: controller OvercloudComputeFlavor: compute #Number of nodes to deploy. ControllerCount: 1 ComputeCount: 1 # NTP server configuration. NtpServer: clock.redhat.com # Sets overcloud nodes custom names # http://docs.openstack.org/developer/tripleo-docs/advanced_deployment/node_placement.html#custom-hostnames ControllerHostnameFormat: 'controller-%index%' ComputeHostnameFormat: 'compute-%index%' CephStorageHostnameFormat: 'ceph-%index%' ObjectStorageHostnameFormat: 'swift-%index%' ######################## # OVS DPDK configuration ## NeutronDpdkCoreList and NeutronDpdkMemoryChannels are REQUIRED settings. ## Attempting to deploy DPDK without appropriate values will cause deployment to fail or lead to unstable deployments. # List of cores to be used for DPDK Poll Mode Driver NeutronDpdkCoreList: "'2,22,3,23'" # Number of memory channels to be used for DPDK NeutronDpdkMemoryChannels: "4" # NeutronDpdkSocketMemory NeutronDpdkSocketMemory: "'3072,1024'" # NeutronDpdkDriverType NeutronDpdkDriverType: "vfio-pci" # The vhost-user socket directory for OVS NeutronVhostuserSocketDir: "/var/lib/vhost_sockets" ######################## # Additional settings ######################## # Reserved RAM for host processes NovaReservedHostMemory: 4096 # A list or range of physical CPU cores to reserve for virtual machine processes. NovaVcpuPinSet: "4-19,24-39" # An array of filters used by Nova to filter a node.These filters will be applied in the order they are listed, # so place your most restrictive filters first to make the filtering process more efficient. NovaSchedulerDefaultFilters: - "RetryFilter" - "AvailabilityZoneFilter" - "RamFilter" - "ComputeFilter" - "ComputeCapabilitiesFilter" - "ImagePropertiesFilter" - "ServerGroupAntiAffinityFilter" - "ServerGroupAffinityFilter" - "PciPassthroughFilter" - "NUMATopologyFilter" - "AggregateInstanceExtraSpecsFilter" # Kernel arguments for Compute node ComputeKernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on" # A list or range of physical CPU cores to be tuned. # The given args will be appended to the tuned cpu-partitioning profile. HostIsolatedCoreList: "2-19,22-39" # List of logical cores to be used by ovs-dpdk processess (dpdk-lcore-mask) HostCpusList: "'0,20,1,21'" NovaLibvirtRxQueueSize: 1024 NovaLibvirtTxQueueSize: 1024 # MTU global configuration NeutronGlobalPhysnetMtu: 9000 # Set the storage backend of the overcloud GlanceBackend: 'file' # Configure the classname of the firewall driver to use for implementing security groups. NeutronOVSFirewallDriver: openvswitch SshServerOptions: UseDns: 'no'
B.1.3. controller.yaml
heat_template_version: 2015-04-30 description: > Software Config to drive os-net-config to configure VLANs for the controller role. parameters: ControlPlaneIp: default: '' description: IP address/subnet on the ctlplane network type: string ExternalIpSubnet: default: '' description: IP address/subnet on the external network type: string InternalApiIpSubnet: default: '' description: IP address/subnet on the internal API network type: string StorageIpSubnet: default: '' description: IP address/subnet on the storage network type: string StorageMgmtIpSubnet: default: '' description: IP address/subnet on the storage mgmt network type: string StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number StorageMgmtNetworkVlanID: default: 40 description: Vlan ID for the storage mgmt network traffic. type: number TenantIpSubnet: default: '' description: IP address/subnet on the tenant network type: string ManagementIpSubnet: # Only populated when including environments/network-management.yaml default: '' description: IP address/subnet on the management network type: string ExternalNetworkVlanID: default: '' description: Vlan ID for the external network traffic. type: number InternalApiNetworkVlanID: default: '' description: Vlan ID for the internal_api network traffic. type: number TenantNetworkVlanID: default: '' description: Vlan ID for the tenant network traffic. type: number ManagementNetworkVlanID: default: 23 description: Vlan ID for the management network traffic. type: number ExternalInterfaceDefaultRoute: default: '' description: default route for the external network type: string ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. type: comma_delimited_list EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string resources: OsNetConfigImpl: type: OS::Heat::StructuredConfig properties: group: os-apply-config config: os_net_config: network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - 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 - 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} - type: vlan vlan_id: {get_param: StorageMgmtNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageMgmtIpSubnet} - type: vlan vlan_id: {get_param: ExternalNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: ExternalIpSubnet} routes: - default: true next_hop: {get_param: ExternalInterfaceDefaultRoute} - type: ovs_bridge name: br-link0 use_dhcp: false mtu: 9000 members: - type: ovs_bond name: bond0 use_dhcp: true members: - type: interface name: nic7 mtu: 9000 - type: interface name: nic8 mtu: 9000 outputs: OS::stack_id: description: The OsNetConfigImpl resource. value: {get_resource: OsNetConfigImpl}
B.1.4. compute-ovs-dpdk.yaml
heat_template_version: 2015-04-30 description: > Software Config to drive os-net-config to configure VLANs for the compute role. parameters: ControlPlaneIp: default: '' description: IP address/subnet on the ctlplane network type: string ExternalIpSubnet: default: '' description: IP address/subnet on the external network type: string InternalApiIpSubnet: default: '' description: IP address/subnet on the internal API network type: string TenantIpSubnet: default: '' description: IP address/subnet on the tenant network type: string ManagementIpSubnet: # Only populated when including environments/network-management.yaml default: '' description: IP address/subnet on the management network type: string InternalApiNetworkVlanID: default: '' description: Vlan ID for the internal_api network traffic. type: number TenantNetworkVlanID: default: '' description: Vlan ID for the tenant network traffic. type: number ManagementNetworkVlanID: default: 23 description: Vlan ID for the management network traffic. type: number StorageIpSubnet: default: '' description: IP address/subnet on the storage network type: string StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number StorageMgmtIpSubnet: default: '' description: IP address/subnet on the storage mgmt network type: string ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. type: comma_delimited_list EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string ExternalInterfaceDefaultRoute: default: '' description: default route for the external network type: string resources: OsNetConfigImpl: type: OS::Heat::StructuredConfig properties: group: os-apply-config config: os_net_config: network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 use_dhcp: false addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - default: true next_hop: {get_param: ControlPlaneDefaultRoute} - 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 - 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} - type: ovs_user_bridge name: br-link0 use_dhcp: false members: - type: ovs_dpdk_bond name: dpdkbond0 mtu: 9000 ovs_extra: - set interface dpdk0 mtu_request=$MTU - set interface dpdk1 mtu_request=$MTU - set interface dpdk0 options:n_rxq=2 - set interface dpdk1 options:n_rxq=2 members: - type: ovs_dpdk_port name: dpdk0 members: - type: interface name: nic7 - type: ovs_dpdk_port name: dpdk1 members: - type: interface name: nic8 outputs: OS::stack_id: description: The OsNetConfigImpl resource. value: {get_resource: OsNetConfigImpl}
B.1.5. overcloud_deploy.sh
#!/bin/bash openstack overcloud deploy \ --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/ovs-dpdk-permissions.yaml \ -e /home/stack/ospd-10-vlan-dpdk-two-ports-ctlplane-dataplane-bonding/network-environment.yaml \ --log-file overcloud_install.log &> overcloud_install.log
B.2. VXLAN OVS-DPDK データプレーンボンディング YAML ファイルのサンプル
B.2.1. first-boot.yaml
heat_template_version: 2014-10-16 description: > This is an example showing how you can do firstboot configuration of the nodes via cloud-init. To enable this, replace the default mapping of OS::TripleO::NodeUserData in ../overcloud_resource_registry* parameters: ComputeKernelArgs: description: > Space seprated list of Kernel args to be update to grub. The given args will be appended to existing args of GRUB_CMDLINE_LINUX in file /etc/default/grub Example: "intel_iommu=on default_hugepagesz=1GB hugepagesz=1G hugepages=1" type: string default: "" ComputeHostnameFormat: type: string default: "" NeutronDpdkCoreList: description: > List of logical cores for PMD threads. Its mandatory parameter. type: string NeutronDpdkSocketMemory: description: Memory allocated for each socket default: "" type: string constraints: - allowed_pattern: "'[0-9,]+'" NeutronVhostuserSocketDir: description: The vhost-user socket directory for OVS. default: "" type: string HostIsolatedCoreList: description: > A list or range of physical CPU cores to be tuned as isolated_cores. The given args will be appended to the tuned cpu-partitioning profile. Ex. HostIsolatedCoreList: '4-12' will tune cores from 4-12 type: string default: "" HostCpusList: description: > List of logical cores to be used by ovs-dpdk processess (dpdk-lcore-mask) type: string constraints: - allowed_pattern: "'[0-9,]+'" resources: userdata: type: OS::Heat::MultipartMime properties: parts: - config: {get_resource: set_dpdk_params} - config: {get_resource: install_tuned} - config: {get_resource: compute_kernel_args} # Verify the logs on /var/log/cloud-init.log on the overcloud node set_dpdk_params: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash set -x get_mask() { local list=$1 local mask=0 declare -a bm max_idx=0 for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) bm[$index]=0 if [ $max_idx -lt $index ]; then max_idx=$(($index)) fi done for ((i=$max_idx;i>=0;i--)); do bm[$i]=0 done for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) temp=$((1<<$(($core % 32)))) bm[$index]=$((${bm[$index]} | $temp)) done printf -v mask "%x" "${bm[$max_idx]}" for ((i=$max_idx-1;i>=0;i--)); do printf -v hex "%08x" "${bm[$i]}" mask+=$hex done printf "%s" "$mask" } FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # 42477 is the kolla hugetlbfs gid value. getent group hugetlbfs >/dev/null || \ groupadd hugetlbfs -g 42477 && groupmod -g 42477 hugetlbfs pmd_cpu_mask=$( get_mask $PMD_CORES ) host_cpu_mask=$( get_mask $LCORE_LIST ) socket_mem=$(echo $SOCKET_MEMORY | sed s/\'//g ) ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem=$socket_mem ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=$pmd_cpu_mask ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=$host_cpu_mask fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $LCORE_LIST: {get_param: HostCpusList} $PMD_CORES: {get_param: NeutronDpdkCoreList} $SOCKET_MEMORY: {get_param: NeutronDpdkSocketMemory} install_tuned: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # Install the tuned package yum install -y tuned-profiles-cpu-partitioning tuned_conf_path="/etc/tuned/cpu-partitioning-variables.conf" if [ -n "$TUNED_CORES" ]; then grep -q "^isolated_cores" $tuned_conf_path if [ "$?" -eq 0 ]; then sed -i 's/^isolated_cores=.*/isolated_cores=$TUNED_CORES/' $tuned_conf_path else echo "isolated_cores=$TUNED_CORES" >> $tuned_conf_path fi tuned-adm profile cpu-partitioning fi fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList} compute_kernel_args: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS isolcpus=$TUNED_CORES"/g' -i /etc/default/grub ; grub2-mkconfig -o /etc/grub2.cfg reboot fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList} outputs: # This means get_resource from the parent template will get the userdata, see: # http://docs.openstack.org/developer/heat/template_guide/composition.html#making-your-template-resource-more-transparent # Note this is new-for-kilo, an alternative is returning a value then using # get_attr in the parent template instead. OS::stack_id: value: {get_resource: userdata}
B.2.2. network-environment.yaml
resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml OS::TripleO::NodeUserData: first-boot.yaml parameter_defaults: # Customize all these values to match the local environment InternalApiNetCidr: 10.10.10.0/24 TenantNetCidr: 10.10.2.0/24 StorageNetCidr: 10.10.3.0/24 StorageMgmtNetCidr: 10.10.4.0/24 ExternalNetCidr: 172.20.12.112/28 # CIDR subnet mask length for provisioning network ControlPlaneSubnetCidr: '24' InternalApiAllocationPools: [{'start': '10.10.10.10', 'end': '10.10.10.200'}] TenantAllocationPools: [{'start': '10.10.2.100', 'end': '10.10.2.200'}] StorageAllocationPools: [{'start': '10.10.3.100', 'end': '10.10.3.200'}] StorageMgmtAllocationPools: [{'start': '10.10.4.100', 'end': '10.10.4.200'}] # Use an External allocation pool which will leave room for floating IPs ExternalAllocationPools: [{'start': '172.20.12.114', 'end': '172.20.12.125'}] # Set to the router gateway on the external network ExternalInterfaceDefaultRoute: 172.20.12.126 # Gateway router for the provisioning network (or Undercloud IP) ControlPlaneDefaultRoute: 192.168.24.1 # Generally the IP of the Undercloud EC2MetadataIp: 192.168.24.1 InternalApiNetworkVlanID: 10 TenantNetworkVlanID: 11 StorageNetworkVlanID: 12 StorageMgmtNetworkVlanID: 13 ExternalNetworkVlanID: 14 # Define the DNS servers (maximum 2) for the overcloud nodes DnsServers: ["8.8.8.8","8.8.4.4"] # May set to br-ex if using floating IPs only on native VLAN on bridge br-ex NeutronExternalNetworkBridge: "''" # The tunnel type for the tenant network (vxlan or gre). Set to '' to disable tunneling. NeutronTunnelTypes: 'vxlan' # The tenant network type for Neutron (vlan or vxlan). NeutronNetworkType: 'vxlan' # The OVS logical->physical bridge mappings to use. NeutronBridgeMappings: 'tenant:br-link0' # The Neutron ML2 and OpenVSwitch vlan mapping range to support. NeutronNetworkVLANRanges: 'tenant:22:22' # Nova flavor to use. OvercloudControlFlavor: controller OvercloudComputeFlavor: compute #Number of nodes to deploy. ControllerCount: 1 ComputeCount: 1 # NTP server configuration. NtpServer: clock.redhat.com # Sets overcloud nodes custom names # http://docs.openstack.org/developer/tripleo-docs/advanced_deployment/node_placement.html#custom-hostnames ControllerHostnameFormat: 'controller-%index%' ComputeHostnameFormat: 'compute-%index%' CephStorageHostnameFormat: 'ceph-%index%' ObjectStorageHostnameFormat: 'swift-%index%' ######################## # OVS DPDK configuration ## NeutronDpdkCoreList and NeutronDpdkMemoryChannels are REQUIRED settings. ## Attempting to deploy DPDK without appropriate values will cause deployment to fail or lead to unstable deployments. # List of cores to be used for DPDK Poll Mode Driver NeutronDpdkCoreList: "'2,22,3,23'" # Number of memory channels to be used for DPDK NeutronDpdkMemoryChannels: "4" # NeutronDpdkSocketMemory NeutronDpdkSocketMemory: "'3072,1024'" # NeutronDpdkDriverType NeutronDpdkDriverType: "vfio-pci" # The vhost-user socket directory for OVS NeutronVhostuserSocketDir: "/var/lib/vhost_sockets" ######################## # Additional settings ######################## # Reserved RAM for host processes NovaReservedHostMemory: 4096 # A list or range of physical CPU cores to reserve for virtual machine processes. NovaVcpuPinSet: "4-19,24-39" # An array of filters used by Nova to filter a node.These filters will be applied in the order they are listed, # so place your most restrictive filters first to make the filtering process more efficient. NovaSchedulerDefaultFilters: - "RetryFilter" - "AvailabilityZoneFilter" - "RamFilter" - "ComputeFilter" - "ComputeCapabilitiesFilter" - "ImagePropertiesFilter" - "ServerGroupAntiAffinityFilter" - "ServerGroupAffinityFilter" - "PciPassthroughFilter" - "NUMATopologyFilter" - "AggregateInstanceExtraSpecsFilter" # Kernel arguments for Compute node ComputeKernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on" # A list or range of physical CPU cores to be tuned. # The given args will be appended to the tuned cpu-partitioning profile. HostIsolatedCoreList: "2-19,22-39" # List of logical cores to be used by ovs-dpdk processess (dpdk-lcore-mask) HostCpusList: "'0,20,1,21'" NovaLibvirtRxQueueSize: 1024 NovaLibvirtTxQueueSize: 1024 # MTU global configuration NeutronGlobalPhysnetMtu: 9000 # Set the storage backend of the overcloud GlanceBackend: 'file' # Configure the classname of the firewall driver to use for implementing security groups. NeutronOVSFirewallDriver: openvswitch SshServerOptions: UseDns: 'no'
B.2.3. controller.yaml
heat_template_version: 2015-04-30 description: > Software Config to drive os-net-config to configure VLANs for the controller role. parameters: ControlPlaneIp: default: '' description: IP address/subnet on the ctlplane network type: string ExternalIpSubnet: default: '' description: IP address/subnet on the external network type: string InternalApiIpSubnet: default: '' description: IP address/subnet on the internal API network type: string StorageIpSubnet: default: '' description: IP address/subnet on the storage network type: string StorageMgmtIpSubnet: default: '' description: IP address/subnet on the storage mgmt network type: string StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number StorageMgmtNetworkVlanID: default: 40 description: Vlan ID for the storage mgmt network traffic. type: number TenantIpSubnet: default: '' description: IP address/subnet on the tenant network type: string ManagementIpSubnet: # Only populated when including environments/network-management.yaml default: '' description: IP address/subnet on the management network type: string ExternalNetworkVlanID: default: '' description: Vlan ID for the external network traffic. type: number InternalApiNetworkVlanID: default: '' description: Vlan ID for the internal_api network traffic. type: number TenantNetworkVlanID: default: '' description: Vlan ID for the tenant network traffic. type: number ManagementNetworkVlanID: default: 23 description: Vlan ID for the management network traffic. type: number ExternalInterfaceDefaultRoute: default: '' description: default route for the external network type: string ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. type: comma_delimited_list EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string resources: OsNetConfigImpl: type: OS::Heat::StructuredConfig properties: group: os-apply-config config: os_net_config: network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - 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 - type: vlan vlan_id: {get_param: InternalApiNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: InternalApiIpSubnet} - type: vlan vlan_id: {get_param: StorageNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageIpSubnet} - type: vlan vlan_id: {get_param: StorageMgmtNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageMgmtIpSubnet} - type: vlan vlan_id: {get_param: ExternalNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: ExternalIpSubnet} routes: - default: true next_hop: {get_param: ExternalInterfaceDefaultRoute} - type: ovs_bridge name: br-link0 use_dhcp: false mtu: 9000 members: - type: ovs_bond name: bond0 use_dhcp: true members: - type: interface name: nic7 mtu: 9000 - type: interface name: nic8 mtu: 9000 - type: vlan vlan_id: {get_param: TenantNetworkVlanID} device: bond0 mtu: 9000 addresses: - ip_netmask: {get_param: TenantIpSubnet} outputs: OS::stack_id: description: The OsNetConfigImpl resource. value: {get_resource: OsNetConfigImpl}
B.2.4. compute-ovs-dpdk.yaml
heat_template_version: 2015-04-30 description: > Software Config to drive os-net-config to configure VLANs for the compute role. parameters: ControlPlaneIp: default: '' description: IP address/subnet on the ctlplane network type: string ExternalIpSubnet: default: '' description: IP address/subnet on the external network type: string InternalApiIpSubnet: default: '' description: IP address/subnet on the internal API network type: string TenantIpSubnet: default: '' description: IP address/subnet on the tenant network type: string ManagementIpSubnet: # Only populated when including environments/network-management.yaml default: '' description: IP address/subnet on the management network type: string StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number InternalApiNetworkVlanID: default: '' description: Vlan ID for the internal_api network traffic. type: number TenantNetworkVlanID: default: '' description: Vlan ID for the tenant network traffic. type: number ManagementNetworkVlanID: default: 23 description: Vlan ID for the management network traffic. type: number StorageIpSubnet: default: '' description: IP address/subnet on the storage network type: string StorageMgmtIpSubnet: default: '' description: IP address/subnet on the storage mgmt network type: string ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. type: comma_delimited_list EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string ExternalInterfaceDefaultRoute: default: '' description: default route for the external network type: string resources: OsNetConfigImpl: type: OS::Heat::StructuredConfig properties: group: os-apply-config config: os_net_config: network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 use_dhcp: false addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - default: true next_hop: {get_param: ControlPlaneDefaultRoute} - 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 - type: vlan vlan_id: {get_param: InternalApiNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: InternalApiIpSubnet} - type: vlan vlan_id: {get_param: StorageNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageIpSubnet} - type: ovs_user_bridge name: br-link0 use_dhcp: false ovs_extra: - str_replace: template: set port br-link0 tag=_VLAN_TAG_ params: _VLAN_TAG_: {get_param: TenantNetworkVlanID} addresses: - ip_netmask: {get_param: TenantIpSubnet} members: - type: ovs_dpdk_bond name: dpdkbond0 mtu: 9000 ovs_extra: - set interface dpdk0 mtu_request=$MTU - set interface dpdk1 mtu_request=$MTU - set interface dpdk0 options:n_rxq=2 - set interface dpdk1 options:n_rxq=2 members: - type: ovs_dpdk_port name: dpdk0 members: - type: interface name: nic7 - type: ovs_dpdk_port name: dpdk1 members: - type: interface name: nic8 outputs: OS::stack_id: description: The OsNetConfigImpl resource. value: {get_resource: OsNetConfigImpl}
B.2.5. overcloud_deploy.sh
#!/bin/bash openstack overcloud deploy \ --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/ovs-dpdk-permissions.yaml \ -e /home/stack/ospd-10-vxlan-dpdk-single-port-ctlplane-bonding/network-environment.yaml \ --log-file overcloud_install.log &> overcloud_install.log
付録C 同一コンピュートノード上の異なるインターフェース用 YAML ファイル
本項では、同じコンピュートノードに SR-IOV および DPDK インターフェースを追加する際の参考として、YAML ファイルの例を示します。
以下のテンプレートは完全に設定された環境から取得したもので、NFV とは関係の無いパラメーターが含まれています。したがって、これらのパラメーターは、ご自分のデプロイメントには該当しない/適切ではない場合があります。
C.1. 同一コンピュートノード上の SR-IOV および DPDK YAML ファイルのサンプル
本項では、参考として DPDK および SR-IOV YAML ファイルの例を示します。
C.1.1. first-boot.yaml
heat_template_version: 2014-10-16 description: > This is an example showing how you can do firstboot configuration of the nodes via cloud-init. To enable this, replace the default mapping of OS::TripleO::NodeUserData in ../overcloud_resource_registry* parameters: ComputeKernelArgs: description: > Space seprated list of Kernel args to be update to grub. The given args will be appended to existing args of GRUB_CMDLINE_LINUX in file /etc/default/grub Example: "intel_iommu=on default_hugepagesz=1GB hugepagesz=1G hugepages=1" type: string default: "" ComputeHostnameFormat: type: string default: "" NeutronDpdkCoreList: description: > List of logical cores for PMD threads. Its mandatory parameter. type: string NeutronDpdkSocketMemory: description: Memory allocated for each socket default: "" type: string constraints: - allowed_pattern: "'[0-9,]+'" NeutronVhostuserSocketDir: description: The vhost-user socket directory for OVS. default: "" type: string HostIsolatedCoreList: description: > A list or range of physical CPU cores to be tuned as isolated_cores. The given args will be appended to the tuned cpu-partitioning profile. Ex. HostIsolatedCoreList: '4-12' will tune cores from 4-12 type: string default: "" HostCpusList: description: > List of logical cores to be used by ovs-dpdk processess (dpdk-lcore-mask) type: string constraints: - allowed_pattern: "'[0-9,]+'" resources: userdata: type: OS::Heat::MultipartMime properties: parts: - config: {get_resource: set_dpdk_params} - config: {get_resource: install_tuned} - config: {get_resource: compute_kernel_args} # Verify the logs on /var/log/cloud-init.log on the overcloud node set_dpdk_params: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash set -x get_mask() { local list=$1 local mask=0 declare -a bm max_idx=0 for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) bm[$index]=0 if [ $max_idx -lt $index ]; then max_idx=$(($index)) fi done for ((i=$max_idx;i>=0;i--)); do bm[$i]=0 done for core in $(echo $list | sed 's/,/ /g') do index=$(($core/32)) temp=$((1<<$(($core % 32)))) bm[$index]=$((${bm[$index]} | $temp)) done printf -v mask "%x" "${bm[$max_idx]}" for ((i=$max_idx-1;i>=0;i--)); do printf -v hex "%08x" "${bm[$i]}" mask+=$hex done printf "%s" "$mask" } FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # 42477 is the kolla hugetlbfs gid value. getent group hugetlbfs >/dev/null || \ groupadd hugetlbfs -g 42477 && groupmod -g 42477 hugetlbfs pmd_cpu_mask=$( get_mask $PMD_CORES ) host_cpu_mask=$( get_mask $LCORE_LIST ) socket_mem=$(echo $SOCKET_MEMORY | sed s/\'//g ) ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem=$socket_mem ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=$pmd_cpu_mask ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=$host_cpu_mask fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $LCORE_LIST: {get_param: HostCpusList} $PMD_CORES: {get_param: NeutronDpdkCoreList} $SOCKET_MEMORY: {get_param: NeutronDpdkSocketMemory} install_tuned: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then # Install the tuned package yum install -y tuned-profiles-cpu-partitioning tuned_conf_path="/etc/tuned/cpu-partitioning-variables.conf" if [ -n "$TUNED_CORES" ]; then grep -q "^isolated_cores" $tuned_conf_path if [ "$?" -eq 0 ]; then sed -i 's/^isolated_cores=.*/isolated_cores=$TUNED_CORES/' $tuned_conf_path else echo "isolated_cores=$TUNED_CORES" >> $tuned_conf_path fi tuned-adm profile cpu-partitioning fi fi params: $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList} compute_kernel_args: type: OS::Heat::SoftwareConfig properties: config: str_replace: template: | #!/bin/bash FORMAT=$COMPUTE_HOSTNAME_FORMAT if [[ -z $FORMAT ]] ; then FORMAT="compute" ; else # Assumption: only %index% and %stackname% are the variables in Host name format FORMAT=$(echo $FORMAT | sed 's/\%index\%//g' | sed 's/\%stackname\%//g') ; fi if [[ $(hostname) == *$FORMAT* ]] ; then sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS isolcpus=$TUNED_CORES"/g' -i /etc/default/grub ; grub2-mkconfig -o /etc/grub2.cfg reboot fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} $TUNED_CORES: {get_param: HostIsolatedCoreList} outputs: # This means get_resource from the parent template will get the userdata, see: # http://docs.openstack.org/developer/heat/template_guide/composition.html#making-your-template-resource-more-transparent # Note this is new-for-kilo, an alternative is returning a value then using # get_attr in the parent template instead. OS::stack_id: value: {get_resource: userdata}
C.1.2. network-environment.yaml
resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml OS::TripleO::NodeUserData: first-boot.yaml parameter_defaults: # Customize all these values to match the local environment InternalApiNetCidr: 10.10.10.0/24 TenantNetCidr: 10.10.2.0/24 StorageNetCidr: 10.10.3.0/24 StorageMgmtNetCidr: 10.10.4.0/24 ExternalNetCidr: 172.20.12.112/28 # CIDR subnet mask length for provisioning network ControlPlaneSubnetCidr: '24' InternalApiAllocationPools: [{'start': '10.10.10.10', 'end': '10.10.10.200'}] TenantAllocationPools: [{'start': '10.10.2.100', 'end': '10.10.2.200'}] StorageAllocationPools: [{'start': '10.10.3.100', 'end': '10.10.3.200'}] StorageMgmtAllocationPools: [{'start': '10.10.4.100', 'end': '10.10.4.200'}] # Use an External allocation pool which will leave room for floating IPs ExternalAllocationPools: [{'start': '172.20.12.114', 'end': '172.20.12.125'}] # Set to the router gateway on the external network ExternalInterfaceDefaultRoute: 172.20.12.126 # Gateway router for the provisioning network (or Undercloud IP) ControlPlaneDefaultRoute: 192.168.24.1 # Generally the IP of the Undercloud EC2MetadataIp: 192.168.24.1 InternalApiNetworkVlanID: 10 TenantNetworkVlanID: 11 StorageNetworkVlanID: 12 StorageMgmtNetworkVlanID: 13 ExternalNetworkVlanID: 14 # Define the DNS servers (maximum 2) for the overcloud nodes DnsServers: ["8.8.8.8","8.8.4.4"] # May set to br-ex if using floating IPs only on native VLAN on bridge br-ex NeutronExternalNetworkBridge: "''" # The tunnel type for the tenant network (vxlan or gre). Set to '' to disable tunneling. NeutronTunnelTypes: 'vxlan' # The tenant network type for Neutron (vlan or vxlan). NeutronNetworkType: 'vlan' # The OVS logical->physical bridge mappings to use. NeutronBridgeMappings: 'dpdk_mgmt:br-link0,tenant:br-link1' # The Neutron ML2 and OpenVSwitch vlan mapping range to support. NeutronNetworkVLANRanges: 'tenant:22:22,tenant:25:25' # Nova flavor to use. OvercloudControlFlavor: controller OvercloudComputeFlavor: compute #Number of nodes to deploy. ControllerCount: 1 ComputeCount: 1 # NTP server configuration. NtpServer: clock.redhat.com # Sets overcloud nodes custom names # http://docs.openstack.org/developer/tripleo-docs/advanced_deployment/node_placement.html#custom-hostnames ControllerHostnameFormat: 'controller-%index%' ComputeHostnameFormat: 'compute-%index%' CephStorageHostnameFormat: 'ceph-%index%' ObjectStorageHostnameFormat: 'swift-%index%' ######################## # OVS DPDK configuration ## NeutronDpdkCoreList and NeutronDpdkMemoryChannels are REQUIRED settings. ## Attempting to deploy DPDK without appropriate values will cause deployment to fail or lead to unstable deployments. # List of cores to be used for DPDK Poll Mode Driver NeutronDpdkCoreList: "'2,22,3,23'" # Number of memory channels to be used for DPDK NeutronDpdkMemoryChannels: "4" # NeutronDpdkSocketMemory NeutronDpdkSocketMemory: "'3072,1024'" # NeutronDpdkDriverType NeutronDpdkDriverType: "vfio-pci" # The vhost-user socket directory for OVS NeutronVhostuserSocketDir: "/var/lib/vhost_sockets" ######################## # Additional settings ######################## # Reserved RAM for host processes NovaReservedHostMemory: 4096 # A list or range of physical CPU cores to reserve for virtual machine processes. NovaVcpuPinSet: "4-19,24-39" # An array of filters used by Nova to filter a node.These filters will be applied in the order they are listed, # so place your most restrictive filters first to make the filtering process more efficient. NovaSchedulerDefaultFilters: - "RetryFilter" - "AvailabilityZoneFilter" - "RamFilter" - "ComputeFilter" - "ComputeCapabilitiesFilter" - "ImagePropertiesFilter" - "ServerGroupAntiAffinityFilter" - "ServerGroupAffinityFilter" - "PciPassthroughFilter" - "NUMATopologyFilter" - "AggregateInstanceExtraSpecsFilter" # Kernel arguments for Compute node ComputeKernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on" # A list or range of physical CPU cores to be tuned. # The given args will be appended to the tuned cpu-partitioning profile. HostIsolatedCoreList: "2-19,22-39" # List of logical cores to be used by ovs-dpdk processess (dpdk-lcore-mask) HostCpusList: "'0,20,1,21'" NovaLibvirtRxQueueSize: 1024 NovaLibvirtTxQueueSize: 1024 # List of supported pci vendor devices in the format VendorID:ProductID. # Not merged into RHOSP10 refer BZ 1448919 NeutronSupportedPCIVendorDevs: ['8086:154c', '8086:154d', '8086:10ed'] NovaPCIPassthrough: - devname: "p5p2" physical_network: "tenant" NeutronPhysicalDevMappings: "tenant:p5p2" NeutronSriovNumVFs: "p5p2:5" # Global MTU. NeutronGlobalPhysnetMtu: 9000 # Configure the classname of the firewall driver to use for implementing security groups. NeutronOVSFirewallDriver: openvswitch SshServerOptions: UseDns: 'no'
C.1.3. controller.yaml
heat_template_version: 2015-04-30 description: > Software Config to drive os-net-config to configure VLANs for the controller role. parameters: ControlPlaneIp: default: '' description: IP address/subnet on the ctlplane network type: string ExternalIpSubnet: default: '' description: IP address/subnet on the external network type: string InternalApiIpSubnet: default: '' description: IP address/subnet on the internal API network type: string StorageIpSubnet: default: '' description: IP address/subnet on the storage network type: string StorageMgmtIpSubnet: default: '' description: IP address/subnet on the storage mgmt network type: string StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number StorageMgmtNetworkVlanID: default: 40 description: Vlan ID for the storage mgmt network traffic. type: number TenantIpSubnet: default: '' description: IP address/subnet on the tenant network type: string ManagementIpSubnet: # Only populated when including environments/network-management.yaml default: '' description: IP address/subnet on the management network type: string ExternalNetworkVlanID: default: '' description: Vlan ID for the external network traffic. type: number InternalApiNetworkVlanID: default: '' description: Vlan ID for the internal_api network traffic. type: number StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number StorageMgmtNetworkVlanID: default: 40 description: Vlan ID for the storage mgmt network traffic. type: number TenantNetworkVlanID: default: '' description: Vlan ID for the tenant network traffic. type: number ManagementNetworkVlanID: default: 23 description: Vlan ID for the management network traffic. type: number ExternalInterfaceDefaultRoute: default: '' description: default route for the external network type: string ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. type: comma_delimited_list EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string resources: OsNetConfigImpl: type: OS::Heat::StructuredConfig properties: group: os-apply-config config: os_net_config: network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - 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 - 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} - type: vlan vlan_id: {get_param: StorageMgmtNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageMgmtIpSubnet} - type: vlan vlan_id: {get_param: ExternalNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: ExternalIpSubnet} routes: - default: true next_hop: {get_param: ExternalInterfaceDefaultRoute} - type: ovs_bridge name: br-link0 use_dhcp: false members: - type: interface name: nic7 mtu: 9000 - type: vlan vlan_id: {get_param: TenantNetworkVlanID} mtu: 9000 addresses: - ip_netmask: {get_param: TenantIpSubnet} - type: ovs_bridge name: br-link1 use_dhcp: false members: - type: interface name: nic8 mtu: 9000 outputs: OS::stack_id: description: The OsNetConfigImpl resource. value: {get_resource: OsNetConfigImpl}
C.1.4. compute.yaml
heat_template_version: 2015-04-30 description: > Software Config to drive os-net-config to configure VLANs for the compute role. parameters: ControlPlaneIp: default: '' description: IP address/subnet on the ctlplane network type: string ExternalIpSubnet: default: '' description: IP address/subnet on the external network type: string InternalApiIpSubnet: default: '' description: IP address/subnet on the internal API network type: string TenantIpSubnet: default: '' description: IP address/subnet on the tenant network type: string StorageNetworkVlanID: default: 30 description: Vlan ID for the storage network traffic. type: number ManagementIpSubnet: # Only populated when including environments/network-management.yaml default: '' description: IP address/subnet on the management network type: string InternalApiNetworkVlanID: default: '' description: Vlan ID for the internal_api network traffic. type: number TenantNetworkVlanID: default: '' description: Vlan ID for the tenant network traffic. type: number ManagementNetworkVlanID: default: 23 description: Vlan ID for the management network traffic. type: number StorageIpSubnet: default: '' description: IP address/subnet on the storage network type: string StorageMgmtIpSubnet: default: '' description: IP address/subnet on the storage mgmt network type: string ControlPlaneSubnetCidr: # Override this via parameter_defaults default: '24' description: The subnet CIDR of the control plane network. type: string ControlPlaneDefaultRoute: # Override this via parameter_defaults description: The default route of the control plane network. type: string DnsServers: # Override this via parameter_defaults default: [] description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. type: comma_delimited_list EC2MetadataIp: # Override this via parameter_defaults description: The IP address of the EC2 metadata server. type: string ExternalInterfaceDefaultRoute: default: '' description: default route for the external network type: string resources: OsNetConfigImpl: type: OS::Heat::StructuredConfig properties: group: os-apply-config config: os_net_config: network_config: - type: interface name: nic1 use_dhcp: false defroute: false - type: interface name: nic2 use_dhcp: false addresses: - ip_netmask: list_join: - '/' - - {get_param: ControlPlaneIp} - {get_param: ControlPlaneSubnetCidr} routes: - ip_netmask: 169.254.169.254/32 next_hop: {get_param: EC2MetadataIp} - default: true next_hop: {get_param: ControlPlaneDefaultRoute} - 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 - type: vlan vlan_id: {get_param: InternalApiNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: InternalApiIpSubnet} - type: vlan vlan_id: {get_param: StorageNetworkVlanID} device: bond_api addresses: - ip_netmask: {get_param: StorageIpSubnet} - type: ovs_user_bridge name: br-link0 ovs_extra: - str_replace: template: set port br-link0 tag=_VLAN_TAG_ params: _VLAN_TAG_: {get_param: TenantNetworkVlanID} addresses: - ip_netmask: {get_param: TenantIpSubnet} use_dhcp: false members: - type: ovs_dpdk_port name: dpdk0 mtu: 9000 ovs_extra: - set interface $DEVICE mtu_request=$MTU - set interface $DEVICE options:n_rxq=2 members: - type: interface name: nic7 primary: true - type: interface name: p7p2 mtu: 9000 use_dhcp: false defroute: false nm_controlled: true hotplug: true outputs: OS::stack_id: description: The OsNetConfigImpl resource. value: {get_resource: OsNetConfigImpl}
C.1.5. overcloud_deploy.sh
#!/bin/bash openstack overcloud deploy \ --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-sriov.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/ovs-dpdk-permissions.yaml \ -e /home/stack/ospd-10-vxlan-vlan-dpdk-sriov-ctlplane-bonding/network-environment.yaml \ --log-file overcloud_install.log &> overcloud_install.log
付録D Revision History
改訂履歴 | ||
---|---|---|
改訂 10.3-0 | July 31 2018 | |
Updated network creation steps to use OSC parameters. | ||
改訂 10.2-0 | July 24 2018 | |
Removed section 'Configure OVS-DPDK Composable Role'. | ||
改訂 10.1-0 | June 27 2018 | |
Updates for 10zasync release with OVS 2.9 support. | ||
改訂 10.0-0 | April 11 2018 | |
Updates for 10z7 release. |