Fixes SFC OVS to be built in Apex 55/22255/6
authorTim Rozet <trozet@redhat.com>
Wed, 21 Sep 2016 16:48:02 +0000 (12:48 -0400)
committerFeng Pan <fpan@redhat.com>
Wed, 21 Sep 2016 21:32:13 +0000 (17:32 -0400)
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 <trozet@redhat.com>
build/build_ovs_nsh.sh [new file with mode: 0755]
build/overcloud-full.sh
build/overcloud-onos.sh
build/overcloud-opendaylight-sfc.sh
build/variables.sh

diff --git a/build/build_ovs_nsh.sh b/build/build_ovs_nsh.sh
new file mode 100755 (executable)
index 0000000..834df5b
--- /dev/null
@@ -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-//'`\""
index 2166707..88f9685 100755 (executable)
@@ -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
index 7b5e3df..b695983 100755 (executable)
@@ -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
 
 
index 612f483..444d284 100755 (executable)
@@ -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
index 990ac83..0308580 100644 (file)
@@ -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'
+)