From 839cc3c0c4d625a163c238e0c08b5540e4e2e1ab Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Wed, 21 Sep 2016 12:48:02 -0400 Subject: [PATCH] Fixes SFC OVS to be built in Apex Our kernel version is always updated in our build, causing static kmod builds for OVS to fail. This adds OVS NSH to Apex build process. JIRA: APEX-214 Change-Id: Ib071565d71c3471c2a03345b999adcad5af1962f Signed-off-by: Tim Rozet --- build/build_ovs_nsh.sh | 22 +++++++++++++++++++++ build/overcloud-full.sh | 39 +++++++++++++++++++++++++++++++++++++ build/overcloud-onos.sh | 8 ++------ build/overcloud-opendaylight-sfc.sh | 11 ++--------- build/variables.sh | 12 ++++++++++++ 5 files changed, 77 insertions(+), 15 deletions(-) create mode 100755 build/build_ovs_nsh.sh diff --git a/build/build_ovs_nsh.sh b/build/build_ovs_nsh.sh new file mode 100755 index 00000000..834df5bb --- /dev/null +++ b/build/build_ovs_nsh.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +############################################################################## +# Copyright (c) 2016 Tim Rozet (Red Hat) 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 +############################################################################## +set -e + +yum -y install rpm-build autoconf automake libtool systemd-units openssl openssl-devel python python-twisted-core python-zope-interface python-six desktop-file-utils groff graphviz procps-ng libcap-ng libcap-ng-devel PyQt4 selinux-policy-devel kernel-devel kernel-headers kernel-tools +./boot.sh +libtoolize --force +aclocal +autoheader +automake --force-missing --add-missing +autoconf +./configure +yum -y install rpmdevtools +make rpm-fedora RPMBUILD_OPT="\"-D kversion `rpm -q kernel | rpmdev-sort | tail -n -1 | sed 's/^kernel-//'`\" --without check" +make rpm-fedora-kmod RPMBUILD_OPT="\"-D kversion `rpm -q kernel | rpmdev-sort | tail -n -1 | sed 's/^kernel-//'`\"" diff --git a/build/overcloud-full.sh b/build/overcloud-full.sh index 21667070..88f96851 100755 --- a/build/overcloud-full.sh +++ b/build/overcloud-full.sh @@ -154,5 +154,44 @@ LIBGUESTFS_BACKEND=direct virt-customize \ --upload ../puppet-neutron/manifests/plugins/ml2/networking-vpp.pp:/etc/puppet/modules/neutron/manifests/plugins/ml2/ \ -a overcloud-full_build.qcow2 +rm -rf ovs_nsh_patches +rm -rf ovs +git clone https://github.com/yyang13/ovs_nsh_patches.git +git clone https://github.com/openvswitch/ovs.git +pushd ovs > /dev/null +git reset --hard 7d433ae57ebb90cd68e8fa948a096f619ac4e2d8 +cp ../ovs_nsh_patches/*.patch ./ +# Hack for build servers that have no git config +git config user.email "apex@opnfv.com" +git config user.name "apex" +git am *.patch +popd > /dev/null +tar czf ovs.tar.gz ovs + +# Required packages to redirect stdin with virt-customize +virt_pkg_str="./$libguestfs_pkg " +wget $virt_uri_base/$libguestfs_pkg +for package in ${virt_pkgs[@]}; do + wget "$virt_uri_base/$package" + virt_pkg_str+=" ./$package" +done + +if ! sudo yum -y install ${virt_pkg_str}; then + if [ "$(rpm -q libguestfs)" != "$(rpm -qpf $libguestfs_pkg)" ]; then + echo "ERROR: Failed to update libguestfs" + exit 1 + fi +fi + + + +# BUILD NSH OVS +LIBGUESTFS_BACKEND=direct virt-customize \ + --upload ../build_ovs_nsh.sh:/root/ \ + --upload ovs.tar.gz:/root/ \ + --run-command "cd /root/ && tar xzf ovs.tar.gz" \ + --run-command "cd /root/ovs && /root/build_ovs_nsh.sh" \ + -a overcloud-full_build.qcow2 + mv -f overcloud-full_build.qcow2 overcloud-full.qcow2 popd > /dev/null diff --git a/build/overcloud-onos.sh b/build/overcloud-onos.sh index 7b5e3df7..b695983a 100755 --- a/build/overcloud-onos.sh +++ b/build/overcloud-onos.sh @@ -19,12 +19,8 @@ cp -f overcloud-full.qcow2 overcloud-full-onos_build.qcow2 ####################################### # upgrade ovs into ovs 2.5.90 with NSH function -curl -L -O ${onos_ovs_uri}/${onos_ovs_pkg} -tar -xzf ${onos_ovs_pkg} -LIBGUESTFS_BACKEND=direct virt-customize --upload ${ovs_kmod_rpm_name}:/root/ \ - --run-command "yum install -y /root/${ovs_kmod_rpm_name}" \ - --upload ${ovs_rpm_name}:/root/ \ - --run-command "yum upgrade -y /root/${ovs_rpm_name}" \ +LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum install -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_kmod_rpm_name}" \ + --run-command "yum upgrade -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_rpm_name}" \ -a overcloud-full-onos_build.qcow2 diff --git a/build/overcloud-opendaylight-sfc.sh b/build/overcloud-opendaylight-sfc.sh index 612f483d..444d284a 100755 --- a/build/overcloud-opendaylight-sfc.sh +++ b/build/overcloud-opendaylight-sfc.sh @@ -19,15 +19,8 @@ pushd images > /dev/null cp -f overcloud-full-opendaylight.qcow2 overcloud-full-opendaylight-sfc_build.qcow2 # upgrade ovs into ovs 2.5.90 with NSH function -if ! [[ -f "$ovs_rpm_name" && -f "$ovs_kmod_rpm_name" ]]; then - curl -L -O ${onos_ovs_uri}/${onos_ovs_pkg} - tar -xzf ${onos_ovs_pkg} -fi - -LIBGUESTFS_BACKEND=direct virt-customize --upload ${ovs_kmod_rpm_name}:/root/ \ - --run-command "yum install -y /root/${ovs_kmod_rpm_name}" \ - --upload ${ovs_rpm_name}:/root/ \ - --run-command "yum upgrade -y /root/${ovs_rpm_name}" \ +LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum install -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_kmod_rpm_name}" \ + --run-command "yum upgrade -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_rpm_name}" \ -a overcloud-full-opendaylight-sfc_build.qcow2 mv overcloud-full-opendaylight-sfc_build.qcow2 overcloud-full-opendaylight-sfc.qcow2 diff --git a/build/variables.sh b/build/variables.sh index 990ac836..0308580d 100644 --- a/build/variables.sh +++ b/build/variables.sh @@ -39,3 +39,15 @@ honeycomb_pkg='honeycomb-1.0.0-1609.noarch.rpm' ovs_rpm_name=openvswitch-2.5.90-1.el7.centos.x86_64.rpm ovs_kmod_rpm_name=openvswitch-kmod-2.5.90-1.el7.centos.x86_64.rpm + +virt_uri_base=https://people.redhat.com/~rjones/libguestfs-RHEL-7.3-preview +libguestfs_pkg='libguestfs-1.32.7-3.el7.x86_64.rpm' +virt_pkgs=( +'libguestfs-tools-1.32.7-3.el7.noarch.rpm' +'libguestfs-tools-c-1.32.7-3.el7.x86_64.rpm' +'supermin-5.1.16-4.el7.x86_64.rpm' +'supermin5-5.1.16-4.el7.x86_64.rpm' +'supermin-helper-5.1.16-4.el7.x86_64.rpm' +'perl-Sys-Guestfs-1.32.7-3.el7.x86_64.rpm' +'python-libguestfs-1.32.7-3.el7.x86_64.rpm' +) -- 2.16.6