From c7fd00092d47da0f0f7f43bae159a2ec36294ea5 Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Mon, 6 Jun 2016 17:34:53 -0400 Subject: Fixes setting kernel boot arguments with perf options JIRA: APEX-168 opnfv-tht-pr: 22 Change-Id: I224b16be24b34e245d22c9321ca94ebe52c52dfd Signed-off-by: Tim Rozet --- build/build_perf_image.sh | 4 +-- build/opnfv-environment.yaml | 1 + build/set_perf_images.sh | 24 +++++++++++++++--- build/undercloud.sh | 6 +++++ ci/deploy.sh | 60 +++++++++++++++++++++++++++++++++++++------- 5 files changed, 80 insertions(+), 15 deletions(-) diff --git a/build/build_perf_image.sh b/build/build_perf_image.sh index 80e615ef..c91b563d 100644 --- a/build/build_perf_image.sh +++ b/build/build_perf_image.sh @@ -33,8 +33,6 @@ if [ "$CATEGORY" == "nova" ]; then fi if [ "$CATEGORY" == "kernel" ]; then - LIBGUESTFS_BACKEND=direct virt-customize \ - --run-command "grubby --update-kernel=ALL --args=$KEY=$VALUE" \ - -a $IMAGE + echo "${KEY}=${VALUE}" >> $ROLE-kernel_params.txt fi diff --git a/build/opnfv-environment.yaml b/build/opnfv-environment.yaml index 57df2d35..54b1e6f2 100644 --- a/build/opnfv-environment.yaml +++ b/build/opnfv-environment.yaml @@ -3,6 +3,7 @@ parameters: controllerImage: overcloud-full + OvercloudControlFlavor: baremetal ControllerEnableSwiftStorage: false EnableSahara: false ExtraConfig: diff --git a/build/set_perf_images.sh b/build/set_perf_images.sh index 2002e6fb..0025cc75 100644 --- a/build/set_perf_images.sh +++ b/build/set_perf_images.sh @@ -2,7 +2,7 @@ ############################################################################## # Copyright (c) 2016 Red Hat Inc. -# Michael Chapman +# Michael Chapman , Tim Rozet # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at @@ -10,22 +10,40 @@ ############################################################################## for ROLE in $@; do + RAMDISK=${ROLE}-bm-deploy-ramdisk + if [ -f $ROLE-overcloud-full.qcow2 ]; then + echo "Uploading ${RAMDISK}" + glance image-create --name ${RAMDISK} --disk-format ari --container-format ari --file ${ROLE}-ironic-python-agent.initramfs --is-public True echo "Uploading $ROLE-overcloud-full.qcow2 " KERNEL=$(glance image-show overcloud-full | grep 'kernel_id' | cut -d '|' -f 3 | xargs) - RAMDISK=$(glance image-show overcloud-full | grep 'ramdisk_id' | cut -d '|' -f 3 | xargs) - glance image-create --name $ROLE-overcloud-full --disk-format qcow2 --file $ROLE-overcloud-full.qcow2 --container-format bare --property ramdisk_id=$RAMDISK --property kernel_id=$KERNEL + RAMDISK_ID=$(glance image-show ${RAMDISK} | grep id | awk {'print $4'}) + glance image-create --name $ROLE-overcloud-full --disk-format qcow2 --file $ROLE-overcloud-full.qcow2 --container-format bare --property ramdisk_id=$RAMDISK_ID --property kernel_id=$KERNEL --is-public True fi if [ "$ROLE" == "Controller" ]; then sed -i "s/overcloud-full/Controller-overcloud-full/" opnfv-environment.yaml + sed -i '/OvercloudControlFlavor:/c\ OvercloudControlFlavor: control' opnfv-environment.yaml fi if [ "$ROLE" == "Compute" ]; then sudo sed -i "s/NovaImage: .*/NovaImage: Compute-overcloud-full/" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml + sudo sed -i '/OvercloudComputeFlavor:/c\ OvercloudComputeFlavor: compute' /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml fi if [ "$ROLE" == "BlockStorage" ]; then sudo sed -i "s/BlockStorageImage: .*/BlockStorageImage: BlockStorage-overcloud-full/" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml fi + + RAMDISK_ID=$(glance image-show ${RAMDISK} | grep id | awk {'print $4'}) + nodes=$(ironic node-list | awk {'print $2'} | grep -Eo [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}) + role=$(echo $ROLE | awk '{print tolower($0)}') + if [ "$role" == "controller" ]; then + role="control" + fi + for node in $nodes; do + if ironic node-show $node | grep profile:${role}; then + ironic node-update $node replace driver_info/deploy_ramdisk=${RAMDISK_ID} + fi + done done diff --git a/build/undercloud.sh b/build/undercloud.sh index 04c2667f..f2e98795 100755 --- a/build/undercloud.sh +++ b/build/undercloud.sh @@ -70,9 +70,15 @@ LIBGUESTFS_BACKEND=direct virt-customize \ --upload ../virtual-environment.yaml:/home/stack/ \ -a undercloud.qcow2 +# Add custom IPA to allow kernel params +wget https://raw.githubusercontent.com/trozet/ironic-python-agent/opnfv_kernel/ironic_python_agent/extensions/image.py +python3.4 -c 'import py_compile; py_compile.compile("image.py", cfile="image.pyc")' + # Add performance image scripts LIBGUESTFS_BACKEND=direct virt-customize --upload ../build_perf_image.sh:/home/stack \ --upload ../set_perf_images.sh:/home/stack \ + --upload image.py:/root \ + --upload image.pyc:/root \ -a undercloud.qcow2 popd > /dev/null diff --git a/ci/deploy.sh b/ci/deploy.sh index 30a6af29..c1a3dd5f 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -535,6 +535,13 @@ EOF #virsh vol-list default | grep baremetal${i} 2>&1> /dev/null || virsh vol-create-as default baremetal${i}.qcow2 41G --format qcow2 mac=$(virsh domiflist baremetal${i} | grep admin_network | awk '{ print $5 }') + if [ "$VM_COMPUTES" -gt 0 ]; then + capability="profile:compute" + VM_COMPUTES=$((VM_COMPUTES - 1)) + else + capability="profile:control" + fi + cat >> $CONFIG/instackenv-virt.json << EOF { "pm_addr": "192.168.122.1", @@ -547,7 +554,8 @@ EOF "cpu": "$vcpus", "memory": "$ramsize", "disk": "41", - "arch": "x86_64" + "arch": "x86_64", + "capabilities": "$capability" }, EOF done @@ -801,14 +809,49 @@ function undercloud_prep_overcloud_deploy { ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "rm -f overcloud-full.qcow2" scp ${SSH_OPTIONS[@]} $RESOURCES/overcloud-full-${SDN_IMAGE}.qcow2 "stack@$UNDERCLOUD":overcloud-full.qcow2 - # Push performance options to subscript to modify per-role images as needed - for option in "${performance_options[@]}" ; do - echo -e "${blue}Setting performance option $option${reset}" - ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "bash build_perf_image.sh $option" - done - # Add performance deploy options if they have been set if [ ! -z "${deploy_options_array['performance']}" ]; then + + # Remove previous kernel args files per role + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "rm -f Compute-kernel_params.txt" + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "rm -f Controller-kernel_params.txt" + + # Push performance options to subscript to modify per-role images as needed + for option in "${performance_options[@]}" ; do + echo -e "${blue}Setting performance option $option${reset}" + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "bash build_perf_image.sh $option" + done + + # Build IPA kernel option ramdisks + ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" < /home/stack/Compute-ironic-python-agent.initramfs +chown stack /home/stack/Compute-ironic-python-agent.initramfs +if [ ! -f /home/stack/Controller-kernel_params.txt ]; then + touch /home/stack/Controller-kernel_params.txt + chown stack /home/stack/Controller-kernel_params.txt +fi +/bin/cp -f /home/stack/Controller-kernel_params.txt tmp/kernel_params.txt +echo "Controller params set: " +cat tmp/kernel_params.txt +find . | cpio -o -H newc | gzip > /home/stack/Controller-ironic-python-agent.initramfs +chown stack /home/stack/Controller-ironic-python-agent.initramfs +popd +/bin/rm -rf ipa/ +EOI + DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml" fi @@ -864,11 +907,10 @@ set -o errexit echo "Uploading overcloud glance images" openstack overcloud image upload -bash -x set_perf_images.sh ${performance_roles[@]} - echo "Configuring undercloud and discovering nodes" openstack baremetal import --json instackenv.json openstack baremetal configure boot +bash -x set_perf_images.sh ${performance_roles[@]} #if [[ -z "$virtual" ]]; then # openstack baremetal introspection bulk start #fi -- cgit 1.2.3-korg