ODL: Rework opnfv-quagga building/packaging. 61/16361/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sun, 3 Jul 2016 12:59:04 +0000 (14:59 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Tue, 5 Jul 2016 10:57:26 +0000 (12:57 +0200)
My initial goal was to split the ODL patch in two patches:
- leveldb + leveldbjni arm64 support;
- opnfv-quagga building/packing for multiple archs (UBUNTU_ARCH);

However, due to the design of opnfv-packaging repo, it is easier to:
- patch upstream sources to support native arm64 builds (see [1]);
- add prebuilt arm64 binaries to output dir in git repo (like amd64),
submitted as pull request upstream [2];

Until above OPNFV-QUAGGA changes land upstream or are refactored,
rely on forked repository that contains above patches [3] on
branch "stable/colorado".

opnfv-quagga patch adding UBUNTU_ARCH parsing is more or less there
to detect missing DEBs, rather than filter prebuilt DEBs, which for
now only cover "amd64 arm64".

[1] https://github.com/nikolas-hermanns/opnfv-quagga-packaging/pull/1
[2] https://github.com/nikolas-hermanns/opnfv-quagga-packaging/pull/2
[3] https://github.com/alexandruavadanii/opnfv-quagga-packaging

Change-Id: I022c1e82531d82422486f2041c70a3f50b6ca386
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Makefile
patches/fuel-plugin-opendaylight/0001-ODL-leveldb-leveldbjni-Enable-arm64-support.patch [moved from patches/fuel-plugin-opendaylight/0001-arm64-support-for-OpenDaylight-Fuel-Plugin.patch with 89% similarity]
patches/fuel-plugin-opendaylight/0002-opnfv-quagga-Build-for-UBUNTU_ARCH.patch [new file with mode: 0644]

index e01517d..b38b614 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -65,20 +65,21 @@ build:
                        BUILD_FUEL_PLUGINS=f_odlpluginbuild \
                        UBUNTU_ARCH="amd64 arm64" \
                        FUELLIB_REPO=${root}/upstream/fuel-library \
+                       FUELLIB_COMMIT=HEAD \
                        NAILGUN_REPO=${root}/upstream/fuel-web \
+                       NAILGUN_COMMIT=HEAD \
                        FUEL_AGENT_REPO=${root}/upstream/fuel-agent \
+                       FUEL_AGENT_COMMIT=HEAD \
                        FUEL_NAILGUN_AGENT_REPO=${root}/upstream/fuel-nailgun-agent \
+                       FUEL_NAILGUN_AGENT_COMMIT=HEAD \
                        FUEL_MIRROR_REPO=${root}/upstream/fuel-mirror \
+                       FUEL_MIRROR_COMMIT=HEAD \
                        ODL_REPO=${root}/upstream/fuel-plugin-opendaylight \
+                       ODL_BRANCH=armband-workbench \
                        ODL_CHANGE= \
+                       OPNFV_QUAGGE_PACKAGING_REPO="https://github.com/alexandruavadanii/opnfv-quagga-packaging" \
                        OVS_NSH_DPDK_REPO=${root}/upstream/fuel-plugin-ovs \
                        OVS_NSH_DPDK_BRANCH=HEAD \
-                       FUELLIB_COMMIT=HEAD \
-                       NAILGUN_COMMIT=HEAD \
-                       FUEL_AGENT_COMMIT=HEAD \
-                       FUEL_NAILGUN_AGENT_COMMIT=HEAD \
-                       FUEL_MIRROR_COMMIT=HEAD \
-                       ODL_BRANCH=armband-workbench \
                        VSPERF_REPO=${root}/upstream/vswitchperf \
                        VSPERF_BRANCH=armband-workbench \
                        VSPERF_CHANGE= \
@@ -87,7 +88,6 @@ build:
                        YARDSTICK_CHANGE= \
                        EXTRA_RPM_REPOS="armband,http://linux.enea.com/mos-repos/centos/mos9.0-centos7/armband/x86_64,10" \
                        MIRROR_MOS_UBUNTU=linux.enea.com \
-                       JAVA8_URL=https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+files/openjdk-8-jre-headless_8u72-b15-1~trusty1_arm64.deb \
                        $(EXTRA_PARAMS) \
                        iso 2>&1 | tee ${root}/build.log
 
@@ -1,14 +1,19 @@
 From: Florin Dumitrascu <florin.dumitrascu@enea.com>
 Date: Thu, 17 Mar 2016 18:15:42 +0100
-Subject: [PATCH] arm64 support for OpenDaylight Fuel Plugin
+Subject: [PATCH] ODL leveldb, leveldbjni: Enable arm64 support.
 
 ODL depends on a native library (leveldb).
-ODL Beryllium version is still using a native x86 version of
-this library (wrapped in leveldbjni). There is no upstream version
-of leveldbjni supporting arm64 leveldb, so we need to compile it
-when deploying ODL. This is done when running odl-install puppet manifest.
-For more info about this ODL limitation, read here:
-https://bugs.opendaylight.org/show_bug.cgi?id=3973
+
+ODL Beryllium and Boron versions are still using a native x86 version
+of this library (wrapped in leveldbjni).
+
+There is no upstream version of leveldbjni supporting arm64 leveldb,
+so we need to compile it when deploying ODL.
+This is done when running odl-install puppet manifest.
+
+For more info about this ODL limitation, see [1].
+
+[1] https://bugs.opendaylight.org/show_bug.cgi?id=3973
 
 [ Alexandru.Avadanii@enea.com ]
 Remove JAVA8 changes after upstream rework.
@@ -23,8 +28,7 @@ Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
  .../modules/opendaylight/manifests/install.pp      |  12 +-
  .../modules/opendaylight/manifests/leveldbjni.pp   | 150 +++++++++++++++++++++
  deployment_tasks.yaml                              |   2 +-
- pre_build_hook                                     |   7 +-
- 8 files changed, 233 insertions(+), 8 deletions(-)
+ 6 files changed, 227 insertions(+), 3 deletions(-)
  create mode 100644 deployment_scripts/puppet/modules/opendaylight/files/leveldb-arm64.patch
  create mode 100644 deployment_scripts/puppet/modules/opendaylight/files/leveldbjni-native.patch
  create mode 100644 deployment_scripts/puppet/modules/opendaylight/manifests/leveldbjni.pp
@@ -100,10 +104,10 @@ index 0000000..08a528b
 +          </instructions>
 +         </configuration>
 diff --git a/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp b/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp
-index 69cc23a..791ceba 100644
+index a322f70..f71bfc8 100644
 --- a/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp
 +++ b/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp
-@@ -9,4 +9,12 @@ class opendaylight {
+@@ -10,4 +10,12 @@ class opendaylight {
    $odl_mgmt_ips = values($odl_mgmt_ips_hash)
    $odl_nodes_names = keys($odl_mgmt_ips_hash)
    $node_internal_address = $odl_mgmt_ips_hash["node-${node_uid}"]
@@ -117,10 +121,10 @@ index 69cc23a..791ceba 100644
 +  }
  }
 diff --git a/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp b/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp
-index b229757..0979d86 100644
+index 924a840..d55a311 100644
 --- a/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp
 +++ b/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp
-@@ -18,6 +18,12 @@ class opendaylight::install (
+@@ -17,6 +17,12 @@ class opendaylight::install (
      ensure  => installed,
    }
  
@@ -130,9 +134,9 @@ index b229757..0979d86 100644
 +    }
 +  }
 +
-   package {'opnfv-quagga':
-     ensure => installed,
-   }
+   # quagga
+   class { 'opendaylight::quagga':
+     before => Service['opendaylight']
 @@ -35,7 +41,8 @@ class opendaylight::install (
  
    debug("Set odl rest api port to ${rest_port}")
@@ -154,7 +158,7 @@ index b229757..0979d86 100644
  }
 diff --git a/deployment_scripts/puppet/modules/opendaylight/manifests/leveldbjni.pp b/deployment_scripts/puppet/modules/opendaylight/manifests/leveldbjni.pp
 new file mode 100644
-index 0000000..c599370
+index 0000000..5125fc7
 --- /dev/null
 +++ b/deployment_scripts/puppet/modules/opendaylight/manifests/leveldbjni.pp
 @@ -0,0 +1,150 @@
@@ -321,16 +325,3 @@ index 3706678..841bfee 100644
  - id: netconfig
    type: puppet
    version: 2.0.0
-diff --git a/pre_build_hook b/pre_build_hook
-index c37da5d..6f4a917 100755
---- a/pre_build_hook
-+++ b/pre_build_hook
-@@ -192,6 +192,7 @@ function build_pkg {
-       fpm --architecture all --force -s python -t deb -m 'mskalski@mirantis.com' --python-install-lib /usr/lib/python2.7/dist-packages ${TMP_DIR}/networking_odl/setup.py
-       popd
--      add_opnfv_quagga "${DIR}/repositories/${1}/"
-+      # We are adding arm64 opnfv quagga in our local repository
-+      #add_opnfv_quagga "${DIR}/repositories/${1}/"
-       ;;
-     *) echo "Not supported system"; exit 1;;
-   esac
diff --git a/patches/fuel-plugin-opendaylight/0002-opnfv-quagga-Build-for-UBUNTU_ARCH.patch b/patches/fuel-plugin-opendaylight/0002-opnfv-quagga-Build-for-UBUNTU_ARCH.patch
new file mode 100644 (file)
index 0000000..a44222a
--- /dev/null
@@ -0,0 +1,70 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Mon, 4 Jul 2016 20:44:49 +0200
+Subject: [PATCH] opnfv-quagga: Build for UBUNTU_ARCH.
+
+ODL itself is mostly arch-indep, but its deps (e.g. opnfv-quagga
+and friends) are not.
+
+Introduce opnfv-quagga building/packing for multiple archs, listed
+in UBUNTU_ARCH, which holds a space-separated list of target
+arch(s), represented in `dpkg --print-architecture` format.
+Only applicable when "BUILD_FOR=ubuntu".
+
+FIXME(armband): For now, only native building and prebuilt debs
+are supported (no cross-building).
+
+Due to the design of opnfv-packaging repo, it is easier to:
+- patch upstream sources to support native arm64 builds (see [1]);
+- add prebuilt arm64 binaries to output dir in git repo (like amd64),
+submitted as pull request upstream [2];
+
+Until above OPNFV-QUAGGA changes land upstream and/or are refactored,
+rely on forked repository that contains above patches [3] on
+branch "stable/colorado", including prebuilt binaries (DEBs) for:
+- amd64 (also available in upstream repo);
+- arm64 (submitted upstream in [3]);
+
+[1] https://github.com/nikolas-hermanns/opnfv-quagga-packaging/pull/1
+[2] https://github.com/nikolas-hermanns/opnfv-quagga-packaging/pull/2
+[3] https://github.com/alexandruavadanii/opnfv-quagga-packaging
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ pre_build_hook | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/pre_build_hook b/pre_build_hook
+index f973826..953e66c 100755
+--- a/pre_build_hook
++++ b/pre_build_hook
+@@ -41,9 +41,17 @@ NETWORKING_ODL_BRANCH=${NETWORKING_ODL_BRANCH:-stable/mitaka}
+ OPNFV_QUAGGE_PACKAGING_REPO=${OPNFV_QUAGGE_PACKAGING_REPO:-https://github.com/nikolas-hermanns/opnfv-quagga-packaging}
+ OPNFV_QUAGGE_PACKAGING_BRANCH=stable/colorado
+-# For which systems odl package should be build
++# For which systems odl package should be built
+ BUILD_FOR=${BUILD_FOR:-ubuntu}
++# For which architecture(s) package should be built
++# Only applicable when "BUILD_FOR=ubuntu"
++# ODL itself is mostly arch-indep, but its deps are not
++# All archs should be represented in `dpkg --print-architecture` format
++# UBUNTU_ARCH holds a space-separated list of target arch(s)
++# FIXME(armband): For now, only native building is supported!
++UBUNTU_ARCH=${UBUNTU_ARCH:-$(dpkg --print-architecture)}
++
+ DIR="$(dirname `readlink -f $0`)"
+ TMP_DIR="${DIR}/tmp"
+ MODULES="${DIR}/deployment_scripts/puppet/modules"
+@@ -74,7 +82,10 @@ function add_opnfv_quagga {
+                 sudo apt-get -y install `cat requirements.txt`
+                 make -j6
+             fi
+-            cp debian_package/* $path
++            # Filter only requested archs, bail on missing DEBs
++            for ARCH in ${UBUNTU_ARCH}; do
++                cp debian_package/*_${ARCH}.deb $path
++            done
+         popd
+     popd