9.3. 为 NFV 工作负载启用 RT-KVM
本节介绍了为 Red Hat OpenStack Platform 安装和配置 Red Hat Enterprise Linux 7.5 Real Time KVM (RT-KVM)的步骤。Red Hat OpenStack Platform 提供实时功能,提供一个新的实时 Compute 节点角色,这些角色为 Real-Time 置备 Red Hat Enterprise Linux,以及额外的 RT-KVM 内核模块,以及自动配置 Compute 节点。
9.3.1. 规划您的 RT-KVM Compute 节点 复制链接链接已复制到粘贴板!
您必须使用 Red Hat 认证的服务器作为 RT-KVM Compute 节点。详情请查看 Red Hat Enterprise Linux for Real Time 7 认证的服务器。
如需有关如何为 RT-KVM 启用 rhel-7-server-nfv-rpms 存储库的详细信息,请参阅 注册和更新 undercloud,并确保您的系统处于最新状态。
您需要单独订阅 Red Hat OpenStack Platform for Real Time SKU,才能访问此软件仓库。
构建实时镜像
使用以下步骤为 Real-time Compute 节点构建 overcloud 镜像:
要初始化 stack 用户以使用 director 命令行工具,请运行以下命令:
[stack@undercloud-0 ~]$ source ~/stackrc在 undercloud 上安装 libguestfs-tools 软件包以获取 virt-customize 工具:
(undercloud) [stack@undercloud-0 ~]$ sudo yum install libguestfs-tools重要如果在 undercloud 上安装
libguestfs-tools软件包,请禁用iscsid.socket以避免与 undercloud 上的tripleo_iscsid服务冲突:$ 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注册您的镜像,以启用与您的自定义相关的红帽软件仓库。在以下示例中,用有效的凭证替换
[username]和[password]。virt-customize -a overcloud-realtime-compute.qcow2 --run-command \ 'subscription-manager register --username=[username] --password=[password]'注意在历史记录文件中删除凭证,只要它们用于命令提示符。您可以使用
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]'添加带有 NFV 的 Red Hat OpenStack Platform 所需的存储库。
virt-customize -a overcloud-realtime-compute.qcow2 --run-command \ 'subscription-manager repos --enable=rhel-7-server-nfv-rpms \ --enable=rhel-7-server-rpms \ --enable=rhel-7-server-rh-common-rpms \ --enable=rhel-7-server-extras-rpms \ --enable=rhel-7-server-openstack-13-rpms'创建一个脚本,以在镜像上配置实时功能。
(undercloud) [stack@undercloud-0 ~]$ cat <<'EOF' > rt.sh #!/bin/bash set -eux yum -v -y --setopt=protected_packages= erase kernel.$(uname -m) yum -v -y install kernel-rt kernel-rt-kvm tuned-profiles-nfv-host EOF运行脚本以配置 RT 镜像:
(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:
注意vmlinuz和initramfs文件名中的软件版本因内核版本而异。在文件名中使用相关的软件版本,如image/boot/vmlinuz-3.10.0-862.rt56.804.el7x86_64,或者使用通配符符号*。(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-*.x86_64 ./overcloud-realtime-compute.vmlinuz (undercloud) [stack@undercloud-0 ~]$ cp image/boot/initramfs-*.x86_64.img ./overcloud-realtime-compute.initrd (undercloud) [stack@undercloud-0 ~]$ guestunmount image上传镜像:
(undercloud) [stack@undercloud-0 ~]$ openstack overcloud image upload --update-existing --os-image-name overcloud-realtime-compute.qcow2
现在,您可以在选择 Compute 节点上的 ComputeOvsDpdkRT 可组合角色中使用实时镜像。
修改 RT-KVM Compute 节点上的 BIOS 设置
要减少 RT-KVM Compute 节点上的延迟,您必须修改 BIOS 设置。您应该在 Compute 节点 BIOS 设置中禁用以下所有选项:
- 电源管理
- 超线程
- CPU 睡眠状态
- 逻辑处理器
有关这些设置的描述以及禁用它们的影响,请参阅设置 BIOS 参数。有关如何更改 BIOS 设置的详情,请查看您的硬件厂商文档。