Merge "Add support for modifying genesis kernel parameters for OVS-DPDK"

This commit is contained in:
Zuul 2020-03-16 17:34:35 +00:00 committed by Gerrit Code Review
commit b610831afa
2 changed files with 57 additions and 3 deletions

View File

@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
GENESIS_HOST_PROFILE=${2:-}
###############################################################################
# Helper functions
@ -64,8 +65,8 @@ install_file(){
local path="$1"
local content="$2"
local permissions="$3"
local dirname
dirname=$(dirname "$path")
local reboot="${4:-false}"
local dirname=$(dirname "$path")
if [[ ! -d $dirname ]]; then
mkdir -p "$dirname"
@ -74,6 +75,9 @@ install_file(){
if [[ ! -f $path ]] || [ "$(cat "$path")" != "$content" ]; then
echo "$content" > "$path"
chmod "$permissions" "$path"
if [[ $reboot = reboot ]]; then
REBOOT=true
fi
export FILE_UPDATED=true
else
export FILE_UPDATED=false
@ -136,6 +140,7 @@ if [[ ! $DISABLE_SECCOMP_PROFILE ]]; then
install_file "$path" "$content" "$permissions"
fi
###############################################################################
# bootaction: apparmor-profiles
###############################################################################
@ -171,3 +176,48 @@ if [[ ! $DISABLE_APPARMOR_PROFILES ]]; then
systemctl reload apparmor.service
fi
fi
###############################################################################
# bootaction: Additional kernel parameters and hugepages for OVS-DPDK
###############################################################################
if [[ -n "$GENESIS_HOST_PROFILE" ]]; then
manifests_lookup "$rendered_file" "drydock/HostProfile/v1" \
"$GENESIS_HOST_PROFILE" \
"['data']['platform']['kernel_params']" \
"dict_keys" "true"
kernel_params=$RESULT
grub_args=()
# NOTE: reverse sort is to ensure hugepagesz is before hugepages
for kp in $(echo $kernel_params | tr ' ' '\n' | sort -r); do
manifests_lookup "$rendered_file" "drydock/HostProfile/v1" \
"$GENESIS_HOST_PROFILE" \
"['data']['platform']['kernel_params']['$kp']"
if [[ $(tr '[:lower:]' '[:upper:]' <<< "$RESULT") == "TRUE" ]]; then
grub_args+=("$kp")
else
grub_args+=("$kp=$RESULT")
fi
done
path="/etc/default/grub.d/50-curtin-settings.cfg"
content="GRUB_CMDLINE_LINUX_DEFAULT=\"${grub_args[*]}\""
install_file "$path" "$content" '644' reboot
update-grub
fi
###############################################################################
# Reboot node
###############################################################################
if [[ ! $DISABLE_REBOOT ]] && [[ $REBOOT = true ]]; then
echo Rebooting node $(hostname)...
reboot now &
fi

View File

@ -17,10 +17,14 @@ set -e
source "${GATE_UTILS}"
GENESIS_HOST_PROFILE=${GENESIS_HOST_PROFILE:-}
# Copies script and virtmgr private key to genesis VM
rsync_cmd "${REPO_ROOT}/tools/deployment/seaworthy-virt/airship_gate/lib/bootaction-runner.sh" "${GENESIS_NAME}:/root/airship/"
rsync_cmd "${RENDERED_DEPOT}/rendered.yaml" "${GENESIS_NAME}:/root/airship/"
set -o pipefail
ssh_cmd "${GENESIS_NAME}" /root/airship/bootaction-runner.sh /root/airship/rendered.yaml 2>&1 | tee -a "${LOG_FILE}"
ssh_cmd "${GENESIS_NAME}" /root/airship/bootaction-runner.sh /root/airship/rendered.yaml "${GENESIS_HOST_PROFILE}" |& tee -a "${LOG_FILE}"
ssh_wait "${GENESIS_NAME}"
set +o pipefail