9.2. NFV ワークロードに向けた RT-KVM の有効化
Red Hat Enterprise Linux 8.2 Real Time KVM (RT-KVM) を容易にインストールおよび設定するために、Red Hat OpenStack Platform では以下の機能を使用することができます。
- Red Hat Enterprise Linux for Real Time をプロビジョニングする、real-time コンピュートノードロール
- 追加の RT-KVM カーネルモジュール
- コンピュートノードの自動設定
9.2.1. RT-KVM コンピュートノードのプランニング
RT-KVM コンピュートノードには、Red Hat 認定済みサーバーを使用する必要があります。詳しくは、Red Hat Enterprise Linux for Real Time 7 用認定サーバー を参照してください。
RT-KVM 用の rhel-8-server-nfv-rpms リポジトリーを有効にしてシステムを最新の状態に維持する方法についての詳細は、Director Installation and Usage の Registering the undercloud and attaching subscriptions を参照してください。
このリポジトリーにアクセスするには、別途 Red Hat OpenStack Platform for Real Time SKU のサブスクリプションが必要です。
real-time のイメージのビルド
アンダークラウドに libguestfs-tools パッケージをインストールして、virt-customize ツールを取得します。
(undercloud) [stack@undercloud-0 ~]$ sudo dnf install libguestfs-tools
重要アンダークラウドに
libguestfs-toolsパッケージをインストールする場合は、アンダークラウドのtripleo_iscsidサービスとのポートの競合を避けるためにiscsid.socketを無効にします。$ sudo systemctl disable --now iscsid.socket
イメージを抽出します。
(undercloud) [stack@undercloud-0 ~]$ tar -xf /usr/share/rhosp-director-images/overcloud-full.tar (undercloud) [stack@undercloud-0 ~]$ tar -xf /usr/share/rhosp-director-images/ironic-python-agent.tar
デフォルトのイメージをコピーします。
(undercloud) [stack@undercloud-0 ~]$ cp overcloud-full.qcow2 overcloud-realtime-compute.qcow2
イメージを登録して、カスタマイズに適切な Red Hat のリポジトリーを有効にします。以下の例の
[username]および[password]を有効な認証情報に置き換えてください。virt-customize -a overcloud-realtime-compute.qcow2 --run-command \ 'subscription-manager register --username=[username] --password=[password]' \ subscription-manager release --set 8.2
注記コマンドプロンプトで認証情報を使用したら、履歴ファイルから認証情報を削除してセキュリティーを確保することができます。
history -dコマンドの後に行番号を指定して、履歴内の個々の行を削除することができます。アカウントのサブスクリプションからプール ID の一覧を検索し、適切なプール ID をイメージにアタッチします。
sudo subscription-manager list --all --available | less ... virt-customize -a overcloud-realtime-compute.qcow2 --run-command \ 'subscription-manager attach --pool [pool-ID]'
Red Hat OpenStack Platform で NFV を使用するのに必要なリポジトリーを追加します。
virt-customize -a overcloud-realtime-compute.qcow2 --run-command \ 'sudo subscription-manager repos --enable=rhel-8-for-x86_64-baseos-eus-rpms \ --enable=rhel-8-for-x86_64-appstream-eus-rpms \ --enable=rhel-8-for-x86_64-highavailability-eus-rpms \ --enable=ansible-2.9-for-rhel-8-x86_64-rpms \ --enable=openstack-16.1-for-rhel-8-x86_64-rpms \ --enable=rhel-8-for-x86_64-nfv-rpms \ --enable=advanced-virt-for-rhel-8-x86_64-rpms \ --enable=fast-datapath-for-rhel-8-x86_64-rpms'
イメージ上でリアルタイム機能を設定するためのスクリプトを作成します。
(undercloud) [stack@undercloud-0 ~]$ cat <<'EOF' > rt.sh #!/bin/bash set -eux dnf -v -y --setopt=protected_packages= erase kernel.$(uname -m) dnf -v -y install kernel-rt kernel-rt-kvm tuned-profiles-nfv-host grubby --set-default /boot/vmlinuz*rt* EOF
リアルタイムイメージを設定するスクリプトを実行します。
(undercloud) [stack@undercloud-0 ~]$ virt-customize -a overcloud-realtime-compute.qcow2 -v --run rt.sh 2>&1 | tee virt-customize.log
注記rt.shスクリプトの出力にgrubby fatal error: unable to find a suitable templateという行が表示されても、このエラーは無視してかまいません。前のステップで作成された
virt-customize.logファイルを調べ、rt.shスクリプトによりパッケージが正しくインストールされたことを確認します。(undercloud) [stack@undercloud-0 ~]$ cat virt-customize.log | grep Verifying Verifying : kernel-3.10.0-957.el7.x86_64 1/1 Verifying : 10:qemu-kvm-tools-rhev-2.12.0-18.el7_6.1.x86_64 1/8 Verifying : tuned-profiles-realtime-2.10.0-6.el7_6.3.noarch 2/8 Verifying : linux-firmware-20180911-69.git85c5d90.el7.noarch 3/8 Verifying : tuned-profiles-nfv-host-2.10.0-6.el7_6.3.noarch 4/8 Verifying : kernel-rt-kvm-3.10.0-957.10.1.rt56.921.el7.x86_64 5/8 Verifying : tuna-0.13-6.el7.noarch 6/8 Verifying : kernel-rt-3.10.0-957.10.1.rt56.921.el7.x86_64 7/8 Verifying : rt-setup-2.0-6.el7.x86_64 8/8
SELinux の再ラベル付けをします。
(undercloud) [stack@undercloud-0 ~]$ virt-customize -a overcloud-realtime-compute.qcow2 --selinux-relabel
vmlinuz および initrd を抽出します。
(undercloud) [stack@undercloud-0 ~]$ mkdir image (undercloud) [stack@undercloud-0 ~]$ guestmount -a overcloud-realtime-compute.qcow2 -i --ro image (undercloud) [stack@undercloud-0 ~]$ cp image/boot/vmlinuz-3.10.0-862.rt56.804.el7.x86_64 ./overcloud-realtime-compute.vmlinuz (undercloud) [stack@undercloud-0 ~]$ cp image/boot/initramfs-3.10.0-862.rt56.804.el7.x86_64.img ./overcloud-realtime-compute.initrd (undercloud) [stack@undercloud-0 ~]$ guestunmount image
注記vmlinuzおよびinitramfsのファイル名に含まれるソフトウェアバージョンは、カーネルバージョンによって異なります。イメージをアップロードします。
(undercloud) [stack@undercloud-0 ~]$ openstack overcloud image upload --update-existing --os-image-name overcloud-realtime-compute.qcow2
これで、選択したコンピュートノード上の ComputeOvsDpdkRT コンポーザブルロールで使用することのできる real-time イメージの準備ができました。
RT-KVM コンピュートノード上での BIOS 設定の変更
RT-KVM コンピュートノードのレイテンシーを低減するには、コンピュートノードの BIOS 設定で、以下のパラメーターのオプションをすべて無効にします。
- 電源管理
- ハイパースレッディング
- CPU のスリープ状態
- 論理プロセッサー
これらの設定に関する説明と、無効化の影響については、Red Hat Enterprise Linux for Real Time チューニングガイドの BIOS パラメーターの設定 を参照してください。BIOS 設定の変更方法に関する詳しい情報は、ハードウェアの製造会社のドキュメントを参照してください。
9.2.2. RT-KVM 対応の OVS-DPDK の設定
OVS-DPDK 用の OpenStack ネットワークを最適化するには、network-environment.yaml ファイルに設定する OVS-DPDK パラメーターの最適な値を判断する必要があります。詳しくは、「ワークフローを使用した DPDK パラメーターの算出」を参照してください。
9.2.2.1. ComputeOvsDpdk コンポーザブルロールの生成
ComputeOvsDpdkRT ロールを使用して、real-time の Compute イメージ用のコンピュートノードを指定します。
ComputeOvsDpdkRT ロール向けに roles_data.yaml を生成します。
# (undercloud) [stack@undercloud-0 ~]$ openstack overcloud roles generate -o roles_data.yaml Controller ComputeOvsDpdkRT
9.2.2.2. OVS-DPDK パラメーターの設定
デプロイメントを最適化するには、network-environment.yaml ファイルの OVS-DPDK パラメーターの最適な値を判断します。詳細は、「ワークフローを使用した DPDK パラメーターの算出」 を参照してください。
resource_registryセクションに、使用する OVS-DPDK ロールの NIC 設定を追加します。resource_registry: # Specify the relative/absolute path to the config files you want to use for override the default. OS::TripleO::ComputeOvsDpdkRT::Net::SoftwareConfig: nic-configs/compute-ovs-dpdk.yaml OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml
parameter_defaultsセクションで、OVS-DPDK および RT-KVM のパラメーターを設定します。# DPDK compute node. ComputeOvsDpdkRTParameters: KernelArgs: "default_hugepagesz=1GB hugepagesz=1G hugepages=32 iommu=pt intel_iommu=on isolcpus=1-7,17-23,9-15,25-31" TunedProfileName: "realtime-virtual-host" IsolCpusList: "1,2,3,4,5,6,7,9,10,17,18,19,20,21,22,23,11,12,13,14,15,25,26,27,28,29,30,31" NovaComputeCpuDedicatedSet: ['2,3,4,5,6,7,18,19,20,21,22,23,10,11,12,13,14,15,26,27,28,29,30,31'] NovaReservedHostMemory: 4096 OvsDpdkSocketMemory: "1024,1024" OvsDpdkMemoryChannels: "4" OvsPmdCoreList: "1,17,9,25" VhostuserSocketGroup: "hugetlbfs" ComputeOvsDpdkRTImage: "overcloud-realtime-compute"
9.2.2.3. オーバークラウドのデプロイ
ML2-OVS 向けのオーバークラウドをデプロイします。
(undercloud) [stack@undercloud-0 ~]$ openstack overcloud deploy \ --templates \ -r /home/stack/ospd-16-vlan-dpdk-ctlplane-bonding-rt/roles_data.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/services/neutron-ovs.yaml \ -e /usr/share/openstack-tripleo-heat-templates/environments/services/neutron-ovs-dpdk.yaml \ -e /home/stack/ospd-16-vxlan-dpdk-data-bonding-rt-hybrid/containers-prepare-parameter.yaml \ -e /home/stack/ospd-16-vxlan-dpdk-data-bonding-rt-hybrid/network-environment.yaml
9.2.3. RT-KVM インスタンスの起動
リアルタイム対応のコンピュートノードで RT-KVM インスタンスを起動するには、以下の手順を実施します。
オーバークラウド上に RT-KVM フレーバーを作成します。
# openstack flavor create r1.small 99 4096 20 4 # openstack flavor set --property hw:cpu_policy=dedicated 99 # openstack flavor set --property hw:cpu_realtime=yes 99 # openstack flavor set --property hw:mem_page_size=1GB 99 # openstack flavor set --property hw:cpu_realtime_mask="^0-1" 99 # openstack flavor set --property hw:cpu_emulator_threads=isolate 99
RT-KVM インスタンスを起動します。
# openstack server create --image <rhel> --flavor r1.small --nic net-id=<dpdk-net> test-rt
割り当てられたエミュレータースレッドをインスタンスが使用していることを確認するには、以下のコマンドを実行します。
# virsh dumpxml <instance-id> | grep vcpu -A1 <vcpu placement='static'>4</vcpu> <cputune> <vcpupin vcpu='0' cpuset='1'/> <vcpupin vcpu='1' cpuset='3'/> <vcpupin vcpu='2' cpuset='5'/> <vcpupin vcpu='3' cpuset='7'/> <emulatorpin cpuset='0-1'/> <vcpusched vcpus='2-3' scheduler='fifo' priority='1'/> </cputune>