summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/build_perf_image.sh38
-rw-r--r--build/opnfv-apex-common.spec7
-rw-r--r--build/opnfv-apex-undercloud.spec7
-rwxr-xr-xbuild/overcloud-full.sh8
-rw-r--r--build/set_perf_images.sh31
-rw-r--r--build/setkernelparam.sh27
-rwxr-xr-xbuild/undercloud.sh8
-rwxr-xr-xci/build.sh11
-rwxr-xr-xci/clean.sh8
-rwxr-xr-xci/deploy.sh139
-rw-r--r--config/deploy/os-nosdn-performance-ha.yaml23
-rw-r--r--lib/common-functions.sh85
-rwxr-xr-xlib/python/apex-python-utils.py11
-rw-r--r--lib/python/apex/__init__.py1
-rw-r--r--lib/python/apex/deploy_env.py149
15 files changed, 461 insertions, 92 deletions
diff --git a/build/build_perf_image.sh b/build/build_perf_image.sh
new file mode 100644
index 00000000..0a3e3d0f
--- /dev/null
+++ b/build/build_perf_image.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2016 Red Hat Inc.
+# Michael Chapman <michapma@redhat.com>
+# 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
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+ROLE=$1
+shift
+CATEGORY=$1
+shift
+KEY=$1
+shift
+VALUE=$1
+shift
+
+IMAGE=$ROLE-overcloud-full.qcow2
+
+# Create image copy for this role
+if [ ! -f $IMAGE ] ; then
+ cp overcloud-full.qcow2 $IMAGE
+fi
+
+if [ "$CATEGORY" == "nova" ]; then
+ if [ "$KEY" == "libvirtpin" ]; then
+ sudo sed -i "s/#LibvirtCPUPinSet:.*/LibvirtCPUPinSet: '${VALUE}'/" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
+ fi
+fi
+
+if [ "$CATEGORY" == "kernel" ]; then
+ LIBGUESTFS_BACKEND=direct virt-customize \
+ --run-command "bash -x /root/setkernelparam.sh $KEY $VALUE" \
+ -a $IMAGE
+fi
+
diff --git a/build/opnfv-apex-common.spec b/build/opnfv-apex-common.spec
index 0e44ebbc..6915b795 100644
--- a/build/opnfv-apex-common.spec
+++ b/build/opnfv-apex-common.spec
@@ -33,12 +33,13 @@ install ci/clean.sh %{buildroot}%{_bindir}/opnfv-clean
install ci/util.sh %{buildroot}%{_bindir}/opnfv-util
mkdir -p %{buildroot}%{_sysconfdir}/opnfv-apex/
+install config/deploy/os-nosdn-nofeature-noha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-nosdn-nofeature-noha.yaml
install config/deploy/os-nosdn-nofeature-ha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-nosdn-nofeature-ha.yaml
install config/deploy/os-odl_l2-nofeature-ha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-odl_l2-nofeature-ha.yaml
install config/deploy/os-odl_l2-sfc-noha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-odl_l2-sfc-noha.yaml
install config/deploy/os-odl_l3-nofeature-ha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-odl_l3-nofeature-ha.yaml
install config/deploy/os-onos-nofeature-ha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-onos-nofeature-ha.yaml
-install config/deploy/os-opencontrail-nofeature-ha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-opencontrail-nofeature-ha.yaml
+install config/deploy/os-ocl-nofeature-ha.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/os-ocl-nofeature-ha.yaml
install config/network/network_settings.yaml %{buildroot}%{_sysconfdir}/opnfv-apex/network_settings.yaml
mkdir -p %{buildroot}%{_var}/opt/opnfv/lib/python/apex
@@ -49,6 +50,7 @@ mkdir -p %{buildroot}%{python3_sitelib}/apex/
install lib/python/apex/__init__.py %{buildroot}%{python3_sitelib}/apex/
install lib/python/apex/ip_utils.py %{buildroot}%{python3_sitelib}/apex/
install lib/python/apex/net_env.py %{buildroot}%{python3_sitelib}/apex/
+install lib/python/apex/deploy_env.py %{buildroot}%{python3_sitelib}/apex/
mkdir -p %{buildroot}%{_var}/opt/opnfv/lib/installer/onos/
install lib/installer/onos/onos_gw_mac_update.sh %{buildroot}%{_var}/opt/opnfv/lib/installer/onos/
@@ -71,12 +73,13 @@ install config/inventory/pod_example_settings.yaml %{buildroot}%{_docdir}/opnfv/
%{_var}/opt/opnfv/lib/python/
%{python3_sitelib}/apex/
%{_var}/opt/opnfv/lib/installer/onos/onos_gw_mac_update.sh
+%{_sysconfdir}/opnfv-apex/os-nosdn-nofeature-noha.yaml
%{_sysconfdir}/opnfv-apex/os-nosdn-nofeature-ha.yaml
%{_sysconfdir}/opnfv-apex/os-odl_l2-nofeature-ha.yaml
%{_sysconfdir}/opnfv-apex/os-odl_l2-sfc-noha.yaml
%{_sysconfdir}/opnfv-apex/os-odl_l3-nofeature-ha.yaml
%{_sysconfdir}/opnfv-apex/os-onos-nofeature-ha.yaml
-%{_sysconfdir}/opnfv-apex/os-opencontrail-nofeature-ha.yaml
+%{_sysconfdir}/opnfv-apex/os-ocl-nofeature-ha.yaml
%{_sysconfdir}/opnfv-apex/network_settings.yaml
%doc %{_docdir}/opnfv/LICENSE.rst
%doc %{_docdir}/opnfv/installation-instructions.html
diff --git a/build/opnfv-apex-undercloud.spec b/build/opnfv-apex-undercloud.spec
index ae72485f..0e4798b3 100644
--- a/build/opnfv-apex-undercloud.spec
+++ b/build/opnfv-apex-undercloud.spec
@@ -27,6 +27,8 @@ install build/undercloud.qcow2 %{buildroot}%{_var}/opt/opnfv/images/
install build/network-environment.yaml %{buildroot}%{_var}/opt/opnfv/
install build/nics-controller.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-controller.yaml.template
install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-compute.yaml.template
+install build/nics-controller.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-controller.yaml.jinja2
+install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-compute.yaml.jinja2
%files
%defattr(644, root, root, -)
@@ -34,8 +36,13 @@ install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-comp
%{_var}/opt/opnfv/network-environment.yaml
%{_var}/opt/opnfv/nics-controller.yaml.template
%{_var}/opt/opnfv/nics-compute.yaml.template
+%{_var}/opt/opnfv/nics-controller.yaml.jinja2
+%{_var}/opt/opnfv/nics-compute.yaml.jinja2
+
%changelog
+* Thu May 24 2016 Tim Rozet <trozet@redhat.com> - 3.0-1
+- Adds jinja2 nic templates
* Mon Apr 04 2016 Dan Radez <dradez@redhat.com> - 3.0-0
- Version update for Colorado
* Wed Mar 30 2016 Dan Radez <dradez@redhat.com> - 2.1-2
diff --git a/build/overcloud-full.sh b/build/overcloud-full.sh
index 065201f8..d0ee3f01 100755
--- a/build/overcloud-full.sh
+++ b/build/overcloud-full.sh
@@ -29,5 +29,13 @@ LIBGUESTFS_BACKEND=direct virt-customize \
--run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \
-a overcloud-full_build.qcow2
+###################################
+##### Add CPU pinning script #####
+###################################
+
+LIBGUESTFS_BACKEND=direct virt-customize \
+ --upload ../setkernelparam.sh:/root \
+ -a overcloud-full_build.qcow2
+
mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
popd > /dev/null
diff --git a/build/set_perf_images.sh b/build/set_perf_images.sh
new file mode 100644
index 00000000..ea31c7fa
--- /dev/null
+++ b/build/set_perf_images.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2016 Red Hat Inc.
+# Michael Chapman <michapma@redhat.com>
+# 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
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+for ROLE in $@; do
+ if [ -f $ROLE-overcloud-full.qcow2 ]; then
+ 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
+ fi
+
+ if [ "$ROLE" == "Controller" ]; then
+ sed -i "s/overcloud-full/Controller-overcloud-full" opnfv-environment.yaml
+ fi
+
+ if [ "$ROLE" == "Compute" ]; then
+ sudo sed -i "s/NovaImage: overcloud-full/Compute-overcloud-full/" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
+ fi
+
+ if [ "$ROLE" == "BlockStorage" ]; then
+ sudo sed -i "s/BlockStorageImage: overcloud-full/BlockStorage-overcloud-full/" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
+ fi
+done
diff --git a/build/setkernelparam.sh b/build/setkernelparam.sh
new file mode 100644
index 00000000..b6986d6c
--- /dev/null
+++ b/build/setkernelparam.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2016 Red Hat Inc.
+# Michael Chapman <michapma@redhat.com>
+# 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
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+GRUBCONF='/boot/grub2/grub.conf'
+
+if [ "$1" == "" ]; then
+ echo "No kernel parameter name provided, not modifying grub.conf"
+ exit 1
+fi
+
+if [ "$2" == "" ]; then
+ echo "No kernel parameter value provided, not modifying grub.conf"
+ exit 1
+fi
+
+echo "Setting $1=$2 in $GRUBCONF"
+echo "GRUB_CMDLINE_LINUX=\"\$GRUB_CMDLINE_LINUX $1=$2\"" >> /etc/default/grub
+grub2-mkconfig > $GRUBCONF
+exit 0
diff --git a/build/undercloud.sh b/build/undercloud.sh
index ed4f2b34..04c2667f 100755
--- a/build/undercloud.sh
+++ b/build/undercloud.sh
@@ -43,7 +43,7 @@ if [ "$PR_NUMBER" != "" ]; then
if [ "$MERGED" == "False" ]; then
REF=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['head']['ref']")
echo "Setting GitHub Ref to: $REF"
- REPO=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['head']['repo']['git_url']")
+ REPO=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['head']['repo']['clone_url']")
echo "Setting GitHub URL to: $REPO"
fi
fi
@@ -70,5 +70,9 @@ LIBGUESTFS_BACKEND=direct virt-customize \
--upload ../virtual-environment.yaml:/home/stack/ \
-a undercloud.qcow2
-popd > /dev/null
+# Add performance image scripts
+LIBGUESTFS_BACKEND=direct virt-customize --upload ../build_perf_image.sh:/home/stack \
+ --upload ../set_perf_images.sh:/home/stack \
+ -a undercloud.qcow2
+popd > /dev/null
diff --git a/ci/build.sh b/ci/build.sh
index 7e080bed..e6870558 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -35,6 +35,7 @@ CACHE_DEST=""
CACHE_DIR="cache"
CACHE_NAME="apex-cache"
MAKE_TARGETS="images"
+REQUIRED_PKGS="rpm-build python-docutils"
parse_cmdline() {
while [ "${1:0:1}" = "-" ]
@@ -82,6 +83,16 @@ run_make() {
parse_cmdline "$@"
+# Install build dependencies
+for pkg in $REQUIRED_PKGS; do
+ if ! rpm -q $pkg > /dev/null; then
+ if ! sudo yum -y install $pkg > /dev/null; then
+ echo "Required package $pkg missing and installation failed."
+ exit 1
+ fi
+ fi
+done
+
if [ -n "$RELEASE" ]; then MAKE_ARGS+="RELEASE=$RELEASE "; fi
# Get the Old Cache
diff --git a/ci/clean.sh b/ci/clean.sh
index 42090069..368ce8bc 100755
--- a/ci/clean.sh
+++ b/ci/clean.sh
@@ -20,6 +20,7 @@ source $CONFIG/lib/common-functions.sh
vm_index=4
ovs_bridges="br-admin br-private br-public br-storage"
+OPNFV_NETWORK_TYPES="admin_network private_network public_network storage_network"
# Clean off instack/undercloud VM
for vm in instack undercloud; do
@@ -39,10 +40,13 @@ for i in $(seq 0 $vm_index); do
rm -f /var/lib/libvirt/images/baremetal${i}.qcow2 2> /dev/null
done
+for network in ${OPNFV_NETWORK_TYPES}; do
+ virsh net-destroy ${network} 2> /dev/null
+ virsh net-undefine ${network} 2> /dev/null
+done
+
# Clean off created bridges
for bridge in ${ovs_bridges}; do
- virsh net-destroy ${bridge} 2> /dev/null | xargs echo -n
- virsh net-undefine ${bridge} 2> /dev/null | xargs echo -n
if detach_interface_from_ovs ${bridge} 2> /dev/null; then
ovs-vsctl del-br ${bridge} 2> /dev/null
fi
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 9cdd8297..18f96319 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -33,6 +33,7 @@ debug="FALSE"
declare -i CNT
declare UNDERCLOUD
declare -A deploy_options_array
+declare -a performance_options
declare -A NET_MAP
SSH_OPTIONS=(-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o LogLevel=error)
@@ -102,50 +103,31 @@ parse_setting_value() {
local mystr=$1
echo $(echo $mystr | grep -Eo "\=.*$" | tr -d '=')
}
+
##parses network settings yaml into globals
parse_network_settings() {
+ local output
if output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse_net_settings -n $NETSETS -i $net_isolation_enabled); then
- eval "$output"
echo -e "${blue}${output}${reset}"
+ eval "$output"
else
+ echo -e "${red}ERROR: Failed to parse network settings file $NETSETS ${reset}"
exit 1
fi
-
}
-##parses deploy settings yaml into globals and options array
-##params: none
-##usage: parse_deploy_settings
+
+##parses deploy settings yaml into globals
parse_deploy_settings() {
- local global_prefix="deploy_global_params_"
- local options_prefix="deploy_deploy_options_"
- local myvar myvalue
- local settings=$(parse_yaml $DEPLOY_SETTINGS_FILE "deploy_")
-
- for this_setting in $settings; do
- if contains_prefix $this_setting $global_prefix; then
- myvar=$(parse_setting_var $this_setting $global_prefix)
- if [ -z "$myvar" ]; then
- echo -e "${red}ERROR: while parsing ${DEPLOY_SETTINGS_FILE} for setting: ${this_setting}${reset}"
- fi
- myvalue=$(parse_setting_value $this_setting)
- # Do not override variables set by cmdline
- if [ -z "$(eval echo \$$myvar)" ]; then
- eval "$myvar=\$myvalue"
- echo -e "${blue}Global parameter set: ${myvar}:${myvalue}${reset}"
- else
- echo -e "${blue}Global parameter already set: ${myvar}${reset}"
- fi
- elif contains_prefix $this_setting $options_prefix; then
- myvar=$(parse_setting_var $this_setting $options_prefix)
- if [ -z "$myvar" ]; then
- echo -e "${red}ERROR: while parsing ${DEPLOY_SETTINGS_FILE} for setting: ${this_setting}${reset}"
- fi
- myvalue=$(parse_setting_value $this_setting)
- deploy_options_array[$myvar]=$myvalue
- echo -e "${blue}Deploy option set: ${myvar}:${myvalue}${reset}"
- fi
- done
+ local output
+ if output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse-deploy-settings -f $DEPLOY_SETTINGS_FILE); then
+ echo -e "${blue}${output}${reset}"
+ eval "$output"
+ else
+ echo -e "${red}ERROR: Failed to parse deploy settings file $DEPLOY_SETTINGS_FILE ${reset}"
+ exit 1
+ fi
}
+
##parses baremetal yaml settings into compatible json
##writes the json to $CONFIG/instackenv_tmp.json
##params: none
@@ -292,10 +274,11 @@ function configure_deps {
virsh net-list --all | grep -E "default\s+active" > /dev/null || virsh net-start default
virsh net-list --all | grep -E "default\s+active\s+yes" > /dev/null || virsh net-autostart --network default
- for network in ${OPNFV_NETWORK_TYPES}; do
- echo "${blue}INFO: Creating Virsh Network: $network & OVS Bridge: ${NET_MAP[$network]}${reset}"
- ovs-vsctl list-br | grep ${NET_MAP[$network]} > /dev/null || ovs-vsctl add-br ${NET_MAP[$network]}
- virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF
+ if [[ -z "$virtual" || "$virtual" == "FALSE" ]]; then
+ for network in ${OPNFV_NETWORK_TYPES}; do
+ echo "${blue}INFO: Creating Virsh Network: $network & OVS Bridge: ${NET_MAP[$network]}${reset}"
+ ovs-vsctl list-br | grep "^${NET_MAP[$network]}$" > /dev/null || ovs-vsctl add-br ${NET_MAP[$network]}
+ virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF
<network>
<name>$network</name>
<forward mode='bridge'/>
@@ -303,21 +286,18 @@ function configure_deps {
<virtualport type='openvswitch'/>
</network>
EOF
- if ! (virsh net-list --all | grep $network > /dev/null); then
- echo "${red}ERROR: unable to create network: ${network}${reset}"
- exit 1;
- fi
- rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null;
- virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network
- virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network
- done
+ if ! (virsh net-list --all | grep $network > /dev/null); then
+ echo "${red}ERROR: unable to create network: ${network}${reset}"
+ exit 1;
+ fi
+ rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null;
+ virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network
+ virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network
+ done
- echo -e "${blue}INFO: Bridges set: ${reset}"
- ovs-vsctl list-br
- echo -e "${blue}INFO: virsh networks set: ${reset}"
- virsh net-list
+ echo -e "${blue}INFO: Bridges set: ${reset}"
+ ovs-vsctl list-br
- if [[ -z "$virtual" || "$virtual" == "FALSE" ]]; then
# bridge interfaces to correct OVS instances for baremetal deployment
for network in ${enabled_network_list}; do
if [[ "$network" != "admin_network" && "$network" != "public_network" ]]; then
@@ -337,8 +317,31 @@ EOF
exit 1
fi
done
+ else
+ for network in ${OPNFV_NETWORK_TYPES}; do
+ echo "${blue}INFO: Creating Virsh Network: $network${reset}"
+ virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF
+<network ipv6='yes'>
+<name>$network</name>
+<bridge name='${NET_MAP[$network]}'/>
+</network>
+EOF
+ if ! (virsh net-list --all | grep $network > /dev/null); then
+ echo "${red}ERROR: unable to create network: ${network}${reset}"
+ exit 1;
+ fi
+ rm -f ${libvirt_dir}/apex-virsh-net.xml &> /dev/null;
+ virsh net-list | grep -E "$network\s+active" > /dev/null || virsh net-start $network
+ virsh net-list | grep -E "$network\s+active\s+yes" > /dev/null || virsh net-autostart --network $network
+ done
+
+ echo -e "${blue}INFO: Bridges set: ${reset}"
+ brctl show
fi
+ echo -e "${blue}INFO: virsh networks set: ${reset}"
+ virsh net-list
+
# ensure storage pool exists and is started
virsh pool-list --all | grep default > /dev/null || virsh pool-define-as --name default dir --target /var/lib/libvirt/images
virsh pool-list | grep -Eo "default\s+active" > /dev/null || (virsh pool-autostart default; virsh pool-start default)
@@ -638,7 +641,7 @@ function configure_network_environment {
##Copy over the glance images and instackenv json file
##params: none
function configure_undercloud {
-
+ local controller_nic_template compute_nic_template
echo
echo "Copying configuration files to Undercloud"
if [[ "$net_isolation_enabled" == "TRUE" ]]; then
@@ -646,13 +649,22 @@ function configure_undercloud {
echo -e "${blue}Network Environment set for Deployment: ${reset}"
cat $CONFIG/network-environment.yaml
scp ${SSH_OPTIONS[@]} $CONFIG/network-environment.yaml "stack@$UNDERCLOUD":
+ if ! controller_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+ echo -e "${red}ERROR: Failed to generate controller NIC heat template ${reset}"
+ exit 1
+ fi
+
+ if ! compute_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+ echo -e "${red}ERROR: Failed to generate compute NIC heat template ${reset}"
+ exit 1
+ fi
ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI
mkdir nics/
cat > nics/controller.yaml << EOF
-$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family)
+$controller_nic_template
EOF
cat > nics/compute.yaml << EOF
-$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family)
+$compute_nic_template
EOF
EOI
fi
@@ -784,12 +796,12 @@ function undercloud_prep_overcloud_deploy {
elif [ "${deploy_options_array['sdn_controller']}" == 'opencontrail' ]; then
echo -e "${red}ERROR: OpenContrail is currently unsupported...exiting${reset}"
exit 1
- elif [[ -z "${deploy_options_array['sdn_controller']}" || "${deploy_options_array['sdn_controller']}" == 'false' ]]; then
+ elif [[ -z "${deploy_options_array['sdn_controller']}" || "${deploy_options_array['sdn_controller']}" == 'False' ]]; then
echo -e "${blue}INFO: SDN Controller disabled...will deploy nosdn scenario${reset}"
SDN_IMAGE=opendaylight
else
echo "${red}Invalid sdn_controller: ${deploy_options_array['sdn_controller']}${reset}"
- echo "${red}Valid choices are opendaylight, opendaylight-external, onos, opencontrail, false, or null${reset}"
+ echo "${red}Valid choices are opendaylight, opendaylight-external, onos, opencontrail, False, or null${reset}"
exit 1
fi
@@ -805,6 +817,17 @@ 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
+ DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml"
+ fi
+
# make sure ceph is installed
DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml"
@@ -856,6 +879,9 @@ source stackrc
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
@@ -1182,6 +1208,7 @@ main() {
exit 1
fi
if [ -n "$DEPLOY_SETTINGS_FILE" ]; then
+ echo -e "${blue}INFO: Parsing deploy settings file...${reset}"
parse_deploy_settings
fi
setup_undercloud_vm
diff --git a/config/deploy/os-nosdn-performance-ha.yaml b/config/deploy/os-nosdn-performance-ha.yaml
new file mode 100644
index 00000000..f7312ad6
--- /dev/null
+++ b/config/deploy/os-nosdn-performance-ha.yaml
@@ -0,0 +1,23 @@
+global_params:
+ ha_enabled: true
+
+deploy_options:
+ sdn_controller: false
+ sdn_l3: false
+ tacker: false
+ congress: false
+ sfc: false
+ vpn: false
+ performance:
+ Controller:
+ kernel:
+ isolcpus: 1
+ hugepage: 2M
+ intel_iommu: 'on'
+ Compute:
+ nova:
+ libvirtpin: 1
+ kernel:
+ isolcpus: 0
+ hugepage: 2M
+ intel_iommu: 'on'
diff --git a/lib/common-functions.sh b/lib/common-functions.sh
index e7041ac4..dfac008e 100644
--- a/lib/common-functions.sh
+++ b/lib/common-functions.sh
@@ -27,6 +27,7 @@ function find_ip {
function attach_interface_to_ovs {
local bridge interface
local if_ip if_mask if_gw if_file ovs_file if_prefix
+ local if_metric if_dns1 if_dns2
if [[ -z "$1" || -z "$2" ]]; then
return 1
@@ -46,6 +47,9 @@ function attach_interface_to_ovs {
if_ip=$(sed -n 's/^IPADDR=\(.*\)$/\1/p' ${if_file})
if_mask=$(sed -n 's/^NETMASK=\(.*\)$/\1/p' ${if_file})
if_gw=$(sed -n 's/^GATEWAY=\(.*\)$/\1/p' ${if_file})
+ if_metric=$(sed -n 's/^METRIC=\(.*\)$/\1/p' ${if_file})
+ if_dns1=$(sed -n 's/^DNS1=\(.*\)$/\1/p' ${if_file})
+ if_dns2=$(sed -n 's/^DNS2=\(.*\)$/\1/p' ${if_file})
else
echo "ERROR: ifcfg file missing for ${interface}"
return 1
@@ -77,7 +81,7 @@ ONBOOT=yes
OVS_BRIDGE=${bridge}
PROMISC=yes" > ${if_file}
- if [ -z ${if_gw} ]; then
+
# create bridge cfg
echo "DEVICE=${bridge}
DEVICETYPE=ovs
@@ -89,17 +93,24 @@ TYPE=OVSBridge
PROMISC=yes
PEERDNS=no" > ${ovs_file}
- else
- echo "DEVICE=${bridge}
-DEVICETYPE=ovs
-IPADDR=${if_ip}
-NETMASK=${if_mask}
-BOOTPROTO=static
-ONBOOT=yes
-TYPE=OVSBridge
-PROMISC=yes
-GATEWAY=${if_gw}
-PEERDNS=no" > ${ovs_file}
+ if [ -n "$if_gw" ]; then
+ echo "GATEWAY=${if_gw}" >> ${ovs_file}
+ fi
+
+ if [ -n "$if_metric" ]; then
+ echo "METRIC=${if_metric}" >> ${ovs_file}
+ fi
+
+ if [[ -n "$if_dns1" || -n "$if_dns2" ]]; then
+ sed -i '/PEERDNS/c\PEERDNS=yes' ${ovs_file}
+
+ if [ -n "$if_dns1" ]; then
+ echo "DNS1=${if_dns1}" >> ${ovs_file}
+ fi
+
+ if [ -n "$if_dns2" ]; then
+ echo "DNS2=${if_dns2}" >> ${ovs_file}
+ fi
fi
sudo systemctl restart network
@@ -113,6 +124,7 @@ function detach_interface_from_ovs {
local port_output ports_no_orig
local net_path
local if_ip if_mask if_gw if_prefix
+ local if_metric if_dns1 if_dns2
net_path=/etc/sysconfig/network-scripts/
if [[ -z "$1" ]]; then
@@ -134,12 +146,15 @@ function detach_interface_from_ovs {
elif [ -e ${net_path}/ifcfg-${line}.orig ]; then
mv -f ${net_path}/ifcfg-${line}.orig ${net_path}/ifcfg-${line}
elif [ -e ${net_path}/ifcfg-${bridge} ]; then
- if_ip=$(sed -n 's/^IPADDR=\(.*\)$/\1/p' ${if_file})
- if_mask=$(sed -n 's/^NETMASK=\(.*\)$/\1/p' ${if_file})
- if_gw=$(sed -n 's/^GATEWAY=\(.*\)$/\1/p' ${if_file})
+ if_ip=$(sed -n 's/^IPADDR=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_mask=$(sed -n 's/^NETMASK=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_gw=$(sed -n 's/^GATEWAY=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_metric=$(sed -n 's/^METRIC=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_dns1=$(sed -n 's/^DNS1=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_dns2=$(sed -n 's/^DNS2=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
if [ -z "$if_mask" ]; then
- if_prefix=$(sed -n 's/^PREFIX=\(.*\)$/\1/p' ${if_file})
+ if_prefix=$(sed -n 's/^PREFIX=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
if_mask=$(prefix2mask ${if_prefix})
fi
@@ -148,26 +163,34 @@ function detach_interface_from_ovs {
return 1
fi
- if [ -z ${if_gw} ]; then
- # create if cfg
- echo "DEVICE=${line}
-IPADDR=${if_ip}
-NETMASK=${if_mask}
-BOOTPROTO=static
-ONBOOT=yes
-TYPE=Ethernet
-NM_CONTROLLED=no
-PEERDNS=no" > ${net_path}/ifcfg-${line}
- else
- echo "DEVICE=${line}
+ # create if cfg
+ echo "DEVICE=${line}
IPADDR=${if_ip}
NETMASK=${if_mask}
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
NM_CONTROLLED=no
-GATEWAY=${if_gw}
PEERDNS=no" > ${net_path}/ifcfg-${line}
+
+ if [ -n "$if_gw" ]; then
+ echo "GATEWAY=${if_gw}" >> ${net_path}/ifcfg-${line}
+ fi
+
+ if [ -n "$if_metric" ]; then
+ echo "METRIC=${if_metric}" >> ${net_path}/ifcfg-${line}
+ fi
+
+ if [[ -n "$if_dns1" || -n "$if_dns2" ]]; then
+ sed -i '/PEERDNS/c\PEERDNS=yes' ${net_path}/ifcfg-${line}
+
+ if [ -n "$if_dns1" ]; then
+ echo "DNS1=${if_dns1}" >> ${net_path}/ifcfg-${line}
+ fi
+
+ if [ -n "$if_dns2" ]; then
+ echo "DNS2=${if_dns2}" >> ${net_path}/ifcfg-${line}
+ fi
fi
break
else
@@ -182,6 +205,10 @@ PEERDNS=no" > ${net_path}/ifcfg-${line}
sudo sed -i 's/IPADDR=.*//' ${net_path}/ifcfg-${bridge}
sudo sed -i 's/NETMASK=.*//' ${net_path}/ifcfg-${bridge}
sudo sed -i 's/GATEWAY=.*//' ${net_path}/ifcfg-${bridge}
+ sudo sed -i 's/DNS1=.*//' ${net_path}/ifcfg-${bridge}
+ sudo sed -i 's/DNS2=.*//' ${net_path}/ifcfg-${bridge}
+ sudo sed -i 's/METRIC=.*//' ${net_path}/ifcfg-${bridge}
+ sudo sed -i 's/PEERDNS=.*//' ${net_path}/ifcfg-${bridge}
sudo systemctl restart network
}
diff --git a/lib/python/apex-python-utils.py b/lib/python/apex-python-utils.py
index 1d5b4a7c..7e947ea6 100755
--- a/lib/python/apex-python-utils.py
+++ b/lib/python/apex-python-utils.py
@@ -7,7 +7,6 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
import argparse
import sys
import apex
@@ -21,6 +20,10 @@ def parse_net_settings(settings_args):
settings_args.network_isolation)
settings.dump_bash()
+def parse_deploy_settings(settings_args):
+ settings = apex.DeploySettings(settings_args.path)
+ settings.dump_bash()
+
def find_ip(int_args):
interface = apex.ip_utils.get_interface(int_args.interface,
@@ -73,6 +76,12 @@ nic_template.add_argument('-af', '--address_family', type=int, default=4,
help='IP address family')
nic_template.set_defaults(func=build_nic_template)
+deploy_settings = subparsers.add_parser('parse-deploy-settings',
+ help='Parse deploy settings file')
+deploy_settings.add_argument('-f', '--path', default='deploy_settings.yaml',
+ help='path to deploy settings file')
+deploy_settings.set_defaults(func=parse_deploy_settings)
+
args = parser.parse_args(sys.argv[1:])
if args.DEBUG:
logging.basicConfig(level=logging.DEBUG)
diff --git a/lib/python/apex/__init__.py b/lib/python/apex/__init__.py
index 88b066b2..2efc64f4 100644
--- a/lib/python/apex/__init__.py
+++ b/lib/python/apex/__init__.py
@@ -9,3 +9,4 @@
from .net_env import NetworkSettings
+from .deploy_env import DeploySettings
diff --git a/lib/python/apex/deploy_env.py b/lib/python/apex/deploy_env.py
new file mode 100644
index 00000000..5c733248
--- /dev/null
+++ b/lib/python/apex/deploy_env.py
@@ -0,0 +1,149 @@
+##############################################################################
+# Copyright (c) 2016 Michael Chapman (michapma@redhat.com) and others.
+#
+# 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
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+import yaml
+import logging
+
+REQ_DEPLOY_SETTINGS = ['sdn_controller',
+ 'sdn_l3',
+ 'tacker',
+ 'congress',
+ 'sfc',
+ 'vpn']
+
+OPT_DEPLOY_SETTINGS = ['performance']
+
+VALID_ROLES = ['Controller', 'Compute', 'ObjectStorage']
+VALID_PERF_OPTS = ['kernel','nova']
+
+class DeploySettings:
+ """
+ This class parses a APEX deploy settings yaml file into an object
+
+ Currently the parsed object is dumped into a bash global definition file
+ for deploy.sh consumption. This object will later be used directly as
+ deployment script move to python.
+ """
+ def __init__(self, filename):
+ with open(filename, 'r') as settings_file:
+ self.deploy_settings = yaml.load(settings_file)
+ self._validate_settings()
+
+ def _validate_settings(self):
+ """
+ Validates the deploy settings file provided
+
+ DeploySettingsException will be raised if validation fails.
+ """
+
+ if 'deploy_options' not in self.deploy_settings:
+ raise DeploySettingsException("No deploy options provided in"
+ "deploy settings file")
+ if 'global_params' not in self.deploy_settings:
+ raise DeploySettingsException("No global options provided in"
+ "deploy settings file")
+
+ deploy_options = self.deploy_settings['deploy_options']
+ if not isinstance(deploy_options, dict):
+ raise DeploySettingsException("deploy_options should be a list")
+
+ for option in deploy_options:
+ if option not in REQ_DEPLOY_SETTINGS + OPT_DEPLOY_SETTINGS:
+ raise DeploySettingsException("Invalid deploy_option {} "
+ "specified".format(option))
+
+ for required_setting in REQ_DEPLOY_SETTINGS:
+ if required_setting not in deploy_options:
+ self.deploy_settings['deploy_options'][required] = False
+
+ if 'performance' in deploy_options:
+ if not isinstance(deploy_options['performance'], dict):
+ raise DeploySettingsException("Performance deploy_option"
+ "must be a dictionary.")
+ for role,role_perf_sets in deploy_options['performance'].items():
+ if role not in VALID_ROLES:
+ raise DeploySettingsException("Performance role {}"
+ "is not valid, choose"
+ "from {}".format(
+ role," ".join(VALID_ROLES)
+ ))
+
+ for key in role_perf_sets:
+ if key not in VALID_PERF_OPTS:
+ raise DeploySettingsException("Performance option {}"
+ "is not valid, choose"
+ "from {}".format(
+ key," ".join(
+ VALID_PERF_OPTS)))
+
+
+ def _dump_performance(self):
+ """
+ Creates performance settings string for bash consumption.
+
+ Output will be in the form of a list that can be iterated over in bash,
+ with each string being the direct input to the performance setting script
+ in the form <role> <category> <key> <value> to facilitate modification of the
+ correct image.
+ """
+ bash_str = 'performance_options=(\n'
+ for role,settings in self.deploy_settings['deploy_options']['performance'].items():
+ for category,options in settings.items():
+ for key,value in options.items():
+ bash_str += "\"{} {} {} {}\"\n".format(role, category, key, value)
+ bash_str += ')\n'
+ bash_str += '\n'
+ bash_str += 'performance_roles=(\n'
+ for role in self.deploy_settings['deploy_options']['performance']:
+ bash_str += role + '\n'
+ bash_str += ')\n'
+ bash_str += '\n'
+
+ return bash_str
+
+ def _dump_deploy_options_array(self):
+ """
+ Creates deploy settings array in bash syntax.
+ """
+ bash_str = ''
+ for key,value in self.deploy_settings['deploy_options'].items():
+ if not isinstance(value, bool):
+ bash_str += "deploy_options_array[{}]=\"{}\"\n".format(key, value)
+ else:
+ bash_str += "deploy_options_array[{}]={}\n".format(key, value)
+ return bash_str
+
+ def dump_bash(self, path=None):
+ """
+ Prints settings for bash consumption.
+
+ If optional path is provided, bash string will be written to the file
+ instead of stdout.
+ """
+ bash_str = ''
+ for key, value in self.deploy_settings['global_params'].items():
+ bash_str += "if [ -z \"$(eval echo \$${})\" ]; then\n{}={}\nfi\n".format(key,key, value)
+ if 'performance' in self.deploy_settings['deploy_options']:
+ bash_str += self._dump_performance()
+ bash_str += self._dump_deploy_options_array()
+
+ if path:
+ with open(path, 'w') as file:
+ file.write(bash_str)
+ else:
+ print(bash_str)
+
+
+class DeploySettingsException(Exception):
+ def __init__(self, value):
+ self.value = value
+
+ def __str__(self):
+ return self.value