From b84fbfeb7c5b41bd6cf096f16ed9f7d82e800aa5 Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Mon, 7 Dec 2020 16:14:24 -0800 Subject: [PATCH] Add intel_iommu to kernel cmdline This is a necessary prerequisite for QAT support. Issue-ID: ICN-513 Signed-off-by: Todd Malsbary Change-Id: I54d9a8906210ea467fc6822388da981abf9afa48 --- deploy/metal3-vm/03_launch_mgmt_cluster.sh | 10 ++++------ deploy/metal3/scripts/01_metal3.sh | 28 ++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/deploy/metal3-vm/03_launch_mgmt_cluster.sh b/deploy/metal3-vm/03_launch_mgmt_cluster.sh index 047b404..fee9a29 100755 --- a/deploy/metal3-vm/03_launch_mgmt_cluster.sh +++ b/deploy/metal3-vm/03_launch_mgmt_cluster.sh @@ -60,10 +60,10 @@ function launch_baremetal_operator { kubectl apply -f $BMODIR/operator/no_ironic/operator.yaml -n metal3 } -network_config_files() { -cat << 'EOF' +function cloud_init_scripts() { + cat << 'EOF' write_files: -- path: /opt/ironic_net.sh +- path: /var/lib/cloud/scripts/per-boot/run_dhclient.sh owner: root:root permissions: '0777' content: | @@ -73,8 +73,6 @@ write_files: sudo ifconfig `basename $intf` up sudo dhclient -nw `basename $intf` done -runcmd: - - [ /opt/ironic_net.sh ] EOF } @@ -102,7 +100,7 @@ create_userdata() { fi cat $HOME/.ssh/id_rsa.pub >> $name-userdata.yaml - network_config_files >> $name-userdata.yaml + cloud_init_scripts >> $name-userdata.yaml printf "\n" >> $name-userdata.yaml } diff --git a/deploy/metal3/scripts/01_metal3.sh b/deploy/metal3/scripts/01_metal3.sh index 27a6685..563a924 100755 --- a/deploy/metal3/scripts/01_metal3.sh +++ b/deploy/metal3/scripts/01_metal3.sh @@ -128,7 +128,7 @@ EOF fi cat $HOME/.ssh/id_rsa.pub >> $name-userdata.yaml - network_config_files >> $name-userdata.yaml + cloud_init_scripts >> $name-userdata.yaml printf "\n" >> $name-userdata.yaml } @@ -151,10 +151,25 @@ function remove_baremetal_operator { kubectl delete -f bmo/namespace/namespace.yaml } -function network_config_files { +function cloud_init_scripts { + # The "intel_iommu=on iommu=pt" kernel command line is necessary + # for QAT support. cat << 'EOF' write_files: -- path: /opt/ironic_net.sh +- path: /var/lib/cloud/scripts/per-instance/set_kernel_cmdline.sh + owner: root:root + permissions: '0777' + content: | + #!/usr/bin/env bash + set -eux -o pipefail + grub_file=${1:-"/etc/default/grub"} + kernel_parameters="intel_iommu=on iommu=pt" + sed -i~ "/^GRUB_CMDLINE_LINUX=/{h;s/\(=\".*\)\"/\1 ${kernel_parameters}\"/};\${x;/^$/{s//GRUB_CMDLINE_LINUX=\"${kernel_parameters}\"/;H};x}" "$grub_file" + update-grub + reboot +EOF + cat << 'EOF' +- path: /var/lib/cloud/scripts/per-boot/run_dhclient.sh owner: root:root permissions: '0777' content: | @@ -165,8 +180,8 @@ write_files: sudo dhclient -nw `basename $intf` done EOF -cat << EOF -- path: /opt/user_net.sh + cat << EOF +- path: /var/lib/cloud/scripts/per-boot/set_provider_network.sh owner: root:root permissions: '0777' content: | @@ -176,9 +191,6 @@ cat << EOF sed -i -e 's/^#DNS=.*/DNS=$PROVIDER_NETWORK_DNS/g' /etc/systemd/resolved.conf systemctl daemon-reload systemctl restart systemd-resolved -runcmd: - - [ /opt/ironic_net.sh ] - - [ /opt/user_net.sh ] EOF } -- 2.16.6