From f90ee3550bf6e78e8afed67de9b682023eba6af4 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sun, 3 Jul 2016 14:59:04 +0200 Subject: ODL: Rework opnfv-quagga building/packaging. 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 --- Makefile | 14 +- ...L-leveldb-leveldbjni-Enable-arm64-support.patch | 327 ++++++++++++++++++++ ...rm64-support-for-OpenDaylight-Fuel-Plugin.patch | 336 --------------------- .../0002-opnfv-quagga-Build-for-UBUNTU_ARCH.patch | 70 +++++ 4 files changed, 404 insertions(+), 343 deletions(-) create mode 100644 patches/fuel-plugin-opendaylight/0001-ODL-leveldb-leveldbjni-Enable-arm64-support.patch delete mode 100644 patches/fuel-plugin-opendaylight/0001-arm64-support-for-OpenDaylight-Fuel-Plugin.patch create mode 100644 patches/fuel-plugin-opendaylight/0002-opnfv-quagga-Build-for-UBUNTU_ARCH.patch diff --git a/Makefile b/Makefile index e01517d3..b38b6144 100644 --- 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 diff --git a/patches/fuel-plugin-opendaylight/0001-ODL-leveldb-leveldbjni-Enable-arm64-support.patch b/patches/fuel-plugin-opendaylight/0001-ODL-leveldb-leveldbjni-Enable-arm64-support.patch new file mode 100644 index 00000000..6bf549fc --- /dev/null +++ b/patches/fuel-plugin-opendaylight/0001-ODL-leveldb-leveldbjni-Enable-arm64-support.patch @@ -0,0 +1,327 @@ +From: Florin Dumitrascu +Date: Thu, 17 Mar 2016 18:15:42 +0100 +Subject: [PATCH] ODL leveldb, leveldbjni: Enable arm64 support. + +ODL depends on a native library (leveldb). + +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. + +Signed-off-by: Florin Dumitrascu +Signed-off-by: Stanislaw Kardach +Signed-off-by: Alexandru Avadanii +--- + .../modules/opendaylight/files/leveldb-arm64.patch | 35 +++++ + .../opendaylight/files/leveldbjni-native.patch | 23 ++++ + .../puppet/modules/opendaylight/manifests/init.pp | 8 ++ + .../modules/opendaylight/manifests/install.pp | 12 +- + .../modules/opendaylight/manifests/leveldbjni.pp | 150 +++++++++++++++++++++ + deployment_tasks.yaml | 2 +- + 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 + +diff --git a/deployment_scripts/puppet/modules/opendaylight/files/leveldb-arm64.patch b/deployment_scripts/puppet/modules/opendaylight/files/leveldb-arm64.patch +new file mode 100644 +index 0000000..e0824ca +--- /dev/null ++++ b/deployment_scripts/puppet/modules/opendaylight/files/leveldb-arm64.patch +@@ -0,0 +1,35 @@ ++diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h ++index e17bf43..78cb6b3 100644 ++--- a/port/atomic_pointer.h +++++ b/port/atomic_pointer.h ++@@ -36,6 +36,8 @@ ++ #define ARCH_CPU_X86_FAMILY 1 ++ #elif defined(__ARMEL__) ++ #define ARCH_CPU_ARM_FAMILY 1 +++#elif defined(__aarch64__) +++#define ARCH_CPU_ARM64_FAMILY 1 ++ #elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) ++ #define ARCH_CPU_PPC_FAMILY 1 ++ #endif ++@@ -93,6 +95,13 @@ inline void MemoryBarrier() { ++ } ++ #define LEVELDB_HAVE_MEMORY_BARRIER ++ +++// ARM64 +++#elif defined(ARCH_CPU_ARM64_FAMILY) +++inline void MemoryBarrier() { +++ asm volatile("dmb sy" : : : "memory"); +++} +++#define LEVELDB_HAVE_MEMORY_BARRIER +++ ++ // PPC ++ #elif defined(ARCH_CPU_PPC_FAMILY) && defined(__GNUC__) ++ inline void MemoryBarrier() { ++@@ -216,6 +225,7 @@ class AtomicPointer { ++ #undef LEVELDB_HAVE_MEMORY_BARRIER ++ #undef ARCH_CPU_X86_FAMILY ++ #undef ARCH_CPU_ARM_FAMILY +++#undef ARCH_CPU_ARM64_FAMILY ++ #undef ARCH_CPU_PPC_FAMILY ++ ++ } // namespace port +diff --git a/deployment_scripts/puppet/modules/opendaylight/files/leveldbjni-native.patch b/deployment_scripts/puppet/modules/opendaylight/files/leveldbjni-native.patch +new file mode 100644 +index 0000000..08a528b +--- /dev/null ++++ b/deployment_scripts/puppet/modules/opendaylight/files/leveldbjni-native.patch +@@ -0,0 +1,23 @@ ++diff --git a/leveldbjni-all/pom.xml b/leveldbjni-all/pom.xml ++index 426f2a6..c4a2a16 100755 ++--- a/leveldbjni-all/pom.xml +++++ b/leveldbjni-all/pom.xml ++@@ -41,7 +41,7 @@ ++ ++ org.fusesource.leveldbjni ++ leveldbjni-all ++- 1.8 +++ 1.8-odl ++ bundle ++ ++ ${project.artifactId} ++@@ -119,7 +119,8 @@ ++ META-INF/native/osx/libleveldbjni.jnilib;osname=macosx;processor=x86, ++ META-INF/native/osx/libleveldbjni.jnilib;osname=macosx;processor=x86-64, ++ META-INF/native/linux32/libleveldbjni.so;osname=Linux;processor=x86, ++- META-INF/native/linux64/libleveldbjni.so;osname=Linux;processor=x86-64 +++ META-INF/native/linux64/libleveldbjni.so;osname=Linux;processor=x86-64, +++ META-INF/native/linux64/libleveldbjni.so;osname=Linux;processor=aarch64 ++ ++ ++ +diff --git a/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp b/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp +index a322f70..f71bfc8 100644 +--- a/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp ++++ b/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp +@@ -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}"] ++ ++ $arch = $::architecture ? { ++ 'aarch64' => $::osfamily ? { ++ 'Debian' => 'arm64', ++ default => 'aarch64', ++ }, ++ default => $::architecture, ++ } + } +diff --git a/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp b/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp +index 924a840..d55a311 100644 +--- a/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp ++++ b/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp +@@ -17,6 +17,12 @@ class opendaylight::install ( + ensure => installed, + } + ++ if ($::osfamily == 'Debian' and $::opendaylight::arch == 'arm64') { ++ class { 'opendaylight::leveldbjni': ++ require => Package['opendaylight'], ++ } ++ } ++ + # quagga + class { 'opendaylight::quagga': + before => Service['opendaylight'] +@@ -35,7 +41,8 @@ class opendaylight::install ( + + debug("Set odl rest api port to ${rest_port}") + +- file { "${conf_dir}/jetty.xml": ++ file { 'jetty.xml': ++ path => "${conf_dir}/jetty.xml", + ensure => file, + owner => 'odl', + content => template('opendaylight/jetty.xml.erb') +@@ -71,6 +78,7 @@ class opendaylight::install ( + Package[$odl_package] -> + Ini_setting <||> -> + Firewall <||> -> +- File <||> -> ++ File['jetty.xml'] -> ++ Class['opendaylight::leveldbjni'] -> + Service['opendaylight'] + } +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..5125fc7 +--- /dev/null ++++ b/deployment_scripts/puppet/modules/opendaylight/manifests/leveldbjni.pp +@@ -0,0 +1,150 @@ ++# == Class opendaylight::leveldbjni ++# ++# Manages compilation of JNI for leveldb. ++# ++# It compiles the leveldbjni from sources and patches it so that it's properly ++# detected by maven on arm64 system. ++# ++class opendaylight::leveldbjni( ++ $target = '/opt/opendaylight', ++ $user = 'odl', ++ $branch = 'leveldbjni-1.8', ++) { ++ case $::osfamily { ++ 'Debian', 'Ubuntu': {} ++ default: { ++ fail('Not supported on OS other than Debian based.') ++ } ++ } ++ ++ $libsnappy_dir = '/usr/lib' ++ $leveldb_dir = "${target}/leveldb" ++ $leveldbjni_dir = "${target}/leveldbjni" ++ $environment = ["SNAPPY_HOME=${libsnappy_dir}", "LEVELDB_HOME=${leveldb_dir}", "LEVELDBJNI_HOME=${leveldbjni_dir}", "LIBRARY_PATH=${libsnappy_dir}", "C_INCLUDE_PATH=${libsnappy_dir}", "CPLUS_INCLUDE_PATH=${libsnappy_dir}","JAVA_HOME=/usr/lib/jvm/java-8-openjdk-${::opendaylight::arch}"] ++ $parallel_jobs = ($processorcount + 1)/2 ++ ++ if ! defined(Package['git']) { ++ package { 'git': ++ ensure => 'present', ++ } ++ } ++ if ! defined(Package['build-essential']) { ++ package { 'build-essential': ++ ensure => 'present', ++ } ++ } ++ if ! defined(Package['automake']) { ++ package { 'automake': ++ ensure => 'present', ++ } ++ } ++ if ! defined(Package['make']) { ++ package { 'make': ++ ensure => 'present', ++ } ++ } ++ if ! defined(Package['libsnappy-dev']) { ++ package { 'libsnappy-dev': ++ ensure => 'present', ++ } ++ } ++ if ! defined(Package['patch']) { ++ package { 'patch': ++ ensure => 'present', ++ } ++ } ++ if ! defined(Package['maven']) { ++ package { 'maven': ++ ensure => 'present', ++ } ++ } ++ if ! defined(Package['openjdk-8-jdk']) { ++ package { 'openjdk-8-jdk': ++ ensure => 'present', ++ } ++ } ++ ++ exec { 'leveldb-fetch': ++ path => ['/usr/bin'], ++ command => "git clone git://github.com/chirino/leveldb.git ${leveldb_dir}", ++ creates => "${leveldb_dir}/.git", ++ user => $user, ++ require => [Package['git']], ++ } -> ++ exec { 'leveldbjni-fetch': ++ path => ['/usr/bin'], ++ command => "git clone https://github.com/fusesource/leveldbjni.git -b ${branch} ${leveldbjni_dir}", ++ creates => "${leveldbjni_dir}/.git", ++ user => $user, ++ require => [Package['git']], ++ } -> ++ exec { 'leveldb-merge-google': ++ path => ['/usr/bin', '/bin'], ++ command => "git config user.name odl && git config user.email 'o@d.l' && git remote add google https://github.com/google/leveldb.git && git fetch google master && git fetch --tags google && git merge --no-edit v1.18", ++ unless => "git remote | grep google", ++ cwd => $leveldb_dir, ++ user => $user, ++ require => [Package['git']], ++ } -> ++ exec { 'leveldb-patch': ++ path => ['/usr/bin'], ++ command => "patch -p1 < ${leveldbjni_dir}/leveldb.patch", ++ unless => "patch -p1 -R -N --dry-run < ${leveldbjni_dir}/leveldb.patch", ++ cwd => $leveldb_dir, ++ user => $user, ++ require => [Package['patch']], ++ } -> ++ file { "${leveldb_dir}/leveldb-arm64.patch": ++ ensure => "file", ++ source => "puppet:///modules/opendaylight/leveldb-arm64.patch", ++ owner => $user, ++ } -> ++ exec { 'leveldb-patch-for-arm64': ++ path => ['/usr/bin'], ++ command => "patch -p1 < ${leveldb_dir}/leveldb-arm64.patch", ++ unless => "patch -p1 -R -N --dry-run < ${leveldb_dir}/leveldb-arm64.patch", ++ cwd => $leveldb_dir, ++ user => $user, ++ require => [Package['patch']], ++ } -> ++ exec { 'leveldb-build': ++ command => "/usr/bin/make libleveldb.a -j${parallel_jobs}", ++ creates => "${leveldb_dir}/libleveldb.a", ++ environment => $environment, ++ cwd => $leveldb_dir, ++ user => $user, ++ require => [Package['git'], Package['make'], Package['build-essential']], ++ } -> ++ file { "${leveldbjni_dir}/leveldbjni.patch": ++ ensure => "file", ++ source => "puppet:///modules/opendaylight/leveldbjni-native.patch", ++ owner => $user, ++ } -> ++ exec { 'leveldbjni-patch': ++ path => ['/usr/bin'], ++ command => "patch -p1 < ${leveldbjni_dir}/leveldbjni.patch", ++ unless => "patch -p1 -R -N --dry-run < ${leveldbjni_dir}/leveldbjni.patch", ++ cwd => $leveldbjni_dir, ++ user => $user, ++ require => [Package['patch']], ++ } -> ++ exec { 'leveldbjni-build': ++ command => "/usr/bin/mvn clean install -P download -P linux64 -P all", ++ # Creates requires a fully qualified path which we don't have ++ unless => "/usr/bin/test -d ~${user}/.m2/repository/org/fusesource/leveldbjni/leveldbjni-all", ++ environment => $environment, ++ cwd => $leveldbjni_dir, ++ user => $user, ++ timeout => 1200, ++ require => [Package['maven']], ++ } -> ++ # Can't do this with 'file' type because we need to purge existing package ++ # and at the same time don't perform the copy if we've already copied our ++ # package. ++ exec { 'leveldbjni-copy': ++ path => ['/bin'], ++ command => "rm -rf ${target}/system/org/fusesource/leveldbjni && cp -r ~${user}/.m2/repository/org/fusesource/leveldbjni $target/system/org/fusesource/", ++ creates => "${target}/system/org/fusesource/leveldbjni/leveldbjni-linux64", ++ user => $user, ++ } ++} +diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml +index 3706678..841bfee 100644 +--- a/deployment_tasks.yaml ++++ b/deployment_tasks.yaml +@@ -17,7 +17,7 @@ + parameters: + puppet_manifest: puppet/manifests/odl-install.pp + puppet_modules: puppet/modules:/etc/puppet/modules +- timeout: 720 ++ timeout: 3600 + - id: netconfig + type: puppet + version: 2.0.0 diff --git a/patches/fuel-plugin-opendaylight/0001-arm64-support-for-OpenDaylight-Fuel-Plugin.patch b/patches/fuel-plugin-opendaylight/0001-arm64-support-for-OpenDaylight-Fuel-Plugin.patch deleted file mode 100644 index 029e9790..00000000 --- a/patches/fuel-plugin-opendaylight/0001-arm64-support-for-OpenDaylight-Fuel-Plugin.patch +++ /dev/null @@ -1,336 +0,0 @@ -From: Florin Dumitrascu -Date: Thu, 17 Mar 2016 18:15:42 +0100 -Subject: [PATCH] arm64 support for OpenDaylight Fuel Plugin - -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 - -[ Alexandru.Avadanii@enea.com ] -Remove JAVA8 changes after upstream rework. - -Signed-off-by: Florin Dumitrascu -Signed-off-by: Stanislaw Kardach -Signed-off-by: Alexandru Avadanii ---- - .../modules/opendaylight/files/leveldb-arm64.patch | 35 +++++ - .../opendaylight/files/leveldbjni-native.patch | 23 ++++ - .../puppet/modules/opendaylight/manifests/init.pp | 8 ++ - .../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(-) - 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 - -diff --git a/deployment_scripts/puppet/modules/opendaylight/files/leveldb-arm64.patch b/deployment_scripts/puppet/modules/opendaylight/files/leveldb-arm64.patch -new file mode 100644 -index 0000000..e0824ca ---- /dev/null -+++ b/deployment_scripts/puppet/modules/opendaylight/files/leveldb-arm64.patch -@@ -0,0 +1,35 @@ -+diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h -+index e17bf43..78cb6b3 100644 -+--- a/port/atomic_pointer.h -++++ b/port/atomic_pointer.h -+@@ -36,6 +36,8 @@ -+ #define ARCH_CPU_X86_FAMILY 1 -+ #elif defined(__ARMEL__) -+ #define ARCH_CPU_ARM_FAMILY 1 -++#elif defined(__aarch64__) -++#define ARCH_CPU_ARM64_FAMILY 1 -+ #elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) -+ #define ARCH_CPU_PPC_FAMILY 1 -+ #endif -+@@ -93,6 +95,13 @@ inline void MemoryBarrier() { -+ } -+ #define LEVELDB_HAVE_MEMORY_BARRIER -+ -++// ARM64 -++#elif defined(ARCH_CPU_ARM64_FAMILY) -++inline void MemoryBarrier() { -++ asm volatile("dmb sy" : : : "memory"); -++} -++#define LEVELDB_HAVE_MEMORY_BARRIER -++ -+ // PPC -+ #elif defined(ARCH_CPU_PPC_FAMILY) && defined(__GNUC__) -+ inline void MemoryBarrier() { -+@@ -216,6 +225,7 @@ class AtomicPointer { -+ #undef LEVELDB_HAVE_MEMORY_BARRIER -+ #undef ARCH_CPU_X86_FAMILY -+ #undef ARCH_CPU_ARM_FAMILY -++#undef ARCH_CPU_ARM64_FAMILY -+ #undef ARCH_CPU_PPC_FAMILY -+ -+ } // namespace port -diff --git a/deployment_scripts/puppet/modules/opendaylight/files/leveldbjni-native.patch b/deployment_scripts/puppet/modules/opendaylight/files/leveldbjni-native.patch -new file mode 100644 -index 0000000..08a528b ---- /dev/null -+++ b/deployment_scripts/puppet/modules/opendaylight/files/leveldbjni-native.patch -@@ -0,0 +1,23 @@ -+diff --git a/leveldbjni-all/pom.xml b/leveldbjni-all/pom.xml -+index 426f2a6..c4a2a16 100755 -+--- a/leveldbjni-all/pom.xml -++++ b/leveldbjni-all/pom.xml -+@@ -41,7 +41,7 @@ -+ -+ org.fusesource.leveldbjni -+ leveldbjni-all -+- 1.8 -++ 1.8-odl -+ bundle -+ -+ ${project.artifactId} -+@@ -119,7 +119,8 @@ -+ META-INF/native/osx/libleveldbjni.jnilib;osname=macosx;processor=x86, -+ META-INF/native/osx/libleveldbjni.jnilib;osname=macosx;processor=x86-64, -+ META-INF/native/linux32/libleveldbjni.so;osname=Linux;processor=x86, -+- META-INF/native/linux64/libleveldbjni.so;osname=Linux;processor=x86-64 -++ META-INF/native/linux64/libleveldbjni.so;osname=Linux;processor=x86-64, -++ META-INF/native/linux64/libleveldbjni.so;osname=Linux;processor=aarch64 -+ -+ -+ -diff --git a/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp b/deployment_scripts/puppet/modules/opendaylight/manifests/init.pp -index 69cc23a..791ceba 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 { - $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}"] -+ -+ $arch = $::architecture ? { -+ 'aarch64' => $::osfamily ? { -+ 'Debian' => 'arm64', -+ default => 'aarch64', -+ }, -+ default => $::architecture, -+ } - } -diff --git a/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp b/deployment_scripts/puppet/modules/opendaylight/manifests/install.pp -index b229757..0979d86 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 ( - ensure => installed, - } - -+ if ($::osfamily == 'Debian' and $::opendaylight::arch == 'arm64') { -+ class { 'opendaylight::leveldbjni': -+ require => Package['opendaylight'], -+ } -+ } -+ - package {'opnfv-quagga': - ensure => installed, - } -@@ -35,7 +41,8 @@ class opendaylight::install ( - - debug("Set odl rest api port to ${rest_port}") - -- file { "${conf_dir}/jetty.xml": -+ file { 'jetty.xml': -+ path => "${conf_dir}/jetty.xml", - ensure => file, - owner => 'odl', - content => template('opendaylight/jetty.xml.erb') -@@ -71,6 +78,7 @@ class opendaylight::install ( - Package[$odl_package] -> - Ini_setting <||> -> - Firewall <||> -> -- File <||> -> -+ File['jetty.xml'] -> -+ Class['opendaylight::leveldbjni'] -> - Service['opendaylight'] - } -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 ---- /dev/null -+++ b/deployment_scripts/puppet/modules/opendaylight/manifests/leveldbjni.pp -@@ -0,0 +1,150 @@ -+# == Class opendaylight::leveldbjni -+# -+# Manages compilation of JNI for leveldb. -+# -+# It compiles the leveldbjni from sources and patches it so that it's properly -+# detected by maven on arm64 system. -+# -+class opendaylight::leveldbjni( -+ $target = '/opt/opendaylight', -+ $user = 'odl', -+ $branch = 'leveldbjni-1.8', -+) { -+ case $::osfamily { -+ 'Debian', 'Ubuntu': {} -+ default: { -+ fail('Not supported on OS other than Debian based.') -+ } -+ } -+ -+ $libsnappy_dir = '/usr/lib' -+ $leveldb_dir = "${target}/leveldb" -+ $leveldbjni_dir = "${target}/leveldbjni" -+ $environment = ["SNAPPY_HOME=${libsnappy_dir}", "LEVELDB_HOME=${leveldb_dir}", "LEVELDBJNI_HOME=${leveldbjni_dir}", "LIBRARY_PATH=${libsnappy_dir}", "C_INCLUDE_PATH=${libsnappy_dir}", "CPLUS_INCLUDE_PATH=${libsnappy_dir}","JAVA_HOME=/usr/lib/jvm/java-8-openjdk-${::opendaylight::arch}"] -+ $parallel_jobs = ($processorcount + 1)/2 -+ -+ if ! defined(Package['git']) { -+ package { 'git': -+ ensure => 'present', -+ } -+ } -+ if ! defined(Package['build-essential']) { -+ package { 'build-essential': -+ ensure => 'present', -+ } -+ } -+ if ! defined(Package['automake']) { -+ package { 'automake': -+ ensure => 'present', -+ } -+ } -+ if ! defined(Package['make']) { -+ package { 'make': -+ ensure => 'present', -+ } -+ } -+ if ! defined(Package['libsnappy-dev']) { -+ package { 'libsnappy-dev': -+ ensure => 'present', -+ } -+ } -+ if ! defined(Package['patch']) { -+ package { 'patch': -+ ensure => 'present', -+ } -+ } -+ if ! defined(Package['maven']) { -+ package { 'maven': -+ ensure => 'present', -+ } -+ } -+ if ! defined(Package['openjdk-8-jdk']) { -+ package { 'openjdk-8-jdk': -+ ensure => 'present', -+ } -+ } -+ -+ exec { 'leveldb-fetch': -+ path => ['/usr/bin'], -+ command => "git clone git://github.com/chirino/leveldb.git ${leveldb_dir}", -+ creates => "${leveldb_dir}/.git", -+ user => $user, -+ require => [Package['git']], -+ } -> -+ exec { 'leveldbjni-fetch': -+ path => ['/usr/bin'], -+ command => "git clone https://github.com/fusesource/leveldbjni.git -b ${branch} ${leveldbjni_dir}", -+ creates => "${leveldbjni_dir}/.git", -+ user => $user, -+ require => [Package['git']], -+ } -> -+ exec { 'leveldb-merge-google': -+ path => ['/usr/bin', '/bin'], -+ command => "git config user.name odl && git config user.email 'o@d.l' && git remote add google https://github.com/google/leveldb.git && git fetch google master && git fetch --tags google && git merge --no-edit v1.18", -+ unless => "git remote | grep google", -+ cwd => $leveldb_dir, -+ user => $user, -+ require => [Package['git']], -+ } -> -+ exec { 'leveldb-patch': -+ path => ['/usr/bin'], -+ command => "patch -p1 < ${leveldbjni_dir}/leveldb.patch", -+ unless => "patch -p1 -R -N --dry-run < ${leveldbjni_dir}/leveldb.patch", -+ cwd => $leveldb_dir, -+ user => $user, -+ require => [Package['patch']], -+ } -> -+ file { "${leveldb_dir}/leveldb-arm64.patch": -+ ensure => "file", -+ source => "puppet:///modules/opendaylight/leveldb-arm64.patch", -+ owner => $user, -+ } -> -+ exec { 'leveldb-patch-for-arm64': -+ path => ['/usr/bin'], -+ command => "patch -p1 < ${leveldb_dir}/leveldb-arm64.patch", -+ unless => "patch -p1 -R -N --dry-run < ${leveldb_dir}/leveldb-arm64.patch", -+ cwd => $leveldb_dir, -+ user => $user, -+ require => [Package['patch']], -+ } -> -+ exec { 'leveldb-build': -+ command => "/usr/bin/make libleveldb.a -j${parallel_jobs}", -+ creates => "${leveldb_dir}/libleveldb.a", -+ environment => $environment, -+ cwd => $leveldb_dir, -+ user => $user, -+ require => [Package['git'], Package['make'], Package['build-essential']], -+ } -> -+ file { "${leveldbjni_dir}/leveldbjni.patch": -+ ensure => "file", -+ source => "puppet:///modules/opendaylight/leveldbjni-native.patch", -+ owner => $user, -+ } -> -+ exec { 'leveldbjni-patch': -+ path => ['/usr/bin'], -+ command => "patch -p1 < ${leveldbjni_dir}/leveldbjni.patch", -+ unless => "patch -p1 -R -N --dry-run < ${leveldbjni_dir}/leveldbjni.patch", -+ cwd => $leveldbjni_dir, -+ user => $user, -+ require => [Package['patch']], -+ } -> -+ exec { 'leveldbjni-build': -+ command => "/usr/bin/mvn clean install -P download -P linux64 -P all", -+ # Creates requires a fully qualified path which we don't have -+ unless => "/usr/bin/test -d ~${user}/.m2/repository/org/fusesource/leveldbjni/leveldbjni-all", -+ environment => $environment, -+ cwd => $leveldbjni_dir, -+ user => $user, -+ timeout => 1200, -+ require => [Package['maven']], -+ } -> -+ # Can't do this with 'file' type because we need to purge existing package -+ # and at the same time don't perform the copy if we've already copied our -+ # package. -+ exec { 'leveldbjni-copy': -+ path => ['/bin'], -+ command => "rm -rf ${target}/system/org/fusesource/leveldbjni && cp -r ~${user}/.m2/repository/org/fusesource/leveldbjni $target/system/org/fusesource/", -+ creates => "${target}/system/org/fusesource/leveldbjni/leveldbjni-linux64", -+ user => $user, -+ } -+} -diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml -index 3706678..841bfee 100644 ---- a/deployment_tasks.yaml -+++ b/deployment_tasks.yaml -@@ -17,7 +17,7 @@ - parameters: - puppet_manifest: puppet/manifests/odl-install.pp - puppet_modules: puppet/modules:/etc/puppet/modules -- timeout: 720 -+ timeout: 3600 - - 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 index 00000000..a44222ab --- /dev/null +++ b/patches/fuel-plugin-opendaylight/0002-opnfv-quagga-Build-for-UBUNTU_ARCH.patch @@ -0,0 +1,70 @@ +From: Alexandru Avadanii +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 +--- + 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 + -- cgit 1.2.3-korg