diff options
100 files changed, 1835 insertions, 952 deletions
@@ -3,16 +3,105 @@ Compass4nfv is an installer project based on open source project COMPASS, which provides automated deployment and management of OpenStack and other distributed systems. -This is a prject for run compass4nfv in OPNFV, including build OPNFV imaged-base installation ISO, deployment for OPNFV distributed system. +This is a project for running compass4nfv in OPNFV, including build OPNFV imaged-base installation ISO, deployment for OPNFV distributed system. There are two files in this directory: * **build**: build imaged-base installation ISO for OPNFV. * **deploy**: deploy OPNFV distributed system base the above ISO. -## How to make a reposity for installation ISO +There are five directories in this directory: -## How to build a ISO for OPNFV installation +* **repo**: make repo for building the installation ISO -## How to deploy Compass ISO in virtual machine/baremetal +For the repo directory: +``` +|-- constants.py ## set OS of Docker to make repo +|-- features ## feature components of OPNFV +| |-- brahmaputra ## release name of OPNFV +| | |-- make_odl.sh ## script to make ODL package +| | `-- make_opencon-trail.sh ## script to make Open-contrail package +| |-- colorado ## release name of OPNFV +| | |-- make_kvmfornfv.sh ## script to make Kvm4nfv package +| | |-- make_moon.sh ## script to make Moon package +| | |-- make_odl.sh ## script to make ODL package +| | |-- make_onos.sh ## script to make ONOS package +| | `-- make_opencon-trail.sh ## script to make Open-contrail package +| |-- danube ## release name of OPNFV +| | |-- make_moon.sh ## script to make Moon package +| | |-- make_odl.sh ## script to make ODL package +| | |-- make_onos.sh ## script to make ONOS package +| | `-- make_opencon-trail.sh ## script to make Open-contrail package +| `-- Dockerfile ## Dockerfile to make feature repo +|-- gen_ins_pkg_script.py ## generate the script of downloading package +|-- jhenv_template ## Dockerfile used for making jumphost related package +| |-- centos ## arch name +| | `-- rhel7 ## OS name +| | `-- Dockerfile +| `-- ubuntu ## arch name +| |-- trusty ## OS name +| | `-- Dockerfile +| `-- xenial ## OS name +| `-- Dockerfile +|-- make_repo.sh ## entrance to make repo +|-- openstack ## make openstack package +| |-- make_ppa ## scripts used to make openstack deb or rpm repo +| | |-- centos ## arch +| | | |-- ceph_key_release.asc ## Release repositories use the release.asc key to verify packages. +| | | |-- comps.xml ## used in rpm repo +| | | |-- Dockerfile.tmpl ## Dockerfile running to make repo +| | | `-- rhel7 ## arch +| | | |-- compass ## Make the package used by compass vm +| | | | `-- download_pkg.tmpl +| | | |-- juno ## package for openstack juno +| | | | `-- download_pkg.tmpl +| | | |-- kilo ## package for openstack kilo +| | | | `-- download_pkg.tmpl +| | | |-- liberty ## package for openstack liberty +| | | | `-- download_pkg.tmpl +| | | `-- mitaka ## package for openstack mitaka +| | | `-- download_pkg.tmpl +| | |-- redhat ## Red Hat Enterprise Linux Release +| | | |-- ceph_key_release.asc ## Release repositories use the release.asc key to verify packages +| | | |-- comps.xml ## used in rpm repo +| | | |-- Dockerfile.tmpl ## Dockerfile running to make repo +| | | `-- redhat7 ## OS name +| | | `-- osp9 ## Red Hat OpenStack Platform +| | | `-- download_pkg.tmpl +| | `-- ubuntu ## arch +| | |-- Dockerfile.tmpl ## Dockerfile running to make repo +| | |-- trusty ## OS name +| | | |-- juno ## package for openstack juno +| | | | `-- download_pkg.tmpl +| | | |-- kilo ## package for openstack kilo +| | | | `-- download_pkg.tmpl +| | | |-- liberty ## package for openstack liberty +| | | | `-- download_pkg.tmpl +| | | `-- mitaka ## package for openstack mitaka +| | | `-- download_pkg.tmpl +| | `-- xenial ## OS name +| | |-- mitaka ## package for openstack mitaka +| | | `-- download_pkg.tmpl +| | `-- newton ## package for openstack newton +| | `-- download_pkg.tmpl +| |-- pip ## make pip package according to the requirement.txt openstack source code repo +| | |-- code_url.conf ##code url +| | `-- Dockerfile +| `-- special_pkg ## some special packages +| |-- Debian +| | `-- make_openvswitch-switch.sh +| `-- RedHat +| |-- make_jdk.sh +| `-- make_kibana.sh +|-- repo.conf ## configuration file used in making repo +`-- repo_func.sh ## function lib +``` + +* **build**: configuration file of building is put in this directory. + +For the build directory: + +``` +`-- build.conf ## configuration file used in building ISO +``` @@ -9,12 +9,20 @@ ############################################################################## set -ex -SCRIPT_DIR=`cd ${BASH_SOURCE[0]%/*};pwd` -COMPASS_DIR=${SCRIPT_DIR} -WORK_DIR=$SCRIPT_DIR/work/building +#COMPASS_PATH=$(cd "$(dirname "$0")"/..; pwd) +COMPASS_PATH=`cd ${BASH_SOURCE[0]%/*};pwd` +WORK_DIR=$COMPASS_PATH/work/building + +echo $COMPASS_PATH + +# REPO related setting +REPO_PATH=$COMPASS_PATH/repo +WORK_PATH=$COMPASS_PATH + PACKAGES="fuse fuseiso createrepo genisoimage curl" -source $SCRIPT_DIR/build/build.conf +# PACKAGE_URL will be reset in Jenkins for different branch +export PACKAGE_URL=${PACKAGE_URL:-http://205.177.226.237:9999} mkdir -p $WORK_DIR @@ -178,7 +186,7 @@ function copy_file() cp $CACHE_DIR/`basename $i | sed 's/.git//g'` $new/compass/ -rf done - cp $COMPASS_DIR/deploy/adapters $new/compass/compass-adapters -rf + cp $COMPASS_PATH/deploy/adapters $new/compass/compass-adapters -rf tar -zxvf $CACHE_DIR/`basename $PIP_REPO` -C $new/ tar -zxvf $CACHE_DIR/`basename $PIP_OPENSTACK_REPO` -C $new/ @@ -191,7 +199,7 @@ function rebuild_ppa() name=`basename $COMPASS_PKG` rm -rf ${name%%.*} $name cp $CACHE_DIR/$name $WORK_DIR - cp $SCRIPT_DIR/build/os/centos/comps.xml $WORK_DIR + cp $COMPASS_PATH/repo/openstack/make_ppa/centos/comps.xml $WORK_DIR tar -zxvf $name cp ${name%%.*}/*.rpm $1/Packages -f rm -rf $1/repodata/* @@ -227,7 +235,7 @@ function make_iso() function process_param() { - TEMP=`getopt -o c:d:f: --long iso-dir:,iso-name:,cache-dir: -n 'build.sh' -- "$@"` + TEMP=`getopt -o c:d:f:s:t: --long iso-dir:,iso-name:,cache-dir:,openstack_build:,feature_build:,feature_version: -n 'build.sh' -- "$@"` if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -238,6 +246,9 @@ function process_param() -d|--iso-dir) export ISO_DIR=$2; shift 2;; -f|--iso-name) export ISO_NAME=$2; shift 2;; -c|--cache-dir) export CACHE_DIR=$2; shift 2;; + -s|--openstack_build) export OPENSTACK_BUILD=$2; shift 2;; + -t|--feature_build) export FEATURE_BUILD=$2; shift 2;; + -v|--feature_version) export FEATURE_VERSION=$2; shift 2;; --) shift; break;; *) echo "Internal error!" ; exit 1 ;; esac @@ -246,6 +257,9 @@ function process_param() export CACHE_DIR=${CACHE_DIR:-$WORK_DIR/cache} export ISO_DIR=${ISO_DIR:-$WORK_DIR} export ISO_NAME=${ISO_NAME:-"compass.iso"} + export OPENSTACK_BUILD=${OPENSTACK_BUILD:-"stable"} + export FEATURE_BUILD=${FEATURE_BUILD:-"stable"} +# export FEATURE_VERSION=${FEATURE_VERSION:-"colorado"} } function copy_iso() @@ -257,7 +271,42 @@ function copy_iso() cp $WORK_DIR/compass.iso $ISO_DIR/$ISO_NAME -f } +# get daily repo or stable repo +function get_repo_pkg() +{ + source $COMPASS_PATH/repo/repo_func.sh + + # switch to compass4nfv directory + cd $COMPASS_PATH + + # set openstack ppa url + if [[ $OPENSTACK_BUILD == daily ]]; then + process_env + make_osppa + export PPA_URL=${PPA_URL:-$COMPASS_PATH/work/repo} + else + export PPA_URL=${PPA_URL:-$PACKAGE_URL} + fi + + # set feature pkg url + if [[ $FEATURE_BUILD == daily ]]; then + process_env + make_repo --package-tag feature + +###TODO should the packages.tar.gz include all the packages from different OPNFV versions? + + export FEATURE_URL=${FEATURE_URL:-$COMPASS_PATH/work/repo} + else + export FEATURE_URL=${FEATURE_URL:-$PACKAGE_URL} + fi + + source $COMPASS_PATH/build/build.conf + + # switch to building directory + cd $WORK_DIR +} process_param $* prepare_env +get_repo_pkg make_iso copy_iso diff --git a/build/build.conf b/build/build.conf index f9e40568..0cd12557 100644 --- a/build/build.conf +++ b/build/build.conf @@ -1,7 +1,7 @@ TIMEOUT=10 # PACKAGE_URL will be reset in Jenkins for different branch -export PACKAGE_URL=${PACKAGE_URL:-http://205.177.226.237:9999} +#export PACKAGE_URL=${PACKAGE_URL:-http://205.177.226.237:9999} # Jumphost OS version export CENTOS_BASE=${CENTOS_BASE:-$PACKAGE_URL/CentOS-7-x86_64-Minimal-1511.iso} @@ -28,7 +28,7 @@ export UBUNTU_ISO1=${UBUNTU_ISO1:-$PACKAGE_URL/ubuntu-14.04.3-server-amd64.iso} export TRUSTY_LIBERTY_PPA=${TRUSTY_LIBERTY_PPA:-$PACKAGE_URL/trusty-liberty-ppa.tar.gz} export TRUSTY_MITAKA_PPA=${TRUSTY_MITAKA_PPA:-$PACKAGE_URL/trusty-mitaka-ppa.tar.gz} export XENIAL_MITAKA_PPA=${XENIAL_MITAKA_PPA:-$PACKAGE_URL/xenial-mitaka-ppa.tar.gz} -export XENIAL_NEWTON_PPA=${XENIAL_NEWTON_PPA:-$PACKAGE_URL/xenial-newton-ppa.tar.gz} +export XENIAL_NEWTON_PPA=${XENIAL_NEWTON_PPA:-$PPA_URL/xenial-newton-ppa.tar.gz} #export CENTOS7_JUNO_PPA=${CENTOS7_JUNO_PPA:-$PACKAGE_URL/centos7-juno-ppa.tar.gz} #export CENTOS7_KILO_PPA=${CENTOS7_KILO_PPA:-$PACKAGE_URL/centos7-kilo-ppa.tar.gz} export CENTOS7_LIBERTY_PPA=${CENTOS7_LIBERTY_PPA:-$PACKAGE_URL/centos7-liberty-ppa.tar.gz} @@ -36,86 +36,8 @@ export CENTOS7_MITAKA_PPA=${CENTOS7_MITAKA_PPA:-$PACKAGE_URL/centos7-mitaka-ppa. # export REDHAT7_OSP9_PPA=${REDHAT7_OSP9_PPA:-$PACKAGE_URL/redhat7-osp9-ppa.tar.gz} # SDN Packages for integration -export APP_PACKAGE=${APP_PACKAGE:-$PACKAGE_URL/packages.tar.gz} +export APP_PACKAGE=${APP_PACKAGE:-$FEATURE_URL/packages.tar.gz} # Other Packages export LOADERS=${LOADERS:-$PACKAGE_URL/loaders.tar.gz} export CIRROS=${CIRROS:-$PACKAGE_URL/cirros-0.3.3-x86_64-disk.img} -export SPECIAL_DEBIAN_PACKAGE=${SPECIAL_DEBIAN_PACKAGE-$PACKAGE_URL/debian-packages.tar.gz} -export KVMFORNFV=${kvmfornfv:-https://gerrit.opnfv.org/gerrit/p/kvmfornfv.git} - - -export SPECIAL_PIP_PACKAGE="https://bootstrap.pypa.io/ez_setup.py \ - https://pypi.python.org/packages/source/s/setuptools/setuptools-18.2.zip \ - https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz \ - https://pypi.python.org/packages/source/a/ansible/ansible-1.9.2.tar.gz \ - https://pypi.python.org/packages/source/v/virtualenv/virtualenv-13.1.2.tar.gz \ - https://pypi.python.org/packages/source/p/pexpect/pexpect-3.3.tar.gz \ - https://pypi.python.org/packages/source/a/amqplib/amqplib-1.0.2.tgz \ - https://pypi.python.org/packages/source/M/Markdown/Markdown-2.4.tar.gz \ - https://pypi.python.org/packages/source/C/Cheetah/Cheetah-2.4.1.tar.gz \ - https://pypi.python.org/packages/source/d/daemon/daemon-1.1.tar.gz \ - https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz \ - https://pypi.python.org/packages/source/F/Flask-Login/Flask-Login-0.2.11.tar.gz \ - https://pypi.python.org/packages/2.7/F/Flask-RESTful/Flask_RESTful-0.3.4-py2.py3-none-any.whl \ - https://pypi.python.org/packages/2.7/F/Flask-WTF/Flask_WTF-0.12-py2-none-any.whl \ - https://pypi.python.org/packages/source/i/importlib/importlib-1.0.3.tar.bz2 \ - https://pypi.python.org/packages/py2/l/lockfile/lockfile-0.10.2-py2-none-any.whl \ - https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip \ - https://pypi.python.org/packages/any/n/netaddr/netaddr-0.7.18-py2.py3-none-any.whl \ - https://pypi.python.org/packages/source/P/PyChef/PyChef-0.2.3.tar.gz \ - https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-1.0.8.tar.gz \ - https://pypi.python.org/packages/source/s/simplejson/simplejson-3.8.0.tar.gz \ - https://pypi.python.org/packages/2.7/r/requests/requests-2.7.0-py2.py3-none-any.whl \ - https://pypi.python.org/packages/2.7/c/celery/celery-3.1.18-py2.py3-none-any.whl \ - https://pypi.python.org/packages/2.7/W/Werkzeug/Werkzeug-0.10.4-py2.py3-none-any.whl \ - https://pypi.python.org/packages/source/c/ciso8601/ciso8601-1.0.1.tar.gz \ - https://pypi.python.org/packages/3.3/s/six/six-1.9.0-py2.py3-none-any.whl \ - https://pypi.python.org/packages/2.7/W/WTForms/WTForms-2.0.2-py2.py3-none-any.whl \ - https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz \ - https://pypi.python.org/packages/2.7/a/amqp/amqp-1.4.6-py2-none-any.whl \ - https://pypi.python.org/packages/any/M/Markdown/Markdown-2.6.2-py2.py3-none-any.whl \ - https://pypi.python.org/packages/2.7/a/argparse/argparse-1.3.0-py2.py3-none-any.whl \ - https://pypi.python.org/packages/source/F/Flask-Script/Flask-Script-2.0.5.tar.gz \ - https://pypi.python.org/packages/source/F/Flask-SQLAlchemy/Flask-SQLAlchemy-0.10.tar.gz \ - https://pypi.python.org/packages/source/l/lazypy/lazypy-0.2.tar.gz \ - https://pypi.python.org/packages/source/p/pytz/pytz-2014.3.zip \ - https://pypi.python.org/packages/source/b/billiard/billiard-3.3.0.3.tar.gz \ - https://pypi.python.org/packages/source/a/anyjson/anyjson-0.1.tar.gz \ - https://pypi.python.org/packages/2.7/k/kombu/kombu-3.0.17-py2.py3-none-any.whl \ - https://pypi.python.org/packages/source/a/aniso8601/aniso8601-0.48.tar.gz \ - https://pypi.python.org/packages/2.7/e/ecdsa/ecdsa-0.12-py2.py3-none-any.whl \ - https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz \ - https://pypi.python.org/packages/source/i/itsdangerous/itsdangerous-0.24.tar.gz \ - https://pypi.python.org/packages/source/p/paramiko/paramiko-1.12.3.tar.gz \ - https://pypi.python.org/packages/3.4/p/python-daemon/python_daemon-2.0.4-py2.py3-none-any.whl \ - https://pypi.python.org/packages/source/r/redis/redis-2.7.1.tar.gz \ - https://pypi.python.org/packages/source/b/billiard/billiard-3.3.0.20.tar.gz \ - https://pypi.python.org/packages/2.7/k/kombu/kombu-3.0.26-py2.py3-none-any.whl \ - https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.8.tar.gz \ - https://pypi.python.org/packages/source/a/aniso8601/aniso8601-0.85.tar.gz \ - https://pypi.python.org/packages/source/a/anyjson/anyjson-0.3.3.tar.gz \ - https://pypi.python.org/packages/source/o/ordereddict/ordereddict-1.0.tar.gz \ - https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz \ - https://pypi.python.org/packages/source/l/lazypy/lazypy-0.5.tar.gz \ - https://pypi.python.org/packages/source/p/pycrypto-on-pypi/pycrypto-on-pypi-2.3.tar.gz \ - https://pypi.python.org/packages/source/p/pymongo/pymongo-3.0.3.tar.gz \ - https://pypi.python.org/packages/source/c/crudini/crudini-0.7.tar.gz \ - https://pypi.python.org/packages/source/n/networking-odl/networking-odl-1.0.1.tar.gz \ - https://pypi.python.org/packages/source/p/python-keyczar/python-keyczar-0.715.tar.gz \ - https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.9.tar.gz \ - https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz \ - https://pypi.python.org/packages/source/c/cliff/cliff-1.15.0.tar.gz \ - https://pypi.python.org/packages/6e/96/ba2a2462ed25ca0e651fb7b66e7080f5315f91425a07ea5b34d7c870c114/Babel-2.3.4.tar.gz \ - https://pypi.python.org/packages/93/ba/7be92c44a984ff23bc13fa4dfffe01422cfd343b09ada7356bb16bae4ef7/tosca-parser-0.5.0.tar.gz \ - https://pypi.python.org/packages/c3/52/85a606f541d627164b8159fd68da9e945ecec375d185069c05b84d5e4aa1/heat-translator-0.5.0.tar.gz \ - https://pypi.python.org/packages/98/92/9c91d88316ecab35e0b1f23a2d757bd9a4ce73de6caba309ac29e66f2cfd/yang2tosca-0.13.tar.gz \ - https://pypi.python.org/packages/41/40/0c951f9c78a9be150b432ff50700c3b8d1cd3ef1ec53f00d08b2a7ecc64e/oslo.concurrency-3.11.0.tar.gz \ - https://pypi.python.org/packages/61/b9/74514d774df110799ff2b100979de6180ead1d5eec6fa15c52e6299361ea/oslo.service-1.12.0.tar.gz \ - https://pypi.python.org/packages/9f/ec/d8bf0623d7d940c09052368ee859f726410e54b16b13f477ac0e70416de6/neutron-lib-0.2.0.tar.gz \ - https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.2.tar.gz " - -export PIP_PACKAGE="https://pypi.python.org/packages/0d/af/8ccfb73834a6ddf9d57ecac61466557b7ca0722620bbb16d2d069ce312db/networking-odl-2.0.0.tar.gz \ - https://pypi.python.org/packages/90/4f/74b730294de1db393e3e82211b5d2115f9a763849abca7d014348a550d2a/oslosphinx-4.5.0.tar.gz \ - https://pypi.python.org/packages/74/f0/386f7f73aa6628c1bef53874c5d453b556356d77732add69000aa53b353b/policy2tosca-1.0.tar.gz " - diff --git a/build/make_packages.sh b/build/make_packages.sh deleted file mode 100755 index 14513bee..00000000 --- a/build/make_packages.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex - -BUILD_PATH=$(cd "$(dirname "$0")"; pwd) -WORK_PATH=$(cd "$(dirname "$0")"/..; pwd) - -if [[ -d $WORK_PATH/work/repo/packages ]]; then - rm -rf $WORK_PATH/work/repo/packages -fi - -if [[ -d $WORK_PATH/work/repo/temp ]]; then - rm -rf $WORK_PATH/work/repo/temp -fi - -mkdir -p $WORK_PATH/work/repo/packages -mkdir -p $WORK_PATH/work/repo/temp - -for i in `ls $WORK_PATH/build/packages`; do - . $WORK_PATH/build/packages/$i $WORK_PATH/repo/packages -done - -tar -zcvf $WORK_PATH/repo/packages.tar.gz $WORK_PATH/work/repo/packages diff --git a/build/make_repo.sh b/build/make_repo.sh deleted file mode 100755 index 2752cf10..00000000 --- a/build/make_repo.sh +++ /dev/null @@ -1,388 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex - -BUILD_PATH=$(cd "$(dirname "$0")"; pwd) -WORK_PATH=$(cd "$(dirname "$0")"/..; pwd) - -source $BUILD_PATH/build.conf - -function process_env() -{ - mkdir -p ${WORK_PATH}/work/repo/ ${WORK_PATH}/work/repo/pip - - set +e - sudo docker info - if [[ $? != 0 ]]; then - wget -qO- https://get.docker.com/ | sh - else - echo "docker is already installed!" - fi - set -e - -cat <<EOF >${WORK_PATH}/work/repo/cp_repo.sh -#!/bin/bash -set -ex -cp /*.tar.gz /result -f -EOF - - sudo apt-get -f install - sudo apt-get install python-yaml -y - sudo apt-get install python-cheetah -y -} - -function make_repo() -{ - rm -f ${WORK_PATH}/work/repo/install_packages.sh - rm -f ${WORK_PATH}/work/repo/Dockerfile - - option=`echo "os-ver:,jh-os:,package-tag:,tmpl:,default-package:, \ - special-package:,special-package-script-dir:, \ - special-package-dir:,ansible-dir:,special-package-dir" | sed 's/ //g'` - - TEMP=`getopt -o h -l $option -n 'make_repo.sh' -- "$@"` - - if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi - - eval set -- "$TEMP" - - os_ver="" - jh_os="" - package_tag="" - tmpl="" - default_package="" - special_package="" - special_package_script_dir="" - special_package_dir="" - ansible_dir="" - ansible_dir_tmp="" - while :; do - case "$1" in - --os-ver) os_ver=$2; shift 2;; - --jh-os) jh_os=$2; shift 2;; - --package-tag) package_tag=$2; shift 2;; - --tmpl) tmpl=$2; shift 2;; - --default-package) default_package=$2; shift 2;; - --special-package) special_package=$2; shift 2;; - --special-package-script-dir) special_package_script_dir=$2; shift 2;; - --special-package-dir) special_package_dir=$2; shift 2;; - --ansible-dir) ansible_dir=$2; shift 2;; - --) shift; break;; - *) echo "Internal error! $1" ; exit 1 ;; - esac - done - - if [[ -n ${package_tag} && ${package_tag} == "pip" ]]; then - make_pip_repo - return - fi - - if [[ -n ${package_tag} && ${package_tag} == "jhenv" && -n ${jh_os} ]]; then - make_jhenv_repo - return - fi - - if [[ -z ${os_ver} || -z ${package_tag} ]]; then - echo "parameter is wrong" - exit 1 - fi - - if [[ ${os_ver} == trusty || ${os_ver} == xenial ]]; then - arch=Debian - os_name=ubuntu - fi - - if [[ ${os_ver} =~ rhel[0-9]*$ ]]; then - arch=RedHat - os_name=centos - fi - - if [[ ${os_ver} =~ redhat[0-9]*$ ]]; then - arch=RedHat - os_name=redhat - tmpl=${BUILD_PATH}/templates/${arch}_${os_ver}_${package_tag}.tmpl - fi - - if [[ -z $arch ]]; then - echo "unsupported ${os_ver} os" - exit 1 - fi - - dockerfile=Dockerfile - docker_tmpl=${BUILD_PATH}/os/${os_name}/${os_ver}/${package_tag}/${dockerfile}".tmpl" - docker_tag="${os_ver}/${package_tag}" - - if [[ -z ${tmpl} ]]; then - if [[ ${os_ver} == xenial ]]; then - tmpl=${BUILD_PATH}/templates/${arch}_${os_ver}_${package_tag}.tmpl - else - tmpl=${BUILD_PATH}/templates/${arch}_${package_tag}.tmpl - fi - fi - - if [[ "${ansible_dir}" != "" ]]; then - # generate ansible_dir_tmp - if [[ -d ${WORK_PATH}/work/tmp ]]; then - rm -rf ${WORK_PATH}/work/tmp - fi - mkdir -p ${WORK_PATH}/work/tmp - echo "${ansible_dir}" - cp -rf ${ansible_dir}/roles/ ${WORK_PATH}/work/tmp/ - if [[ ${os_ver} == xenial ]]; then - if [[ -d ${ansible_dir}/openstack_${package_tag}_${os_ver}/roles && "`ls ${ansible_dir}/openstack_${package_tag}_${os_ver}`" != "" ]]; then - cp -rf ${ansible_dir}/openstack_${package_tag}_${os_ver}/roles/* ${WORK_PATH}/work/tmp/roles/ - fi - else - if [[ -d ${ansible_dir}/openstack_${package_tag}/roles && "`ls ${ansible_dir}/openstack_${package_tag}`" != "" ]]; then - cp -rf ${ansible_dir}/openstack_${package_tag}/roles/* ${WORK_PATH}/work/tmp/roles/ - fi - fi - ansible_dir_tmp=${WORK_PATH}/work/tmp/ - fi - - python ${BUILD_PATH}/gen_ins_pkg_script.py "${ansible_dir_tmp}" "${arch}" "${tmpl}" \ - "${docker_tmpl}" "${default_package}" "${special_package}" \ - "${WORK_PATH}/work/repo/$arch/script/" \ - "${WORK_PATH}/work/repo/$arch/packages/" - - rm -rf ${WORK_PATH}/work/repo/$arch - mkdir -p ${WORK_PATH}/work/repo/$arch/{script,packages} - - # copy default package script to wokr dir - if [[ -d ${WORK_PATH}/build/arch/$arch ]]; then - cp -rf ${WORK_PATH}/build/arch/$arch/* ${WORK_PATH}/work/repo/$arch/script/ - fi - - # copy make package script to work dir - if [[ -n $special_package_script_dir && -d $special_package_script_dir ]]; then - cp -rf $special_package_script_dir/* ${WORK_PATH}/work/repo/$arch/script/ - fi - - # copy special package to work dir - if [[ -n $special_package_dir ]]; then - curl --connect-timeout 10 -o $WORK_PATH/work/repo/$arch/`basename $special_package_dir` $special_package_dir - tar -zxvf $WORK_PATH/work/repo/$arch/`basename $special_package_dir` -C ${WORK_PATH}/work/repo/$arch/packages - fi - - # copy docker file to work dir - if [[ -n $os_ver && -d ${WORK_PATH}/build/os/$os_name/$os_ver ]]; then - rm -rf ${WORK_PATH}/work/repo/$os_ver - cp -rf ${WORK_PATH}/build/os/$os_name/$os_ver ${WORK_PATH}/work/repo - fi - - # copy centos comps.xml to work dir - if [[ $arch == RedHat && -f ${WORK_PATH}/build/os/$os_name/comps.xml ]]; then - cp -rf ${WORK_PATH}/build/os/$os_name/comps.xml ${WORK_PATH}/work/repo - cp -rf ${WORK_PATH}/build/os/$os_name/ceph_key_release.asc ${WORK_PATH}/work/repo - fi - - sudo docker build --no-cache=true -t ${docker_tag} -f ${WORK_PATH}/work/repo/${dockerfile} ${WORK_PATH}/work/repo/ - sudo docker run -t -v ${WORK_PATH}/work/repo:/result ${docker_tag} - - image_id=$(sudo docker images|grep ${docker_tag}|awk '{print $3}') - - sudo docker rmi -f ${image_id} -} - -function _try_fetch_dependency() -{ - local dir_name='' - if [ -f $1 ];then - case $1 in - *.tar.bz2) - tar xjf $1 - dir_name="$(basename $1 .tar.bz2)" - ;; - *.tar.gz) - tar xzf $1 - dir_name="$(basename $1 .tar.gz)" - ;; - *.bz2) - bunzip2 $1 - dir_name="$(basename $1 .bz2)" - ;; - *.rar) - unrar e $1 - dir_name="$(basename $1 .rar)" - ;; - *.gz) - gunzip $1 - dir_name="$(basename $1 .gz)" - ;; - *.tar) - tar xf $1 - dir_name="$(basename $1 .tar)" - ;; - *.tbz2) - tar xjf $1 - dir_name="$(basename $1 .tbz2)" - ;; - *.tgz) - tar xzf $1 - dir_name="$(basename $1 .tgz)" - ;; - *.zip) - gunzip $1 - dir_name="$(basename $1 .zip)" - ;; - *) - echo "'$1' cannot be extract()" - return - ;; - esac - else - echo "'$1' is not a valid file" - return - fi - - if [ ! -f ${dir_name}/requirements.txt ]; then - echo "${dir_name}/requirements.txt does not exist" - return - fi - - pip install --download=$2 -r ${dir_name}/requirements.txt - - rm -rf $dir_name -} - -function try_fetch_dependency() -{ - cd $3 - _try_fetch_dependency $1/$2 $1 - cd - -} - -function make_pip_repo() -{ - source $WORK_PATH/build/build.conf - local pip_path=$WORK_PATH/work/repo/pip - local pip_tmp_path=$WORK_PATH/work/repo/pip_tmp - - for i in $SPECIAL_PIP_PACKAGE; do - curl --connect-timeout 10 -o $pip_path/`basename $i` $i - done - - mkdir -p $pip_tmp_path - - for i in $PIP_PACKAGE; do - curl --connect-timeout 10 -o $pip_path/$(basename $i) $i - try_fetch_dependency $pip_path $(basename $i) $pip_tmp_path - done - - rm -rf $pip_tmp_path - - cd $WORK_PATH/work/repo; tar -zcvf pip.tar.gz ./pip; cd - -} - -function make_jhenv_repo() -{ - if [[ ${jh_os} == trusty ]]; then - env_os_name=ubuntu - fi - - if [[ ${jh_os} == xenial ]]; then - env_os_name=ubuntu - fi - - if [[ ${jh_os} =~ rhel[0-9]*$ ]]; then - env_os_name=centos - fi - - if [[ -d ${WORK_PATH}/build/jhenv_template/$env_os_name ]]; then - - jh_env_dockerfile=Dockerfile - jh_env_docker_tmpl=${BUILD_PATH}/jhenv_template/$env_os_name/$jh_os/${jh_env_dockerfile}".tmpl" - jh_env_docker_tag="$jh_os/env" - - rm -rf ${WORK_PATH}/work/repo/jhenv_template - mkdir ${WORK_PATH}/work/repo/jhenv_template - cp -rf ${WORK_PATH}/build/jhenv_template/$env_os_name/$jh_os/${jh_env_dockerfile} ${WORK_PATH}/work/repo/jhenv_template - -cat <<EOF >${WORK_PATH}/work/repo/jhenv_template/cp_env.sh -#!/bin/bash -set -ex -cp /*.tar.gz /env -f -EOF - - sudo docker build --no-cache=true -t ${jh_env_docker_tag} -f ${WORK_PATH}/work/repo/jhenv_template/${jh_env_dockerfile} ${WORK_PATH}/work/repo/jhenv_template - sudo docker run -t -v ${WORK_PATH}/work/repo:/env ${jh_env_docker_tag} - - image_id=$(sudo docker images|grep ${jh_env_docker_tag}|awk '{print $3}') - - sudo docker rmi -f ${image_id} - -# cd $WORK_PATH/work/repo; tar -zcvf pip.tar.gz ./pip; cd - - fi -} - -# FIXME: rhel7 -> centos7, redhat7 -> rhel7 -function make_all_repo() -{ -# for env_os in trusty xanial rhel7; do -# make_repo --package-tag jhenv --jh-os $env_os -# done -# jhenv only support trusty - make_repo --package-tag jhenv --jh-os trusty - - make_repo --package-tag pip - - make_repo --os-ver rhel7 --package-tag compass \ - --tmpl "${WORK_PATH}/build/templates/compass_core.tmpl" \ - --default-package "kernel-devel epel-release wget libxml2 glibc gcc perl openssl-libs mkisofs createrepo lsof \ - python-yaml python-jinja2 python-paramiko elasticsearch logstash bind-license vim nmap-ncat \ - yum cobbler cobbler-web createrepo mkisofs syslinux pykickstart bind rsync fence-agents \ - dhcp xinetd tftp-server httpd libselinux-python python-setuptools python-devel mysql-devel \ - mysql-server mysql MySQL-python redis mod_wsgi net-tools rabbitmq-server nfs-utils" \ - --special-package "kibana jdk" - - for opv in juno kilo liberty mitaka; do - make_repo --os-ver trusty --package-tag $opv \ - --ansible-dir $WORK_PATH/deploy/adapters/ansible \ - --default-package "openssh-server" \ - --special-package "openvswitch-switch" - done - - for opv in mitaka newton; do - make_repo --os-ver xenial --package-tag $opv \ - --ansible-dir $WORK_PATH/deploy/adapters/ansible \ - --default-package "openssh-server" - done - - make_repo --os-ver rhel7 --package-tag juno \ - --ansible-dir $WORK_PATH/deploy/adapters/ansible \ - --default-package "rsyslog-7.6.7-1.el7 strace net-tools wget vim openssh-server \ - dracut-config-rescue-033-241.el7_1.3 dracut-network-033-241.el7_1.3" - - for opv in kilo liberty mitaka; do - make_repo --os-ver rhel7 --package-tag $opv \ - --ansible-dir $WORK_PATH/deploy/adapters/ansible \ - --default-package "rsyslog-7.6.7-1.el7 strace net-tools wget vim openssh-server \ - dracut-config-rescue-033-241.el7_1.5 dracut-network-033-241.el7_1.5" - done - - for opv in osp9; do - make_repo --os-ver redhat7 --package-tag $opv \ - --ansible-dir $WORK_PATH/deploy/adapters/ansible \ - --default-package "strace net-tools wget vim openssh-server" - done -} - -function main() -{ - process_env - - if [[ $# -eq 0 ]]; then - make_all_repo - else - make_repo "$@" - fi -} - -main "$@" diff --git a/build/os/centos/rhel6/compass/Dockerfile.tmpl b/build/os/centos/rhel6/compass/Dockerfile.tmpl deleted file mode 100644 index df2bcb77..00000000 --- a/build/os/centos/rhel6/compass/Dockerfile.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -FROM centos:6.6 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -# add repo files first, then update -ADD ./elasticsearch.repo /etc/yum.repos.d/elasticsearch.repo -ADD ./logstash.repo /etc/yum.repos.d/logstash.repo - -# TODO: Is there some easy way to get the fastest/closest mirror? -RUN yum update -y - -# set cache enable -RUN sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./RedHat/packages/$package /var/cache/yum/x86_64/6/base/packages/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./RedHat/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/centos/rhel7/compass/Dockerfile.tmpl b/build/os/centos/rhel7/compass/Dockerfile.tmpl deleted file mode 100644 index 0d0fbe10..00000000 --- a/build/os/centos/rhel7/compass/Dockerfile.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -FROM centos:7.2.1511 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -# set cache enable -RUN sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./RedHat/packages/$package /var/cache/yum/x86_64/7/base/packages/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./RedHat/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/centos/rhel7/kilo/Dockerfile.tmpl b/build/os/centos/rhel7/kilo/Dockerfile.tmpl deleted file mode 100644 index adb930ff..00000000 --- a/build/os/centos/rhel7/kilo/Dockerfile.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -FROM centos:7.1.1503 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -# set cache enable -RUN sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./RedHat/packages/redhat_packages/$package /var/cache/yum/x86_64/7/base/packages/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./RedHat/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./comps.xml / -ADD ./ceph_key_release.asc / -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/centos/rhel7/liberty/Dockerfile.tmpl b/build/os/centos/rhel7/liberty/Dockerfile.tmpl deleted file mode 100644 index adb930ff..00000000 --- a/build/os/centos/rhel7/liberty/Dockerfile.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -FROM centos:7.1.1503 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -# set cache enable -RUN sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./RedHat/packages/redhat_packages/$package /var/cache/yum/x86_64/7/base/packages/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./RedHat/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./comps.xml / -ADD ./ceph_key_release.asc / -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/redhat/redhat7/osp9/Dockerfile.tmpl b/build/os/redhat/redhat7/osp9/Dockerfile.tmpl deleted file mode 100644 index 81cc2839..00000000 --- a/build/os/redhat/redhat7/osp9/Dockerfile.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -FROM registry.access.redhat.com/rhel7.2 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -# set cache enable -RUN sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./RedHat/packages/redhat_packages/$package /var/cache/yum/x86_64/7/base/packages/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./RedHat/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./comps.xml / -ADD ./ceph_key_release.asc / -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/ubuntu/trusty/juno/Dockerfile.tmpl b/build/os/ubuntu/trusty/juno/Dockerfile.tmpl deleted file mode 100644 index ad14fa59..00000000 --- a/build/os/ubuntu/trusty/juno/Dockerfile.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:14.04.3 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -#RUN apt-get update - -RUN rm -f /etc/apt/apt.conf.d/docker-clean -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./Debian/packages/debian-packages/$package /var/cache/apt/archives/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./Debian/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/ubuntu/trusty/kilo/Dockerfile.tmpl b/build/os/ubuntu/trusty/kilo/Dockerfile.tmpl deleted file mode 100644 index ad14fa59..00000000 --- a/build/os/ubuntu/trusty/kilo/Dockerfile.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:14.04.3 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -#RUN apt-get update - -RUN rm -f /etc/apt/apt.conf.d/docker-clean -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./Debian/packages/debian-packages/$package /var/cache/apt/archives/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./Debian/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/ubuntu/trusty/liberty/Dockerfile.tmpl b/build/os/ubuntu/trusty/liberty/Dockerfile.tmpl deleted file mode 100644 index ad14fa59..00000000 --- a/build/os/ubuntu/trusty/liberty/Dockerfile.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:14.04.3 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -#RUN apt-get update - -RUN rm -f /etc/apt/apt.conf.d/docker-clean -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./Debian/packages/debian-packages/$package /var/cache/apt/archives/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./Debian/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/ubuntu/xenial/mitaka/Dockerfile.tmpl b/build/os/ubuntu/xenial/mitaka/Dockerfile.tmpl deleted file mode 100644 index 4b24c0a3..00000000 --- a/build/os/ubuntu/xenial/mitaka/Dockerfile.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:16.04 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -#RUN apt-get update - -RUN rm -f /etc/apt/apt.conf.d/docker-clean -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./Debian/packages/debian-packages/$package /var/cache/apt/archives/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./Debian/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/os/ubuntu/xenial/newton/Dockerfile.tmpl b/build/os/ubuntu/xenial/newton/Dockerfile.tmpl deleted file mode 100644 index 4b24c0a3..00000000 --- a/build/os/ubuntu/xenial/newton/Dockerfile.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:16.04 -MAINTAINER Chigang(Justin) <chigang@huawei.com> - -#RUN apt-get update - -RUN rm -f /etc/apt/apt.conf.d/docker-clean -#set packages = $getVar('spcial_packages', []) -#for package in $packages -ADD ./Debian/packages/debian-packages/$package /var/cache/apt/archives/ -#end for -#set scripts = $getVar('scripts', []) -#for script in $scripts -ADD ./Debian/script/$script /tmp/chigang/$script -RUN chmod +x /tmp/chigang/$script -RUN /tmp/chigang/$script -#end for -ADD ./install_packages.sh /tmp/chigang/install_packages.sh -RUN chmod +x /tmp/chigang/install_packages.sh -RUN /tmp/chigang/install_packages.sh - -ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh -RUN chmod +x /tmp/chigang/cp_repo.sh -RUN mkdir /result - -CMD ["/tmp/chigang/cp_repo.sh"] -#VOLUME /tmp/chigang diff --git a/build/packages/make_kvmfornfv.sh b/build/packages/make_kvmfornfv.sh deleted file mode 100644 index 3fa6efec..00000000 --- a/build/packages/make_kvmfornfv.sh +++ /dev/null @@ -1,65 +0,0 @@ -############################################################################## -# Copyright (c) 2016 Nokia 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 -############################################################################## - -# TODO compile kernel and qemu in docker container - -WORK_PATH=$(cd "$(dirname "$0")"/..; pwd) -CACHE_DIR=$WORK_PATH/work/repo/temp -DST_DIR=$WORK_PATH/work/repo/packages/kvmfornfv/ -source $WORK_PATH/build/build.conf - -function prepare() -{ - sudo apt-get install -y libtool libglib2.0-dev autoconf automake - mkdir -p $CACHE_DIR - mkdir -p $DST_DIR - - if [ git ls-remote $KVMFORNFV ]; - then - git clone $KVMFORNFV $CACHE_DIR/kvmfornfv - mkdir -p $CACHE_DIR/kvmfornfv/build/{boot,usr} - fi -} - -function make_kernel() -{ - cd $CACHE_DIR/kvmfornfv/kernel - cp arch/x86/configs/opnfv.config .config - make -j8 - make -j8 modules - make INSTALL_PATH=$CACHE_DIR/kvmfornfv/build/boot install - make INSTALL_MOD_PATH=$CACHE_DIR/kvmfornfv/build modules_install -} - -function make_qemu() -{ - mkdir -p $CACHE_DIR/kvmfornfv/qemu/build - cd $CACHE_DIR/kvmfornfv/qemu/build - ../configure --prefix=$CACHE_DIR/kvmfornfv/build/usr --enable-system --enable-kvm - make -j8 - make install -} - -function make_kvmfornfv() -{ - pushd . - - prepare - make_kernel - make_qemu - - tar -czf $DST_DIR/kvmfornfv.tar.gz \ - -C $CACHE_DIR/kvmfornfv/build . - cd - - - popd -} - -make_kvmfornfv - diff --git a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/dashboard/templates/openstack-dashboard.conf.j2 b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/dashboard/templates/openstack-dashboard.conf.j2 new file mode 100755 index 00000000..89a70686 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/dashboard/templates/openstack-dashboard.conf.j2 @@ -0,0 +1,18 @@ +{% set work_threads = (ansible_processor_vcpus + 1) // 2 %} +{% if work_threads > 10 %} + set work_threads = 10 +{% endif %} + +<VirtualHost {{ internal_ip }}:80> + WSGIScriptAlias /horizon {{ horizon_dir }}/wsgi/django.wsgi + WSGIDaemonProcess horizon user=horizon group=horizon processes=4 threads={{ work_threads }} + WSGIProcessGroup horizon + Alias /static {{ horizon_dir }}/static/ + Alias /horizon/static {{ horizon_dir }}/static/ + <Directory {{ horizon_dir }}/wsgi> + Order allow,deny + Allow from all + </Directory> +</VirtualHost> + + diff --git a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/keystone/templates/wsgi-keystone.conf.j2 b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/keystone/templates/wsgi-keystone.conf.j2 new file mode 100644 index 00000000..f5f9d339 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/keystone/templates/wsgi-keystone.conf.j2 @@ -0,0 +1,50 @@ +{% set work_threads = (ansible_processor_vcpus + 1) // 2 %} +{% if work_threads > 10 %} + set work_threads = 10 +{% endif %} + +<VirtualHost {{ internal_ip }}:5000> + WSGIDaemonProcess keystone-public processes=4 threads={{ work_threads }} user=keystone group=keystone display-name=%{GROUP} + WSGIProcessGroup keystone-public + WSGIScriptAlias / /usr/bin/keystone-wsgi-public + WSGIApplicationGroup %{GLOBAL} + WSGIPassAuthorization On + <IfVersion >= 2.4> + ErrorLogFormat "%{cu}t %M" + </IfVersion> + ErrorLog /var/log/{{ http_service_name }}/keystone.log + CustomLog /var/log/{{ http_service_name }}/keystone_access.log combined + + <Directory /usr/bin> + <IfVersion >= 2.4> + Require all granted + </IfVersion> + <IfVersion < 2.4> + Order allow,deny + Allow from all + </IfVersion> + </Directory> +</VirtualHost> + +<VirtualHost {{ internal_ip }}:35357> + WSGIDaemonProcess keystone-admin processes=4 threads={{ work_threads }} user=keystone group=keystone display-name=%{GROUP} + WSGIProcessGroup keystone-admin + WSGIScriptAlias / /usr/bin/keystone-wsgi-admin + WSGIApplicationGroup %{GLOBAL} + WSGIPassAuthorization On + <IfVersion >= 2.4> + ErrorLogFormat "%{cu}t %M" + </IfVersion> + ErrorLog /var/log/{{ http_service_name }}/keystone.log + CustomLog /var/log/{{ http_service_name }}/keystone_access.log combined + + <Directory /usr/bin> + <IfVersion >= 2.4> + Require all granted + </IfVersion> + <IfVersion < 2.4> + Order allow,deny + Allow from all + </IfVersion> + </Directory> +</VirtualHost> diff --git a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/files/controllers.py b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/files/controllers.py index b4466ef6..f6ec8be5 100644 --- a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/files/controllers.py +++ b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/files/controllers.py @@ -7,7 +7,7 @@ from keystone.common import controller from keystone import config from keystone import exception from keystone.models import token_model -from keystone.contrib.moon.exception import * # noqa +from keystone.contrib.moon.exception import * # noqa: F403 from oslo_log import log from uuid import uuid4 import requests @@ -17,7 +17,7 @@ CONF = config.CONF LOG = log.getLogger(__name__) -@dependency.requires('configuration_api') +@dependency.requires('configuration_api') # noqa: F405 class Configuration(controller.V3Controller): collection_name = 'configurations' member_name = 'configuration' @@ -48,7 +48,7 @@ class Configuration(controller.V3Controller): user_id) -@dependency.requires('tenant_api', 'resource_api') +@dependency.requires('tenant_api', 'resource_api') # noqa: F405 class Tenants(controller.V3Controller): def __init__(self): @@ -152,7 +152,7 @@ def callback(self, context, prep_info, *args, **kwargs): raise exception.Unauthorized -@dependency.requires('authz_api') +@dependency.requires('authz_api') # noqa: F405 class Authz_v3(controller.V3Controller): def __init__(self): @@ -168,7 +168,7 @@ class Authz_v3(controller.V3Controller): return {'authz': False, 'comment': unicode(e)} -@dependency.requires('admin_api', 'root_api') +@dependency.requires('admin_api', 'root_api') # noqa: F405 class IntraExtensions(controller.V3Controller): collection_name = 'intra_extensions' member_name = 'intra_extension' @@ -926,7 +926,7 @@ class IntraExtensions(controller.V3Controller): user_id, intra_extension_id, sub_meta_rule_id, rule_id, rule_list) -@dependency.requires('authz_api') +@dependency.requires('authz_api') # noqa: F405 class InterExtensions(controller.V3Controller): def __init__(self): @@ -968,7 +968,7 @@ class InterExtensions(controller.V3Controller): # self.interextension_api.delete_inter_extension(kw['inter_extension_id']) -@dependency.requires('moonlog_api', 'authz_api') +@dependency.requires('moonlog_api', 'authz_api') # noqa: F405 class Logs(controller.V3Controller): def __init__(self): @@ -987,7 +987,7 @@ class Logs(controller.V3Controller): return self.moonlog_api.get_logs(user_id, options) -@dependency.requires('identity_api', "token_provider_api", "resource_api") +@dependency.requires('identity_api', "token_provider_api", "resource_api") # noqa: F405 class MoonAuth(controller.V3Controller): def __init__(self): diff --git a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/tasks/moon-controller.yml b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/tasks/moon-controller.yml index 7a507c88..95dd2e89 100644 --- a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/tasks/moon-controller.yml +++ b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/tasks/moon-controller.yml @@ -142,7 +142,7 @@ ############################################# - name: wait for keystone ready - wait_for: port=35357 delay=3 timeout=10 host={{ internal_vip.ip }} + wait_for: port=35357 delay=3 timeout=10 host={{ internal_ip }} #- name: cron job to purge expired tokens hourly # cron: diff --git a/deploy/adapters/ansible/openstack_newton_xenial/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack_newton_xenial/HA-ansible-multinodes.yml index 9fb2ee19..25847ce5 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/HA-ansible-multinodes.yml @@ -71,7 +71,7 @@ - glance - neutron-common - neutron-network -# - ceilometer_controller + - ceilometer_controller - dashboard - heat # - aodh diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/handlers/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/handlers/main.yml new file mode 100644 index 00000000..10b7c683 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/handlers/main.yml @@ -0,0 +1,16 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +- name: restart ceilometer service + service: name={{ item }} state=restarted enabled=yes + with_items: ceilometer_services + +- name: restart nova service + service: name={{ item }} state=restarted enabled=yes + with_items: nova_services diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/ceilometer_config.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/ceilometer_config.yml new file mode 100644 index 00000000..b429d65b --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/ceilometer_config.yml @@ -0,0 +1,37 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: copy configs + template: + src: "{{ item }}" + dest: /opt/os_templates + with_items: + - ceilometer.conf.j2 + - nova.conf.j2 + +- name: update ceilometer configs + shell: crudini --merge {{ item.dest }} < /opt/os_templates/{{ item.src }} + with_items: + - src: nova.conf.j2 + dest: /etc/nova/nova.conf + notify: restart nova service + +- name: delete config + file: + path: /opt/os_templates/nova.conf.j2 + state: absent + +- name: write services to monitor list + lineinfile: dest=/opt/service create=yes line='{{ item }}' + with_items: ceilometer_services + +- meta: flush_handlers + diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/ceilometer_install.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/ceilometer_install.yml new file mode 100644 index 00000000..0f2ba3d2 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/ceilometer_install.yml @@ -0,0 +1,35 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + +- name: install ceilometer packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: ceilometer_packages | union(packages_noarch) + +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + +- name: update ceilometer configs + template: + src: ceilometer.conf.j2 + dest: /etc/ceilometer/ceilometer.conf + backup: yes + notify: restart ceilometer service + diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/main.yml new file mode 100644 index 00000000..1e3c04d7 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/tasks/main.yml @@ -0,0 +1,22 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +- include: ceilometer_install.yml + tags: + - install + - ceilometer_install + - ceilometer + +- include: ceilometer_config.yml + tags: + - config + - ceilometer_config + - ceilometer + +- meta: flush_handlers diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/templates/ceilometer.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/templates/ceilometer.conf.j2 new file mode 100644 index 00000000..f388df41 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/templates/ceilometer.conf.j2 @@ -0,0 +1,45 @@ +{% set memcached_servers = [] %} +{% for host in haproxy_hosts.values() %} +{% set _ = memcached_servers.append('%s:11211'% host) %} +{% endfor %} +{% set memcached_servers = memcached_servers|join(',') %} + +[DEFAULT] +verbose = True +rpc_backend = rabbit +auth_strategy = keystone + +[publisher] +metering_secret = {{ metering_secret }} + +[keystone_authtoken] +auth_uri = http://{{ internal_vip.ip }}:5000 +auth_url = http://{{ internal_vip.ip }}:35357 +memcached_servers = {{ memcached_servers }} +auth_type = password +project_domain_name = default +user_domain_name = default +project_name = service +username = ceilometer +password = {{ CEILOMETER_PASS }} + +auth_plugin = password +project_domain_id = default +user_domain_id = default + +[oslo_messaging_rabbit] +rabbit_host = {{ rabbit_host }} +rabbit_userid = {{ RABBIT_USER }} +rabbit_password = {{ RABBIT_PASS }} + +[service_credentials] +auth_url = http://{{ internal_vip.ip }}:5000 +project_domain_id = default +user_domain_id = default +auth_type = password +username = ceilometer +project_name = service +password = {{ CEILOMETER_PASS }} +interface = internalURL +region_name = RegionOne + diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/templates/nova.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/templates/nova.conf.j2 new file mode 100644 index 00000000..68ffdc0a --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/templates/nova.conf.j2 @@ -0,0 +1,7 @@ +[DEFAULT] +instance_usage_audit = True +instance_usage_audit_period = hour +notify_on_state_change = vm_and_task_state + +[oslo_messaging_notifications] +driver = messagingv2 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/Debian.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/Debian.yml new file mode 100644 index 00000000..1bf3956f --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/Debian.yml @@ -0,0 +1,17 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +ceilometer_packages: + - ceilometer-agent-compute + +ceilometer_services: + - ceilometer-agent-compute + +nova_services: + - nova-compute diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/RedHat.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/RedHat.yml new file mode 100644 index 00000000..c5778a49 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/RedHat.yml @@ -0,0 +1,17 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +ceilometer_packages: + - openstack-ceilometer-compute + - python-ceilometerclient + - python-pecan + +ceilometer_services: + - openstack-ceilometer-compute + - openstack-nova-compute diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/main.yml new file mode 100644 index 00000000..209e1e00 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_compute/vars/main.yml @@ -0,0 +1,11 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +packages_noarch: [] +metering_secret: 1c5df72079b31fb47747 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/handlers/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/handlers/main.yml new file mode 100644 index 00000000..a3bfb85d --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/handlers/main.yml @@ -0,0 +1,22 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +- name: restart ceilometer service + service: name={{ item }} state=restarted enabled=yes + with_items: ceilometer_services + +- name: restart glance_cinder service + service: name={{ item }} state=restarted enabled=yes + with_items: glance_cinder_services + +- name: reload apache server + service: name=apache2 state=reloaded + +- name: restart apache server + service: name=apache2 state=restarted enabled=yes diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/ceilometer_config.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/ceilometer_config.yml new file mode 100644 index 00000000..7f5209c1 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/ceilometer_config.yml @@ -0,0 +1,71 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: update apache2 configs + template: + src: wsgi-ceilometer.conf.j2 + dest: /etc/apache2/sites-available/ceilometer.conf + notify: reload apache server + +- name: enable ceilometer server + file: + src: /etc/apache2/sites-available/ceilometer.conf + dest: /etc/apache2/sites-enabled/ceilometer.conf + state: "link" + when: ansible_os_family == 'Debian' + notify: reload apache server + +- name: assure listen port exist + shell: echo "Listen {{ internal_ip }}:8777" >> /etc/apache2/ports.conf + notify: + - restart apache server + +- name: copy glance & cinder configs + template: + src: "{{ item }}" + dest: /opt/os_templates + with_items: + - cinder.conf.j2 + - glance-api.conf.j2 + - glance-registry.conf.j2 + +- name: update configs + shell: crudini --merge {{ item.dest }} < /opt/os_templates/{{ item.src }} + with_items: + - src: cinder.conf.j2 + dest: /etc/cinder/cinder.conf + - src: glance-api.conf.j2 + dest: /etc/glance/glance-api.conf + - src: glance-registry.conf.j2 + dest: /etc/glance/glance-registry.conf + notify: restart glance_cinder service + +- name: delete configs + file: + path: /opt/os_templates/{{ item }} + state: absent + with_items: + - cinder.conf.j2 + - glance-api.conf.j2 + - glance-registry.conf.j2 + +- name: change meter polling interval to 300s + replace: + dest: /etc/ceilometer/pipeline.yaml + regexp: 'interval: .+' + replace: 'interval: 300' + notify: restart ceilometer service + +- name: write services to monitor list + lineinfile: dest=/opt/service create=yes line='{{ item }}' + with_items: ceilometer_services + +- meta: flush_handlers diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/ceilometer_install.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/ceilometer_install.yml new file mode 100644 index 00000000..0f2ba3d2 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/ceilometer_install.yml @@ -0,0 +1,35 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + +- name: install ceilometer packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: ceilometer_packages | union(packages_noarch) + +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + +- name: update ceilometer configs + template: + src: ceilometer.conf.j2 + dest: /etc/ceilometer/ceilometer.conf + backup: yes + notify: restart ceilometer service + diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/main.yml new file mode 100644 index 00000000..1e3c04d7 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/tasks/main.yml @@ -0,0 +1,22 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +- include: ceilometer_install.yml + tags: + - install + - ceilometer_install + - ceilometer + +- include: ceilometer_config.yml + tags: + - config + - ceilometer_config + - ceilometer + +- meta: flush_handlers diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/ceilometer.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/ceilometer.conf.j2 new file mode 100644 index 00000000..50271732 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/ceilometer.conf.j2 @@ -0,0 +1,52 @@ +{% set memcached_servers = [] %} +{% for host in haproxy_hosts.values() %} +{% set _ = memcached_servers.append('%s:11211'% host) %} +{% endfor %} +{% set memcached_servers = memcached_servers|join(',') %} + +[DEFAULT] +rpc_backend = rabbit +auth_strategy = keystone +verbose = True + +[api] +host = {{ internal_ip }} + +[database] +connection = mongodb://ceilometer:{{ CEILOMETER_DBPASS }}@{{ internal_vip.ip }}:27017/ceilometer + +[keystone_authtoken] +auth_uri = http://{{ internal_vip.ip }}:5000 +auth_url = http://{{ internal_vip.ip }}:35357 +memcached_servers = {{ memcached_servers }} +auth_type = password +project_domain_name = default +user_domain_name = default +project_name = service +username = ceilometer +password = {{ CEILOMETER_PASS }} + +identity_uri = http://{{ internal_vip.ip }}:35357 +auth_plugin = password +project_domain_id = default +user_domain_id = default + +[oslo_messaging_rabbit] +rabbit_host = {{ rabbit_host }} +rabbit_userid = {{ RABBIT_USER }} +rabbit_password = {{ RABBIT_PASS }} + +[publisher] +metering_secret = {{ metering_secret }} + +[service_credentials] +auth_type = password +auth_url = http://{{ internal_vip.ip }}:5000/v3 +project_domain_name = default +user_domain_name = default +project_name = service +username = ceilometer +password = {{ CEILOMETER_PASS }} +interface = internalURL +region_name = RegionOne + diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/cinder.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/cinder.conf.j2 new file mode 100644 index 00000000..e2d19cc3 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/cinder.conf.j2 @@ -0,0 +1,2 @@ +[oslo_messaging_notifications] +driver = messagingv2 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/glance-api.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/glance-api.conf.j2 new file mode 100644 index 00000000..e2d19cc3 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/glance-api.conf.j2 @@ -0,0 +1,2 @@ +[oslo_messaging_notifications] +driver = messagingv2 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/glance-registry.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/glance-registry.conf.j2 new file mode 100644 index 00000000..e2d19cc3 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/glance-registry.conf.j2 @@ -0,0 +1,2 @@ +[oslo_messaging_notifications] +driver = messagingv2 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/wsgi-ceilometer.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/wsgi-ceilometer.conf.j2 new file mode 100644 index 00000000..a6fd6840 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/templates/wsgi-ceilometer.conf.j2 @@ -0,0 +1,25 @@ +{% set work_threads = (ansible_processor_vcpus + 1) // 2 %} +{% if work_threads > 10 %} + set work_threads = 10 +{% endif %} + +<VirtualHost {{ internal_ip }}:8777> + WSGIDaemonProcess ceilometer-api processes=4 threads={{ work_threads }} user=ceilometer group=ceilometer display-name=%{GROUP} + WSGIProcessGroup ceilometer-api + WSGIScriptAlias / /usr/lib/python2.7/dist-packages/ceilometer/api/app.wsgi + WSGIApplicationGroup %{GLOBAL} + ErrorLog /var/log/apache2/ceilometer_error.log + CustomLog /var/log/apache2/ceilometer_access.log combined + + <Directory /usr/lib/python2.7/dist-packages/ceilometer/api/> + <IfVersion >= 2.4> + Require all granted + </IfVersion> + <IfVersion < 2.4> + Order allow,deny + Allow from all + </IfVersion> + </Directory> +</VirtualHost> + +WSGISocketPrefix /var/run/apache2 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/Debian.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/Debian.yml index 2a3c3249..de860533 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/Debian.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/Debian.yml @@ -12,23 +12,15 @@ ceilometer_packages: - ceilometer-collector - ceilometer-agent-central - ceilometer-agent-notification -# - ceilometer-alarm-evaluator -# - ceilometer-alarm-notifier - python-ceilometerclient ceilometer_services: - ceilometer-agent-central - ceilometer-agent-notification - - ceilometer-api - ceilometer-collector -# - ceilometer-alarm-evaluator -# - ceilometer-alarm-notifier -ceilometer_configs_templates: - - src: ceilometer.j2 - dest: - - /etc/ceilometer/ceilometer.conf - - src: glance.j2 - dest: - - /etc/glance/glance-api.conf - - /etc/glance/glance-registry.conf +glance_cinder_services: + - glance-registry + - glance-api + - cinder-api + - cinder-scheduler diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/RedHat.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/RedHat.yml index 6c5f53ec..de860533 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/RedHat.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/RedHat.yml @@ -8,29 +8,19 @@ ############################################################################## --- ceilometer_packages: - - openstack-ceilometer-api - - openstack-ceilometer-collector - - openstack-ceilometer-central - - openstack-ceilometer-notification -# - openstack-ceilometer-alarm + - ceilometer-api + - ceilometer-collector + - ceilometer-agent-central + - ceilometer-agent-notification - python-ceilometerclient ceilometer_services: - - openstack-ceilometer-central - - openstack-ceilometer-notification - - openstack-ceilometer-api - - openstack-ceilometer-collector -# - openstack-ceilometer-alarm-evaluator -# - openstack-ceilometer-alarm-notifier + - ceilometer-agent-central + - ceilometer-agent-notification + - ceilometer-collector -ceilometer_configs_templates: - - src: ceilometer.j2 - dest: - - /etc/ceilometer/ceilometer.conf - - src: cinder.j2 - dest: - - /etc/cinder/cinder.conf - - src: glance.j2 - dest: - - /etc/glance/glance-api.conf - - /etc/glance/glance-registry.conf +glance_cinder_services: + - glance-registry + - glance-api + - cinder-api + - cinder-scheduler diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/main.yml new file mode 100644 index 00000000..209e1e00 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ceilometer_controller/vars/main.yml @@ -0,0 +1,11 @@ +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## +--- +packages_noarch: [] +metering_secret: 1c5df72079b31fb47747 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/dashboard/templates/openstack-dashboard.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/dashboard/templates/openstack-dashboard.conf.j2 new file mode 100755 index 00000000..89a70686 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/dashboard/templates/openstack-dashboard.conf.j2 @@ -0,0 +1,18 @@ +{% set work_threads = (ansible_processor_vcpus + 1) // 2 %} +{% if work_threads > 10 %} + set work_threads = 10 +{% endif %} + +<VirtualHost {{ internal_ip }}:80> + WSGIScriptAlias /horizon {{ horizon_dir }}/wsgi/django.wsgi + WSGIDaemonProcess horizon user=horizon group=horizon processes=4 threads={{ work_threads }} + WSGIProcessGroup horizon + Alias /static {{ horizon_dir }}/static/ + Alias /horizon/static {{ horizon_dir }}/static/ + <Directory {{ horizon_dir }}/wsgi> + Order allow,deny + Allow from all + </Directory> +</VirtualHost> + + diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/ext-network/tasks/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/ext-network/tasks/main.yml index 2c61ff66..f68105f1 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/ext-network/tasks/main.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/ext-network/tasks/main.yml @@ -19,7 +19,7 @@ service: name=neutron-server state=restarted enabled=yes - name: wait for neutron ready - wait_for: port=9696 delay=10 timeout=30 host={{ internal_vip.ip }} + wait_for: port=9696 delay=10 timeout=60 host={{ internal_ip }} - name: create external net shell: diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/tasks/keystone_config.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/tasks/keystone_config.yml index 35c84ce8..3fea6e28 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/tasks/keystone_config.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/tasks/keystone_config.yml @@ -92,7 +92,7 @@ - meta: flush_handlers - name: wait for keystone ready - wait_for: port=35357 delay=3 timeout=30 host={{ internal_vip.ip }} + wait_for: port=35357 delay=10 timeout=60 host={{ internal_ip }} - name: cron job to purge expired tokens hourly cron: diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/templates/wsgi-keystone.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/templates/wsgi-keystone.conf.j2 new file mode 100644 index 00000000..f5f9d339 --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/templates/wsgi-keystone.conf.j2 @@ -0,0 +1,50 @@ +{% set work_threads = (ansible_processor_vcpus + 1) // 2 %} +{% if work_threads > 10 %} + set work_threads = 10 +{% endif %} + +<VirtualHost {{ internal_ip }}:5000> + WSGIDaemonProcess keystone-public processes=4 threads={{ work_threads }} user=keystone group=keystone display-name=%{GROUP} + WSGIProcessGroup keystone-public + WSGIScriptAlias / /usr/bin/keystone-wsgi-public + WSGIApplicationGroup %{GLOBAL} + WSGIPassAuthorization On + <IfVersion >= 2.4> + ErrorLogFormat "%{cu}t %M" + </IfVersion> + ErrorLog /var/log/{{ http_service_name }}/keystone.log + CustomLog /var/log/{{ http_service_name }}/keystone_access.log combined + + <Directory /usr/bin> + <IfVersion >= 2.4> + Require all granted + </IfVersion> + <IfVersion < 2.4> + Order allow,deny + Allow from all + </IfVersion> + </Directory> +</VirtualHost> + +<VirtualHost {{ internal_ip }}:35357> + WSGIDaemonProcess keystone-admin processes=4 threads={{ work_threads }} user=keystone group=keystone display-name=%{GROUP} + WSGIProcessGroup keystone-admin + WSGIScriptAlias / /usr/bin/keystone-wsgi-admin + WSGIApplicationGroup %{GLOBAL} + WSGIPassAuthorization On + <IfVersion >= 2.4> + ErrorLogFormat "%{cu}t %M" + </IfVersion> + ErrorLog /var/log/{{ http_service_name }}/keystone.log + CustomLog /var/log/{{ http_service_name }}/keystone_access.log combined + + <Directory /usr/bin> + <IfVersion >= 2.4> + Require all granted + </IfVersion> + <IfVersion < 2.4> + Order allow,deny + Allow from all + </IfVersion> + </Directory> +</VirtualHost> diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py b/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py index f55191d4..fd107a5e 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py @@ -7,7 +7,7 @@ from keystone.common import controller from keystone import config from keystone import exception from keystone.models import token_model -from keystone.contrib.moon.exception import * # noqa +from keystone.contrib.moon.exception import * # noqa: F403 from oslo_log import log from uuid import uuid4 import requests @@ -17,7 +17,7 @@ CONF = config.CONF LOG = log.getLogger(__name__) -@dependency.requires('configuration_api') +@dependency.requires('configuration_api') # noqa: 405 class Configuration(controller.V3Controller): collection_name = 'configurations' member_name = 'configuration' @@ -48,7 +48,7 @@ class Configuration(controller.V3Controller): user_id) -@dependency.requires('tenant_api', 'resource_api') +@dependency.requires('tenant_api', 'resource_api') # noqa: 405 class Tenants(controller.V3Controller): def __init__(self): @@ -152,7 +152,7 @@ def callback(self, context, prep_info, *args, **kwargs): raise exception.Unauthorized -@dependency.requires('authz_api') +@dependency.requires('authz_api') # noqa: 405 class Authz_v3(controller.V3Controller): def __init__(self): @@ -168,7 +168,7 @@ class Authz_v3(controller.V3Controller): return {'authz': False, 'comment': unicode(e)} -@dependency.requires('admin_api', 'root_api') +@dependency.requires('admin_api', 'root_api') # noqa: 405 class IntraExtensions(controller.V3Controller): collection_name = 'intra_extensions' member_name = 'intra_extension' @@ -926,7 +926,7 @@ class IntraExtensions(controller.V3Controller): user_id, intra_extension_id, sub_meta_rule_id, rule_id, rule_list) -@dependency.requires('authz_api') +@dependency.requires('authz_api') # noqa: 405 class InterExtensions(controller.V3Controller): def __init__(self): @@ -968,7 +968,7 @@ class InterExtensions(controller.V3Controller): # self.interextension_api.delete_inter_extension(kw['inter_extension_id']) -@dependency.requires('moonlog_api', 'authz_api') +@dependency.requires('moonlog_api', 'authz_api') # noqa: 405 class Logs(controller.V3Controller): def __init__(self): @@ -987,7 +987,7 @@ class Logs(controller.V3Controller): return self.moonlog_api.get_logs(user_id, options) -@dependency.requires('identity_api', "token_provider_api", "resource_api") +@dependency.requires('identity_api', "token_provider_api", "resource_api") # noqa: 405 class MoonAuth(controller.V3Controller): def __init__(self): diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/tasks/moon-controller.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/tasks/moon-controller.yml index 7a507c88..95dd2e89 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/tasks/moon-controller.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/tasks/moon-controller.yml @@ -142,7 +142,7 @@ ############################################# - name: wait for keystone ready - wait_for: port=35357 delay=3 timeout=10 host={{ internal_vip.ip }} + wait_for: port=35357 delay=3 timeout=10 host={{ internal_ip }} #- name: cron job to purge expired tokens hourly # cron: diff --git a/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml b/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml index 574ebabd..e7e9297e 100644 --- a/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml +++ b/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml @@ -12,7 +12,7 @@ shell: su -s /bin/sh -c 'keystone-manage db_sync' keystone - name: wait for keystone ready - wait_for: port=35357 delay=3 timeout=10 host={{ internal_vip.ip }} + wait_for: port=35357 delay=3 timeout=10 host={{ internal_ip }} - name: cron job to purge expired tokens hourly cron: diff --git a/deploy/adapters/cobbler/snippets/preseed_post_install_network_config b/deploy/adapters/cobbler/snippets/preseed_post_install_network_config index 42df3cb6..cb79c556 100644 --- a/deploy/adapters/cobbler/snippets/preseed_post_install_network_config +++ b/deploy/adapters/cobbler/snippets/preseed_post_install_network_config @@ -441,7 +441,7 @@ echo "" >> /etc/network/interfaces used_logical_interface_$iname=$iname - #if $iface_type in ("slave","bond_slave","bridge_slave","bonded_bridge_slave","static") + #if $iface_type in ("slave","bond_slave","bridge_slave","bonded_bridge_slave") #set $static = 1 #end if echo "auto $iname" >> /etc/network/interfaces diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh index f1c92892..61e27051 100755 --- a/deploy/compass_vm.sh +++ b/deploy/compass_vm.sh @@ -74,6 +74,11 @@ function inject_compass_conf() { _inject_dashboard_conf } +function refresh_compass_core () { + cmd="/opt/compass/bin/refresh.sh" + exec_cmd_on_compass $cmd +} + function wait_ok() { set +x log_info "wait_compass_ok enter" diff --git a/deploy/launch.sh b/deploy/launch.sh index 4e6e1a39..9031cb62 100755 --- a/deploy/launch.sh +++ b/deploy/launch.sh @@ -71,6 +71,8 @@ if [[ "$EXPANSION" == "false" ]]; then log_error "launch_compass failed" exit 1 fi + else + refresh_compass_core fi else machines=`get_host_macs` diff --git a/deploy/network.sh b/deploy/network.sh index 6c678222..97d71880 100755 --- a/deploy/network.sh +++ b/deploy/network.sh @@ -17,6 +17,8 @@ function setup_bridge_net() net_name=$1 nic=$2 + sudo ifconfig $nic up + sudo virsh net-destroy $net_name sudo virsh net-undefine $net_name diff --git a/deploy/prepare.sh b/deploy/prepare.sh index 97771b87..06852a42 100755 --- a/deploy/prepare.sh +++ b/deploy/prepare.sh @@ -31,7 +31,8 @@ function download_iso() } function prepare_env() { - + sed -i -e 's/^#user =.*/user = "root"/g' /etc/libvirt/qemu.conf + sed -i -e 's/^#group =.*/group = "root"/g' /etc/libvirt/qemu.conf sudo service libvirt-bin restart if sudo service openvswitch-switch status|grep stop; then sudo service openvswitch-switch start diff --git a/deploy/rename_nics.py b/deploy/rename_nics.py index a460e809..21651f68 100644 --- a/deploy/rename_nics.py +++ b/deploy/rename_nics.py @@ -17,16 +17,10 @@ def rename_nics(dha_info, rsa_file, compass_ip, os_version): nic_name = interface.keys()[0] mac = interface.values()[0] - if os_version == 'xenial': - exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ - -i %s root@%s \ - 'cobbler system edit --name=%s --interface=%s --mac=%s --interface_type=static'" # noqa - % (rsa_file, compass_ip, host_name, nic_name, mac)) # noqa - else: - exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ - -i %s root@%s \ - 'cobbler system edit --name=%s --interface=%s --mac=%s'" # noqa - % (rsa_file, compass_ip, host_name, nic_name, mac)) # noqa + exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ + -i %s root@%s \ + 'cobbler system edit --name=%s --interface=%s --mac=%s --static=1'" # noqa + % (rsa_file, compass_ip, host_name, nic_name, mac)) # noqa exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ -i %s root@%s \ diff --git a/repo/constants.py b/repo/constants.py new file mode 100644 index 00000000..28cef73b --- /dev/null +++ b/repo/constants.py @@ -0,0 +1,18 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## + +"""OS version of the Docker container used for downloading PPA packages.""" + +# OS mapping +os_map = { + 'trusty': '14.04.3', + 'xenial': '16.04', + 'rhel7': '7.2.1511', + 'redhat7': 'rhel7.2'} diff --git a/repo/features/Dockerfile b/repo/features/Dockerfile new file mode 100644 index 00000000..59788953 --- /dev/null +++ b/repo/features/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:14.04.3 +MAINTAINER Yifei Xue <xueyifei@huawei.com> + +ADD ./cp_pkg.sh /cp_pkg.sh + +ADD ./feature_run.sh /feature_run.sh + +RUN mkdir run_script + +ADD ./make_pkg/* /run_script/ + +RUN apt-get update + +RUN apt-get install -y curl vim git + +RUN chmod +x /feature_run.sh + +RUN /feature_run.sh + +RUN chmod +x /cp_pkg.sh + +CMD ["/cp_pkg.sh"] diff --git a/repo/features/brahmaputra/make_odl.sh b/repo/features/brahmaputra/make_odl.sh new file mode 100644 index 00000000..32d5f6e0 --- /dev/null +++ b/repo/features/brahmaputra/make_odl.sh @@ -0,0 +1,18 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +TIMEOUT=10 + +PACKAGE_URL=http://205.177.226.237:9999 + +curl --connect-timeout $TIMEOUT -o /odl.tar.gz $PACKAGE_URL/odl.tar.gz + + diff --git a/build/packages/make_opencon-trail.sh b/repo/features/brahmaputra/make_opencon-trail.sh index 818a4a43..b68fa3c8 100644 --- a/build/packages/make_opencon-trail.sh +++ b/repo/features/brahmaputra/make_opencon-trail.sh @@ -1,3 +1,4 @@ +#!/bin/bash ############################################################################## # Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. # @@ -6,14 +7,14 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +set -ex -WORK_PATH=$(cd "$(dirname "$0")"/..; pwd) +TIMEOUT=10 -source $WORK_PATH/build/build.conf +PACKAGE_URL=http://205.177.226.237:9999 for i in open-contrail.tar.gz; do - curl --connect-timeout $TIMEOUT -o $WORK_PATH/work/repo/temp/$i $PACKAGE_URL/$i - tar -zxvf $WORK_PATH/work/repo/temp/$i -C $WORK_PATH/work/repo/packages + curl --connect-timeout $TIMEOUT -o /$i $PACKAGE_URL/$i done diff --git a/repo/features/colorado/make_kvmfornfv.sh b/repo/features/colorado/make_kvmfornfv.sh new file mode 100644 index 00000000..734083a6 --- /dev/null +++ b/repo/features/colorado/make_kvmfornfv.sh @@ -0,0 +1,65 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +TEMP_DIR=/work/repo/temp +DST_DIR=/work/repo/packages/kvmfornfv/ +export KVMFORNFV=${kvmfornfv:-https://gerrit.opnfv.org/gerrit/p/kvmfornfv.git} + + +function prepare() +{ + sudo apt-get install -y bc libtool libglib2.0-dev autoconf automake make flex bison + mkdir -p $TEMP_DIR + mkdir -p $DST_DIR + + if [ "git ls-remote $KVMFORNFV" ]; + then + git clone $KVMFORNFV $TEMP_DIR/kvmfornfv + mkdir -p $TEMP_DIR/kvmfornfv/build/{boot,usr} + fi +} + +function make_kernel() +{ + cd $TEMP_DIR/kvmfornfv/kernel + cp arch/x86/configs/opnfv.config .config + make -j8 + make -j8 modules + make INSTALL_PATH=$TEMP_DIR/kvmfornfv/build/boot install + make INSTALL_MOD_PATH=$TEMP_DIR/kvmfornfv/build modules_install +} + +function make_qemu() +{ + mkdir -p $TEMP_DIR/kvmfornfv/qemu/build + cd $TEMP_DIR/kvmfornfv/qemu/build + ../configure --prefix=$TEMP_DIR/kvmfornfv/build/usr --enable-system --enable-kvm + make -j8 + make install +} + +function make_kvmfornfv() +{ + pushd . + + prepare + make_kernel + make_qemu + + tar -czf /kvmfornfv.tar.gz \ + -C $TEMP_DIR/kvmfornfv/build . + cd - + + popd +} + +make_kvmfornfv + diff --git a/build/packages/make_odl.sh b/repo/features/colorado/make_moon.sh index 6e28702a..f484d8ef 100644 --- a/build/packages/make_odl.sh +++ b/repo/features/colorado/make_moon.sh @@ -1,3 +1,4 @@ +#!/bin/bash ############################################################################## # Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. # @@ -6,14 +7,14 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +set -ex -WORK_PATH=$(cd "$(dirname "$0")"/..; pwd) +TIMEOUT=10 -source $WORK_PATH/build/build.conf +PACKAGE_URL=http://205.177.226.237:9999 -for i in odl.tar.gz; do - curl --connect-timeout $TIMEOUT -o $WORK_PATH/work/repo/temp/$i $PACKAGE_URL/$i - tar -zxvf $WORK_PATH/work/repo/temp/$i -C $WORK_PATH/work/repo/packages +for i in moon.tar.gz; do + curl --connect-timeout $TIMEOUT -o /$i $PACKAGE_URL/$i done diff --git a/repo/features/colorado/make_odl.sh b/repo/features/colorado/make_odl.sh new file mode 100644 index 00000000..32d5f6e0 --- /dev/null +++ b/repo/features/colorado/make_odl.sh @@ -0,0 +1,18 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +TIMEOUT=10 + +PACKAGE_URL=http://205.177.226.237:9999 + +curl --connect-timeout $TIMEOUT -o /odl.tar.gz $PACKAGE_URL/odl.tar.gz + + diff --git a/repo/features/colorado/make_onos.sh b/repo/features/colorado/make_onos.sh new file mode 100644 index 00000000..ede941e9 --- /dev/null +++ b/repo/features/colorado/make_onos.sh @@ -0,0 +1,18 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +TIMEOUT=10 + +PACKAGE_URL=http://205.177.226.237:9999 + +curl --connect-timeout $TIMEOUT -o /onos.tar.gz $PACKAGE_URL/onos.tar.gz + + diff --git a/build/packages/make_onos.sh b/repo/features/colorado/make_opencon-trail.sh index 74c8969f..b68fa3c8 100644 --- a/build/packages/make_onos.sh +++ b/repo/features/colorado/make_opencon-trail.sh @@ -1,3 +1,4 @@ +#!/bin/bash ############################################################################## # Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. # @@ -6,19 +7,14 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +set -ex -WORK_PATH=$(cd "$(dirname "$0")"/..; pwd) +TIMEOUT=10 -source $WORK_PATH/build/build.conf +PACKAGE_URL=http://205.177.226.237:9999 -mkdir -p $WORK_PATH/work/repo/packages/onos -for i in repository.tar jdk-8u51-linux-x64.tar.gz; do - curl --connect-timeout $TIMEOUT -o $WORK_PATH/work/repo/packages/onos/$i $PACKAGE_URL/$i +for i in open-contrail.tar.gz; do + curl --connect-timeout $TIMEOUT -o /$i $PACKAGE_URL/$i done -git clone https://gerrit.opnfv.org/gerrit/onosfw $WORK_PATH/work/repo/temp/onosfw -pushd . -cd $WORK_PATH/work/repo/temp/onosfw/ -. autobuild.sh $WORK_PATH/work/repo/packages/onos -popd diff --git a/repo/features/danube/make_moon.sh b/repo/features/danube/make_moon.sh new file mode 100644 index 00000000..f484d8ef --- /dev/null +++ b/repo/features/danube/make_moon.sh @@ -0,0 +1,20 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +TIMEOUT=10 + +PACKAGE_URL=http://205.177.226.237:9999 + +for i in moon.tar.gz; do + curl --connect-timeout $TIMEOUT -o /$i $PACKAGE_URL/$i +done + + diff --git a/repo/features/danube/make_odl.sh b/repo/features/danube/make_odl.sh new file mode 100644 index 00000000..6a9afb9e --- /dev/null +++ b/repo/features/danube/make_odl.sh @@ -0,0 +1,22 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +TIMEOUT=10 + +PACKAGE_URL=http://205.177.226.237:9999 + +mkdir -p odl + +curl --connect-timeout $TIMEOUT -o /odl/distribution-karaf-0.5.0-Boron.tar.gz $PACKAGE_URL/distribution-karaf-0.5.0-Boron.tar.gz + +tar -zcvf odl.tar.gz /odl + + diff --git a/repo/features/danube/make_onos.sh b/repo/features/danube/make_onos.sh new file mode 100644 index 00000000..ede941e9 --- /dev/null +++ b/repo/features/danube/make_onos.sh @@ -0,0 +1,18 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +TIMEOUT=10 + +PACKAGE_URL=http://205.177.226.237:9999 + +curl --connect-timeout $TIMEOUT -o /onos.tar.gz $PACKAGE_URL/onos.tar.gz + + diff --git a/repo/features/danube/make_opencon-trail.sh b/repo/features/danube/make_opencon-trail.sh new file mode 100644 index 00000000..b68fa3c8 --- /dev/null +++ b/repo/features/danube/make_opencon-trail.sh @@ -0,0 +1,20 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +TIMEOUT=10 + +PACKAGE_URL=http://205.177.226.237:9999 + +for i in open-contrail.tar.gz; do + curl --connect-timeout $TIMEOUT -o /$i $PACKAGE_URL/$i +done + + diff --git a/build/gen_ins_pkg_script.py b/repo/gen_ins_pkg_script.py index ae6fa1c1..7f96d35d 100644 --- a/build/gen_ins_pkg_script.py +++ b/repo/gen_ins_pkg_script.py @@ -2,6 +2,7 @@ import yaml import os import sys from Cheetah.Template import Template +import constants as const def get_file_list(root, arch): @@ -50,7 +51,7 @@ def get_packages_name_list(file_list, special_packages): def generate_download_script(root="", arch="", tmpl="", docker_tmpl="", default_packages="", # noqa - special_packages="", special_packages_script_dir="", special_packages_dir=""): # noqa + special_packages="", special_packages_script_dir="", special_packages_dir="", os_ver=""): # noqa package_name_list = get_packages_name_list( get_file_list(root, arch), special_packages) if root else [] @@ -68,7 +69,7 @@ def generate_download_script(root="", arch="", tmpl="", docker_tmpl="", default_ if os.path.exists(os.path.join(special_packages_script_dir, name)): make_script.append(name) - searchList = {'scripts': make_script} + searchList = {'scripts': make_script, 'version': const.os_map[os_ver]} if os.path.exists(special_packages_dir): special_packages_names = [] @@ -86,4 +87,4 @@ def generate_download_script(root="", arch="", tmpl="", docker_tmpl="", default_ if __name__ == '__main__': # generate_download_script('ansible', 'Debian', 'Debian.tmpl') generate_download_script(sys.argv[1], sys.argv[2], sys.argv[3], - sys.argv[4], sys.argv[5].split(' '), sys.argv[6].split(' '), sys.argv[7], sys.argv[8]) # noqa + sys.argv[4], sys.argv[5].split(' '), sys.argv[6].split(' '), sys.argv[7], sys.argv[8], sys.argv[9]) # noqa diff --git a/build/jhenv_template/centos/rhel7/Dockerfile b/repo/jhenv_template/centos/rhel7/Dockerfile index a47360aa..a47360aa 100644 --- a/build/jhenv_template/centos/rhel7/Dockerfile +++ b/repo/jhenv_template/centos/rhel7/Dockerfile diff --git a/build/jhenv_template/ubuntu/trusty/Dockerfile b/repo/jhenv_template/ubuntu/trusty/Dockerfile index 83f488d2..4eeccb6c 100644 --- a/build/jhenv_template/ubuntu/trusty/Dockerfile +++ b/repo/jhenv_template/ubuntu/trusty/Dockerfile @@ -31,7 +31,7 @@ Architectures: amd64\n'\ RUN reprepro -b trusty-jh-ppa includedeb trusty jh_deb/*.deb -RUN tar -zcvf /trusty-jh-ppa.tar.gz ./trusty-jh-ppa +RUN tar -zcvf /jh-ppa-trusty.tar.gz ./trusty-jh-ppa RUN apt-get install -y python-pip @@ -41,11 +41,13 @@ RUN pip install --upgrade paramiko jinja2 PyYAML setuptools pycrypto pyasn1 \ cryptography MarkupSafe idna six enum34 ipaddress cffi pycparser \ virtualenv cheetah requests netaddr pbr oslo.config ansible -d jh_pip/ -RUN tar -zcvf env_trusty_pip.tar.gz jh_pip/ +RUN tar -zcvf jh_pip.tar.gz jh_pip/ -RUN mkdir -p /home/tmp +RUN mkdir jh_env_package -RUN cp *.tar.gz /home/tmp +RUN mv *.tar.gz jh_env_package/ + +RUN tar -zcvf jh_env_trusty.tar.gz jh_env_package/ RUN chmod +x /cp_env.sh diff --git a/build/jhenv_template/ubuntu/xenial/Dockerfile b/repo/jhenv_template/ubuntu/xenial/Dockerfile index 01462ee0..6b9b517a 100644 --- a/build/jhenv_template/ubuntu/xenial/Dockerfile +++ b/repo/jhenv_template/ubuntu/xenial/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04.3 +FROM ubuntu:16.04 MAINTAINER Yifei Xue <xueyifei@huawei.com> ADD ./cp_env.sh /cp_env.sh @@ -31,7 +31,7 @@ Architectures: amd64\n'\ RUN reprepro -b xenial-jh-ppa includedeb xenial jh_deb/*.deb -RUN tar -zcvf /xenial-jh-ppa.tar.gz ./xenial-jh-ppa +RUN tar -zcvf /jh-ppa-xenial.tar.gz ./xenial-jh-ppa RUN apt-get install -y python-pip @@ -41,12 +41,14 @@ RUN pip install --upgrade paramiko jinja2 PyYAML setuptools pycrypto pyasn1 \ cryptography MarkupSafe idna six enum34 ipaddress cffi pycparser \ virtualenv cheetah requests netaddr pbr oslo.config ansible -d jh_pip/ -RUN tar -zcvf env_xenial_pip.tar.gz jh_pip/ +RUN tar -zcvf jh_pip.tar.gz jh_pip/ -RUN mkdir -p /home/tmp +RUN mkdir jh_env_package -RUN cp *.tar.gz /home/tmp +RUN mv *.tar.gz jh_env_package/ + +RUN tar -zcvf jh_env_xenial.tar.gz jh_env_package/ RUN chmod +x /cp_env.sh -CMD ["/cp_exenial] +CMD ["/cp_env.sh"] diff --git a/repo/make_repo.sh b/repo/make_repo.sh new file mode 100755 index 00000000..b857a9fa --- /dev/null +++ b/repo/make_repo.sh @@ -0,0 +1,109 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -ex + +REPO_PATH=$(cd "$(dirname "$0")"; pwd) +COMPASS_PATH=$(cd "$(dirname "$0")"/..; pwd) + +#source $REPO_PATH/repo.conf +source $REPO_PATH/repo_func.sh + +function param_process() +{ + if [ ! -z "$1" ]; then + case $1 in + openstack) + export MAKE_OPENSTACK="true" + ;; + pip) + export MAKE_PIP="true" + ;; + feature) + export MAKE_FEATURE="true" + ;; + jumphost) + export MAKE_JH="true" + ;; + compass) + export MAKE_COMPASS="true" + ;; + all) + export MAKE_ALL="true" + ;; + help) + usage + exit + ;; + *) + echo "'$1' is not a valid parameter." + usage + exit + ;; + esac + + else + echo "Please add a valid parameter!" + usage + exit + fi +} + +function usage() +{ + echo 'Usage: ./repo/make_repo.sh [option]' + echo 'All the valid options are: + openstack Make OpenStack PPA. + pip Make pip package. + feature Make feature project package, such as SDN, Moon, KVM, etc. + jumphost Make jumphost preparasion package. + compass Make compass VM package. + all Make all packages. + help Show usage.' +} + +function main() +{ + process_env + + if [[ $MAKE_OPENSTACK == "true" ]]; then + make_osppa + fi + + if [[ $MAKE_PIP == "true" ]]; then +# make_repo --package-tag pip + make_pip_repo + fi + + if [[ $MAKE_FEATURE == "true" ]]; then +# make_repo --package-tag feature + make_feature_repo + fi + + if [[ $MAKE_JH == "true" ]]; then + make_jhenv_repo + fi + + if [[ $MAKE_COMPASS == "true" ]]; then + make_compass_repo + fi + + if [[ $MAKE_ALL == "true" ]]; then + make_osppa + make_pip_repo + make_feature_repo + make_jhenv_repo + make_compass_repo + fi + +} + +param_process "$@" + +main diff --git a/build/os/centos/rhel7/mitaka/Dockerfile.tmpl b/repo/openstack/make_ppa/centos/Dockerfile.tmpl index 2ea2b828..1095ee1a 100644 --- a/build/os/centos/rhel7/mitaka/Dockerfile.tmpl +++ b/repo/openstack/make_ppa/centos/Dockerfile.tmpl @@ -1,4 +1,5 @@ -FROM centos:7.2.1511 +#set version = $getVar('version', []) +FROM centos:$version MAINTAINER Chigang(Justin) <chigang@huawei.com> # set cache enable diff --git a/build/os/centos/ceph_key_release.asc b/repo/openstack/make_ppa/centos/ceph_key_release.asc index d2961c52..d2961c52 100644 --- a/build/os/centos/ceph_key_release.asc +++ b/repo/openstack/make_ppa/centos/ceph_key_release.asc diff --git a/build/os/centos/comps.xml b/repo/openstack/make_ppa/centos/comps.xml index ac1c1394..ac1c1394 100644 --- a/build/os/centos/comps.xml +++ b/repo/openstack/make_ppa/centos/comps.xml diff --git a/build/templates/compass_core.tmpl b/repo/openstack/make_ppa/centos/rhel7/compass/download_pkg.tmpl index 1cb34b49..1cb34b49 100644 --- a/build/templates/compass_core.tmpl +++ b/repo/openstack/make_ppa/centos/rhel7/compass/download_pkg.tmpl diff --git a/build/templates/RedHat_juno.tmpl b/repo/openstack/make_ppa/centos/rhel7/juno/download_pkg.tmpl index 3e172637..7a87d2d1 100644 --- a/build/templates/RedHat_juno.tmpl +++ b/repo/openstack/make_ppa/centos/rhel7/juno/download_pkg.tmpl @@ -15,7 +15,7 @@ yum clean all yum install yum-plugin-priorities -y yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm -y -yum install http://rdo.fedorapeople.org/openstack-$OPV/rdo-release-$OPV.rpm -y +yum install http://rdo.fedorapeople.org/openstack-$OPV/rdo-release-${OPV}.rpm -y # modify centos7 repo for workaround sed -i 's/epel-Derived from Red Hat Enterprise Linux 7.1 (Source)/epel-7/g' /etc/yum.repos.d/rdo-release.repo diff --git a/build/templates/RedHat_kilo.tmpl b/repo/openstack/make_ppa/centos/rhel7/kilo/download_pkg.tmpl index f9942d8f..9aad1b33 100644 --- a/build/templates/RedHat_kilo.tmpl +++ b/repo/openstack/make_ppa/centos/rhel7/kilo/download_pkg.tmpl @@ -15,7 +15,7 @@ yum clean all yum install yum-plugin-priorities -y yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm -y -yum install http://rdo.fedorapeople.org/openstack-$OPV/rdo-release-$OPV.rpm -y +yum install http://rdo.fedorapeople.org/openstack-$OPV/rdo-release-${OPV}.rpm -y # modify centos7 repo for workaround sed -i 's/epel-Derived from Red Hat Enterprise Linux 7.1 (Source)/epel-7/g' /etc/yum.repos.d/rdo-release.repo diff --git a/build/templates/RedHat_liberty.tmpl b/repo/openstack/make_ppa/centos/rhel7/liberty/download_pkg.tmpl index 24781785..24781785 100644 --- a/build/templates/RedHat_liberty.tmpl +++ b/repo/openstack/make_ppa/centos/rhel7/liberty/download_pkg.tmpl diff --git a/build/templates/RedHat_mitaka.tmpl b/repo/openstack/make_ppa/centos/rhel7/mitaka/download_pkg.tmpl index 4d6b26fd..4d6b26fd 100644 --- a/build/templates/RedHat_mitaka.tmpl +++ b/repo/openstack/make_ppa/centos/rhel7/mitaka/download_pkg.tmpl diff --git a/build/os/centos/rhel7/juno/Dockerfile.tmpl b/repo/openstack/make_ppa/redhat/Dockerfile.tmpl index adb930ff..9ea32e62 100644 --- a/build/os/centos/rhel7/juno/Dockerfile.tmpl +++ b/repo/openstack/make_ppa/redhat/Dockerfile.tmpl @@ -1,4 +1,5 @@ -FROM centos:7.1.1503 +#set version = $getVar('version', []) +FROM registry.access.redhat.com/$version MAINTAINER Chigang(Justin) <chigang@huawei.com> # set cache enable diff --git a/build/os/redhat/ceph_key_release.asc b/repo/openstack/make_ppa/redhat/ceph_key_release.asc index d2961c52..d2961c52 100644 --- a/build/os/redhat/ceph_key_release.asc +++ b/repo/openstack/make_ppa/redhat/ceph_key_release.asc diff --git a/build/os/redhat/comps.xml b/repo/openstack/make_ppa/redhat/comps.xml index ac1c1394..ac1c1394 100644 --- a/build/os/redhat/comps.xml +++ b/repo/openstack/make_ppa/redhat/comps.xml diff --git a/build/templates/RedHat_redhat7_osp9.tmpl b/repo/openstack/make_ppa/redhat/redhat7/osp9/download_pkg.tmpl index 24a0928f..24a0928f 100644 --- a/build/templates/RedHat_redhat7_osp9.tmpl +++ b/repo/openstack/make_ppa/redhat/redhat7/osp9/download_pkg.tmpl diff --git a/build/os/ubuntu/trusty/mitaka/Dockerfile.tmpl b/repo/openstack/make_ppa/ubuntu/Dockerfile.tmpl index ad14fa59..11a4059a 100644 --- a/build/os/ubuntu/trusty/mitaka/Dockerfile.tmpl +++ b/repo/openstack/make_ppa/ubuntu/Dockerfile.tmpl @@ -1,4 +1,5 @@ -FROM ubuntu:14.04.3 +#set version = $getVar('version', []) +FROM ubuntu:$version MAINTAINER Chigang(Justin) <chigang@huawei.com> #RUN apt-get update diff --git a/build/templates/Debian_juno.tmpl b/repo/openstack/make_ppa/ubuntu/trusty/juno/download_pkg.tmpl index 95375693..95375693 100644 --- a/build/templates/Debian_juno.tmpl +++ b/repo/openstack/make_ppa/ubuntu/trusty/juno/download_pkg.tmpl diff --git a/build/templates/Debian_kilo.tmpl b/repo/openstack/make_ppa/ubuntu/trusty/kilo/download_pkg.tmpl index 18c7fa00..18c7fa00 100644 --- a/build/templates/Debian_kilo.tmpl +++ b/repo/openstack/make_ppa/ubuntu/trusty/kilo/download_pkg.tmpl diff --git a/build/templates/Debian_liberty.tmpl b/repo/openstack/make_ppa/ubuntu/trusty/liberty/download_pkg.tmpl index 4bb209eb..4bb209eb 100644 --- a/build/templates/Debian_liberty.tmpl +++ b/repo/openstack/make_ppa/ubuntu/trusty/liberty/download_pkg.tmpl diff --git a/build/templates/Debian_mitaka.tmpl b/repo/openstack/make_ppa/ubuntu/trusty/mitaka/download_pkg.tmpl index 7df519de..7df519de 100644 --- a/build/templates/Debian_mitaka.tmpl +++ b/repo/openstack/make_ppa/ubuntu/trusty/mitaka/download_pkg.tmpl diff --git a/build/templates/Debian_xenial_mitaka.tmpl b/repo/openstack/make_ppa/ubuntu/xenial/mitaka/download_pkg.tmpl index f82da632..f82da632 100644 --- a/build/templates/Debian_xenial_mitaka.tmpl +++ b/repo/openstack/make_ppa/ubuntu/xenial/mitaka/download_pkg.tmpl diff --git a/build/templates/Debian_xenial_newton.tmpl b/repo/openstack/make_ppa/ubuntu/xenial/newton/download_pkg.tmpl index 84f28700..e10d4e22 100644 --- a/build/templates/Debian_xenial_newton.tmpl +++ b/repo/openstack/make_ppa/ubuntu/xenial/newton/download_pkg.tmpl @@ -5,8 +5,7 @@ set -ex # add openstack $OPV repo apt-get update && apt-get install -y software-properties-common -add-apt-repository -y cloud-archive:$OPV -apt-get update && apt-get -y dist-upgrade +# sudo add-apt-repository -y cloud-archive:$OPV apt-get install -d nova-compute-kvm -y #make pernoca database diff --git a/repo/openstack/pip/Dockerfile b/repo/openstack/pip/Dockerfile new file mode 100644 index 00000000..195b6a01 --- /dev/null +++ b/repo/openstack/pip/Dockerfile @@ -0,0 +1,30 @@ +FROM ubuntu:14.04.3 +MAINTAINER Yifei Xue <xueyifei@huawei.com> + +ADD ./code_url.conf /code_url.conf + +RUN chmod +x code_url.conf + +ADD ./make_pip.sh /make_pip.sh + +RUN chmod +x make_pip.sh + +ADD ./cp_pip.sh /cp_pip.sh + +RUN chmod +x cp_pip.sh + +RUN apt-get update + +RUN apt-get install -y git python-setuptools + +RUN easy_install -U pip + +RUN mkdir -p /home/tmp + +RUN mkdir -p openstack_pip + +RUN /make_pip.sh + +RUN tar -zcvf openstack_pip.tar.gz openstack_pip/ + +CMD ["/cp_pip.sh"] diff --git a/repo/openstack/pip/code_url.conf b/repo/openstack/pip/code_url.conf new file mode 100644 index 00000000..fa7b02e3 --- /dev/null +++ b/repo/openstack/pip/code_url.conf @@ -0,0 +1,21 @@ +#export BRANCH=${BRANCH:-master} +export BRANCH=${BRANCH:-stable/newton} + +export GIT_URL="https://github.com/openstack/keystone.git \ + https://github.com/openstack/python-keystoneclient.git \ + https://github.com/openstack/nova.git \ + https://github.com/openstack/python-novaclient.git \ + https://github.com/openstack/neutron.git \ + https://github.com/openstack/python-neutronclient.git \ + https://github.com/openstack/cinder.git \ + https://github.com/openstack/python-cinderclient.git \ + https://github.com/openstack/glance.git \ + https://github.com/openstack/python-glanceclient.git \ + https://github.com/openstack/ceilometer.git \ + https://github.com/openstack/python-ceilometerclient.git \ + https://github.com/openstack/heat.git \ + https://github.com/openstack/python-heatclient.git \ + https://github.com/openstack/aodh.git \ + https://github.com/openstack/python-aodhclient.git \ + https://github.com/openstack/tacker.git \ + https://github.com/openstack/python-tackerclient.git " diff --git a/build/arch/Debian/make_openvswitch-switch.sh b/repo/openstack/special_pkg/Debian/make_openvswitch-switch.sh index 2095e0dc..2095e0dc 100644 --- a/build/arch/Debian/make_openvswitch-switch.sh +++ b/repo/openstack/special_pkg/Debian/make_openvswitch-switch.sh diff --git a/build/arch/RedHat/make_jdk.sh b/repo/openstack/special_pkg/RedHat/make_jdk.sh index cea9e970..cea9e970 100644 --- a/build/arch/RedHat/make_jdk.sh +++ b/repo/openstack/special_pkg/RedHat/make_jdk.sh diff --git a/build/arch/RedHat/make_kibana.sh b/repo/openstack/special_pkg/RedHat/make_kibana.sh index bcbef7c8..bcbef7c8 100644 --- a/build/arch/RedHat/make_kibana.sh +++ b/repo/openstack/special_pkg/RedHat/make_kibana.sh diff --git a/repo/repo.conf b/repo/repo.conf new file mode 100644 index 00000000..11a44565 --- /dev/null +++ b/repo/repo.conf @@ -0,0 +1,95 @@ +TIMEOUT=100 + +#REPO_PATH=$(cd "$(dirname "$0")"; pwd) +#WORK_PATH=$(cd "$(dirname "$0")"/..; pwd) + +# switch for each repo +#export MAKE_OPENSTACK=${MAKE_OPENSTACK:-"false"} +#export MAKE_PIP=${MAKE_PIP:-"false"} +#export MAKE_FEATURE=${MAKE_FEATURE:-"false"} +#export MAKE_JH=${MAKE_JH:-"false"} +#export MAKE_COMPASS=${MAKE_COMPASS:-"false"} +#export MAKE_ALL=${MAKE_ALL:-"false"} +export JUMP_HOST="trusty" +# PACKAGE_URL will be reset in Jenkins for different branch +export PACKAGE_URL=${PACKAGE_URL:-http://205.177.226.237:9999} + +# feature packages +export KVMFORNFV=${kvmfornfv:-https://gerrit.opnfv.org/gerrit/p/kvmfornfv.git} + +export OPNFV_VERSION="brahmaputra colorado danube" + +export SPECIAL_PIP_PACKAGE="https://bootstrap.pypa.io/ez_setup.py \ + https://pypi.python.org/packages/source/s/setuptools/setuptools-18.2.zip \ + https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz \ + https://pypi.python.org/packages/source/a/ansible/ansible-1.9.2.tar.gz \ + https://pypi.python.org/packages/source/v/virtualenv/virtualenv-13.1.2.tar.gz \ + https://pypi.python.org/packages/source/p/pexpect/pexpect-3.3.tar.gz \ + https://pypi.python.org/packages/source/a/amqplib/amqplib-1.0.2.tgz \ + https://pypi.python.org/packages/source/M/Markdown/Markdown-2.4.tar.gz \ + https://pypi.python.org/packages/source/C/Cheetah/Cheetah-2.4.1.tar.gz \ + https://pypi.python.org/packages/source/d/daemon/daemon-1.1.tar.gz \ + https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz \ + https://pypi.python.org/packages/source/F/Flask-Login/Flask-Login-0.2.11.tar.gz \ + https://pypi.python.org/packages/2.7/F/Flask-RESTful/Flask_RESTful-0.3.4-py2.py3-none-any.whl \ + https://pypi.python.org/packages/2.7/F/Flask-WTF/Flask_WTF-0.12-py2-none-any.whl \ + https://pypi.python.org/packages/source/i/importlib/importlib-1.0.3.tar.bz2 \ + https://pypi.python.org/packages/py2/l/lockfile/lockfile-0.10.2-py2-none-any.whl \ + https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip \ + https://pypi.python.org/packages/any/n/netaddr/netaddr-0.7.18-py2.py3-none-any.whl \ + https://pypi.python.org/packages/source/P/PyChef/PyChef-0.2.3.tar.gz \ + https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-1.0.8.tar.gz \ + https://pypi.python.org/packages/source/s/simplejson/simplejson-3.8.0.tar.gz \ + https://pypi.python.org/packages/2.7/r/requests/requests-2.7.0-py2.py3-none-any.whl \ + https://pypi.python.org/packages/2.7/c/celery/celery-3.1.18-py2.py3-none-any.whl \ + https://pypi.python.org/packages/2.7/W/Werkzeug/Werkzeug-0.10.4-py2.py3-none-any.whl \ + https://pypi.python.org/packages/source/c/ciso8601/ciso8601-1.0.1.tar.gz \ + https://pypi.python.org/packages/3.3/s/six/six-1.9.0-py2.py3-none-any.whl \ + https://pypi.python.org/packages/2.7/W/WTForms/WTForms-2.0.2-py2.py3-none-any.whl \ + https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz \ + https://pypi.python.org/packages/2.7/a/amqp/amqp-1.4.6-py2-none-any.whl \ + https://pypi.python.org/packages/any/M/Markdown/Markdown-2.6.2-py2.py3-none-any.whl \ + https://pypi.python.org/packages/2.7/a/argparse/argparse-1.3.0-py2.py3-none-any.whl \ + https://pypi.python.org/packages/source/F/Flask-Script/Flask-Script-2.0.5.tar.gz \ + https://pypi.python.org/packages/source/F/Flask-SQLAlchemy/Flask-SQLAlchemy-0.10.tar.gz \ + https://pypi.python.org/packages/source/l/lazypy/lazypy-0.2.tar.gz \ + https://pypi.python.org/packages/source/p/pytz/pytz-2014.3.zip \ + https://pypi.python.org/packages/source/b/billiard/billiard-3.3.0.3.tar.gz \ + https://pypi.python.org/packages/source/a/anyjson/anyjson-0.1.tar.gz \ + https://pypi.python.org/packages/2.7/k/kombu/kombu-3.0.17-py2.py3-none-any.whl \ + https://pypi.python.org/packages/source/a/aniso8601/aniso8601-0.48.tar.gz \ + https://pypi.python.org/packages/2.7/e/ecdsa/ecdsa-0.12-py2.py3-none-any.whl \ + https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz \ + https://pypi.python.org/packages/source/i/itsdangerous/itsdangerous-0.24.tar.gz \ + https://pypi.python.org/packages/source/p/paramiko/paramiko-1.12.3.tar.gz \ + https://pypi.python.org/packages/3.4/p/python-daemon/python_daemon-2.0.4-py2.py3-none-any.whl \ + https://pypi.python.org/packages/source/r/redis/redis-2.7.1.tar.gz \ + https://pypi.python.org/packages/source/b/billiard/billiard-3.3.0.20.tar.gz \ + https://pypi.python.org/packages/2.7/k/kombu/kombu-3.0.26-py2.py3-none-any.whl \ + https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.8.tar.gz \ + https://pypi.python.org/packages/source/a/aniso8601/aniso8601-0.85.tar.gz \ + https://pypi.python.org/packages/source/a/anyjson/anyjson-0.3.3.tar.gz \ + https://pypi.python.org/packages/source/o/ordereddict/ordereddict-1.0.tar.gz \ + https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz \ + https://pypi.python.org/packages/source/l/lazypy/lazypy-0.5.tar.gz \ + https://pypi.python.org/packages/source/p/pycrypto-on-pypi/pycrypto-on-pypi-2.3.tar.gz \ + https://pypi.python.org/packages/source/p/pymongo/pymongo-3.0.3.tar.gz \ + https://pypi.python.org/packages/source/c/crudini/crudini-0.7.tar.gz \ + https://pypi.python.org/packages/source/n/networking-odl/networking-odl-1.0.1.tar.gz \ + https://pypi.python.org/packages/source/p/python-keyczar/python-keyczar-0.715.tar.gz \ + https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.9.tar.gz \ + https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz \ + https://pypi.python.org/packages/source/c/cliff/cliff-1.15.0.tar.gz \ + https://pypi.python.org/packages/6e/96/ba2a2462ed25ca0e651fb7b66e7080f5315f91425a07ea5b34d7c870c114/Babel-2.3.4.tar.gz \ + https://pypi.python.org/packages/93/ba/7be92c44a984ff23bc13fa4dfffe01422cfd343b09ada7356bb16bae4ef7/tosca-parser-0.5.0.tar.gz \ + https://pypi.python.org/packages/c3/52/85a606f541d627164b8159fd68da9e945ecec375d185069c05b84d5e4aa1/heat-translator-0.5.0.tar.gz \ + https://pypi.python.org/packages/98/92/9c91d88316ecab35e0b1f23a2d757bd9a4ce73de6caba309ac29e66f2cfd/yang2tosca-0.13.tar.gz \ + https://pypi.python.org/packages/41/40/0c951f9c78a9be150b432ff50700c3b8d1cd3ef1ec53f00d08b2a7ecc64e/oslo.concurrency-3.11.0.tar.gz \ + https://pypi.python.org/packages/61/b9/74514d774df110799ff2b100979de6180ead1d5eec6fa15c52e6299361ea/oslo.service-1.12.0.tar.gz \ + https://pypi.python.org/packages/9f/ec/d8bf0623d7d940c09052368ee859f726410e54b16b13f477ac0e70416de6/neutron-lib-0.2.0.tar.gz \ + https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.2.tar.gz " + +export PIP_PACKAGE="https://pypi.python.org/packages/0d/af/8ccfb73834a6ddf9d57ecac61466557b7ca0722620bbb16d2d069ce312db/networking-odl-2.0.0.tar.gz \ + https://pypi.python.org/packages/90/4f/74b730294de1db393e3e82211b5d2115f9a763849abca7d014348a550d2a/oslosphinx-4.5.0.tar.gz \ + https://pypi.python.org/packages/74/f0/386f7f73aa6628c1bef53874c5d453b556356d77732add69000aa53b353b/policy2tosca-1.0.tar.gz " + diff --git a/repo/repo_func.sh b/repo/repo_func.sh new file mode 100755 index 00000000..e5d2a244 --- /dev/null +++ b/repo/repo_func.sh @@ -0,0 +1,502 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 +############################################################################## + +function process_env() +{ + mkdir -p ${COMPASS_PATH}/work/repo/ ${COMPASS_PATH}/work/repo/pip + + set +e + sudo docker info + if [[ $? != 0 ]]; then + wget -qO- https://get.docker.com/ | sh + else + echo "docker is already installed!" + fi + set -e + +cat <<EOF >${COMPASS_PATH}/work/repo/cp_repo.sh +#!/bin/bash +set -ex +cp /*.tar.gz /result -f +EOF + + sudo apt-get -f install + sudo apt-get install python-yaml -y + sudo apt-get install python-cheetah -y + + source ${COMPASS_PATH}/repo/repo.conf +} + +function make_repo() +{ + rm -f ${COMPASS_PATH}/work/repo/install_packages.sh + rm -f ${COMPASS_PATH}/work/repo/Dockerfile + + option=`echo "os-ver:,package-tag:,tmpl:,default-package:, \ + special-package:,special-package-script-dir:, \ + special-package-dir:,ansible-dir:" | sed 's/ //g'` + + TEMP=`getopt -o h -l $option -n 'repo_func.sh' -- "$@"` + + if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi + + eval set -- "$TEMP" + + os_ver="" + package_tag="" + tmpl="" + default_package="" + special_package="" + special_package_script_dir="" + special_package_dir="" + ansible_dir="" + ansible_dir_tmp="" + while :; do + case "$1" in + --os-ver) os_ver=$2; shift 2;; + --package-tag) package_tag=$2; shift 2;; + --tmpl) tmpl=$2; shift 2;; + --default-package) default_package=$2; shift 2;; + --special-package) special_package=$2; shift 2;; + --special-package-script-dir) special_package_script_dir=$2; shift 2;; + --special-package-dir) special_package_dir=$2; shift 2;; + --ansible-dir) ansible_dir=$2; shift 2;; + --) shift; break;; + *) echo "Internal error! $1" ; exit 1 ;; + esac + done + +# if [[ -n ${package_tag} && ${package_tag} == "pip" ]]; then +# make_pip_repo +# return +# fi + +# if [[ -n ${package_tag} && ${package_tag} == "jhenv" && -n ${jh_os} ]]; then +# make_jhenv_repo +# return +# fi + +# if [[ -n ${package_tag} && ${package_tag} == "feature" ]]; then +# make_feature_repo +# return +# fi + + if [[ -z ${os_ver} || -z ${package_tag} ]]; then + echo "parameter is wrong" + exit 1 + fi + + if [[ ${os_ver} == trusty || ${os_ver} == xenial ]]; then + arch=Debian + os_name=ubuntu + fi + + if [[ ${os_ver} =~ rhel[0-9]*$ ]]; then + arch=RedHat + os_name=centos + fi + + if [[ ${os_ver} =~ redhat[0-9]*$ ]]; then + arch=RedHat + os_name=redhat +# tmpl=${BUILD_PATH}/templates/${arch}_${os_ver}_${package_tag}.tmpl + fi + + if [[ -z $arch ]]; then + echo "unsupported ${os_ver} os" + exit 1 + fi + + dockerfile=Dockerfile + docker_tmpl=${REPO_PATH}/openstack/make_ppa/${os_name}/${dockerfile}".tmpl" + docker_tag="${os_ver}/${package_tag}" + +# if [[ -z ${tmpl} ]]; then +# if [[ ${os_ver} == xenial ]]; then + tmpl=${REPO_PATH}/openstack/make_ppa/${os_name}/${os_ver}/${package_tag}/download_pkg.tmpl +# else +# tmpl=${REPO_PATH}/openstack/templates/${arch}_${package_tag}.tmpl +# fi +# fi + + if [[ "${ansible_dir}" != "" ]]; then + # generate ansible_dir_tmp + if [[ -d ${COMPASS_PATH}/work/tmp ]]; then + rm -rf ${COMPASS_PATH}/work/tmp + fi + mkdir -p ${COMPASS_PATH}/work/tmp + echo "${ansible_dir}" + cp -rf ${ansible_dir}/roles/ ${COMPASS_PATH}/work/tmp/ + if [[ ${os_ver} == xenial ]]; then + if [[ -d ${ansible_dir}/openstack_${package_tag}_${os_ver}/roles && "`ls ${ansible_dir}/openstack_${package_tag}_${os_ver}`" != "" ]]; then + cp -rf ${ansible_dir}/openstack_${package_tag}_${os_ver}/roles/* ${COMPASS_PATH}/work/tmp/roles/ + fi + else + if [[ -d ${ansible_dir}/openstack_${package_tag}/roles && "`ls ${ansible_dir}/openstack_${package_tag}`" != "" ]]; then + cp -rf ${ansible_dir}/openstack_${package_tag}/roles/* ${COMPASS_PATH}/work/tmp/roles/ + fi + fi + ansible_dir_tmp=${COMPASS_PATH}/work/tmp/ + fi + + rm -rf ${COMPASS_PATH}/work/repo/$arch + mkdir -p ${COMPASS_PATH}/work/repo/$arch/{script,packages} + + if [[ -n $special_package ]]; then + special_package_script_dir=${REPO_PATH}/openstack/special_pkg/${arch}/ + fi + + # copy make package script to work dir + if [[ -n $special_package_script_dir && -d $special_package_script_dir ]]; then + cp -rf $special_package_script_dir/* ${COMPASS_PATH}/work/repo/$arch/script/ + fi + + # copy special++ packages to work dir + if [[ -n $special_package_dir ]]; then + curl --connect-timeout 10 -o $COMPASS_PATH/work/repo/$arch/`basename $special_package_dir` $special_package_dir + tar -zxvf $COMPASS_PATH/work/repo/$arch/`basename $special_package_dir` -C ${COMPASS_PATH}/work/repo/$arch/packages + fi + + python ${REPO_PATH}/gen_ins_pkg_script.py "${ansible_dir_tmp}" "${arch}" "${tmpl}" \ + "${docker_tmpl}" "${default_package}" "${special_package}" \ + "${COMPASS_PATH}/work/repo/$arch/script/" \ + "${COMPASS_PATH}/work/repo/$arch/packages/" "${os_ver}" + + # copy centos comps.xml to work dir + if [[ $arch == RedHat && -f ${COMPASS_PATH}/repo/openstack/make_ppa/centos/comps.xml ]]; then + cp -rf ${COMPASS_PATH}/repo/openstack/make_ppa/centos/comps.xml ${COMPASS_PATH}/work/repo + cp -rf ${COMPASS_PATH}/repo/openstack/make_ppa/centos/ceph_key_release.asc ${COMPASS_PATH}/work/repo + fi + + sudo docker build --no-cache=true -t ${docker_tag} -f ${COMPASS_PATH}/work/repo/${dockerfile} ${COMPASS_PATH}/work/repo/ + sudo docker run -t -v ${COMPASS_PATH}/work/repo:/result ${docker_tag} + + image_id=$(sudo docker images|grep ${docker_tag}|awk '{print $3}') + + sudo docker rmi -f ${image_id} +} + +function _try_fetch_dependency() +{ + local dir_name='' + if [ -f $1 ];then + case $1 in + *.tar.bz2) + tar xjf $1 + dir_name="$(basename $1 .tar.bz2)" + ;; + *.tar.gz) + tar xzf $1 + dir_name="$(basename $1 .tar.gz)" + ;; + *.bz2) + bunzip2 $1 + dir_name="$(basename $1 .bz2)" + ;; + *.rar) + unrar e $1 + dir_name="$(basename $1 .rar)" + ;; + *.gz) + gunzip $1 + dir_name="$(basename $1 .gz)" + ;; + *.tar) + tar xf $1 + dir_name="$(basename $1 .tar)" + ;; + *.tbz2) + tar xjf $1 + dir_name="$(basename $1 .tbz2)" + ;; + *.tgz) + tar xzf $1 + dir_name="$(basename $1 .tgz)" + ;; + *.zip) + gunzip $1 + dir_name="$(basename $1 .zip)" + ;; + *) + echo "'$1' cannot be extract()" + return + ;; + esac + else + echo "'$1' is not a valid file" + return + fi + + if [ ! -f ${dir_name}/requirements.txt ]; then + echo "${dir_name}/requirements.txt does not exist" + return + fi + + pip install --download=$2 -r ${dir_name}/requirements.txt + + rm -rf $dir_name +} + +function try_fetch_dependency() +{ + cd $3 + _try_fetch_dependency $1/$2 $1 + cd - +} + +function make_pip_repo() +{ + source $COMPASS_PATH/repo/repo.conf + local pip_path=$COMPASS_PATH/work/repo/pip + local pip_tmp_path=$COMPASS_PATH/work/repo/pip_tmp + + for i in $SPECIAL_PIP_PACKAGE; do + curl --connect-timeout 10 -o $pip_path/`basename $i` $i + done + + mkdir -p $pip_tmp_path + + for i in $PIP_PACKAGE; do + curl --connect-timeout 10 -o $pip_path/$(basename $i) $i + try_fetch_dependency $pip_path $(basename $i) $pip_tmp_path + done + + rm -rf $pip_tmp_path + + _make_pip + + cd $COMPASS_PATH/work/repo + + rm -rf openstack_pip + + rm -rf pip-openstack; mkdir -p pip-openstack + + tar -zxvf openstack_pip.tar.gz; cp -f openstack_pip/* pip-openstack/ + + cp -f pip/* pip-openstack/ + + tar -zcvf pip-openstack.tar.gz ./pip-openstack; cd - + +} + +function make_jhenv_repo() +{ + for x in $JUMP_HOST; do + _make_jhenv_repo $x + done +} + +function _make_jhenv_repo() +{ + if [[ $1 == trusty ]]; then + env_os_name=ubuntu + fi + + if [[ $1 == xenial ]]; then + env_os_name=ubuntu + fi + + if [[ $1 =~ rhel[0-9]*$ ]]; then + env_os_name=centos + fi + + if [[ -d ${COMPASS_PATH}/repo/jhenv_template/$env_os_name ]]; then + + jh_env_dockerfile=Dockerfile + jh_env_docker_tmpl=${REPO_PATH}/jhenv_template/$env_os_name/$1/${jh_env_dockerfile}".tmpl" + jh_env_docker_tag="$1/env" + + rm -rf ${COMPASS_PATH}/work/repo/jhenv_template + mkdir ${COMPASS_PATH}/work/repo/jhenv_template + cp -rf ${COMPASS_PATH}/repo/jhenv_template/$env_os_name/$1/${jh_env_dockerfile} ${COMPASS_PATH}/work/repo/jhenv_template + +cat <<EOF >${COMPASS_PATH}/work/repo/jhenv_template/cp_env.sh +#!/bin/bash +set -ex +cp /*.tar.gz /env -f +EOF + + sudo docker build --no-cache=true -t ${jh_env_docker_tag} -f ${COMPASS_PATH}/work/repo/jhenv_template/${jh_env_dockerfile} ${COMPASS_PATH}/work/repo/jhenv_template + sudo docker run -t -v ${COMPASS_PATH}/work/repo:/env ${jh_env_docker_tag} + + image_id=$(sudo docker images|grep ${jh_env_docker_tag}|awk '{print $3}') + + sudo docker rmi -f ${image_id} + +# cd $COMPASS_PATH/work/repo; tar -zcvf pip.tar.gz ./pip; cd - + fi +} + +function _make_pip() +{ + if [[ ! -f ${COMPASS_PATH}/repo/openstack/pip/Dockerfile ]]; then + echo "No Dockerfile for making pip repo!" + return + fi + + if [[ -d ${COMPASS_PATH}/repo/openstack_pip ]]; then + rm -rf ${COMPASS_PATH}/work/repo/openstack_pip + fi + + mkdir -p ${COMPASS_PATH}/work/repo/openstack_pip + + cp -f ${COMPASS_PATH}/repo/openstack/pip/Dockerfile ${COMPASS_PATH}/work/repo/openstack_pip/ + cp -f ${COMPASS_PATH}/repo/openstack/pip/code_url.conf ${COMPASS_PATH}/work/repo/openstack_pip/ + +cat <<EOF >${COMPASS_PATH}/work/repo/openstack_pip/cp_pip.sh +#!/bin/bash +set -ex +cp /*.tar.gz /env -f +EOF + +cat <<EOF >${COMPASS_PATH}/work/repo/openstack_pip/make_pip.sh +#!/bin/bash +set -ex +source code_url.conf +for i in \$GIT_URL; do + mkdir -p /home/tmp + git clone \$i -b \$BRANCH /home/tmp + pip install -r /home/tmp/requirements.txt -d openstack_pip/ + rm -rf /home/tmp +done +EOF + + pip_docker_tag="pip/env" + + sudo docker build --no-cache=true -t ${pip_docker_tag} -f ${COMPASS_PATH}/work/repo/openstack_pip/Dockerfile ${COMPASS_PATH}/work/repo/openstack_pip + sudo docker run -t -v ${COMPASS_PATH}/work/repo:/env ${pip_docker_tag} + + image_id=$(sudo docker images|grep ${pip_docker_tag}|awk '{print $3}') + + sudo docker rmi -f ${image_id} + +} + +# FIXME: rhel7 -> centos7, redhat7 -> rhel7 +# Make all the openstack ppas +function make_osppa() +{ + + for opv in juno kilo liberty mitaka; do + make_repo --os-ver trusty --package-tag $opv \ + --ansible-dir $COMPASS_PATH/deploy/adapters/ansible \ + --default-package "openssh-server" \ + --special-package "openvswitch-switch" + done + + for opv in mitaka newton; do + make_repo --os-ver xenial --package-tag $opv \ + --ansible-dir $COMPASS_PATH/deploy/adapters/ansible \ + --default-package "openssh-server" + done + + make_repo --os-ver rhel7 --package-tag juno \ + --ansible-dir $COMPASS_PATH/deploy/adapters/ansible \ + --default-package "rsyslog-7.6.7-1.el7 strace net-tools wget vim openssh-server \ + dracut-config-rescue-033-241.el7_1.3 dracut-network-033-241.el7_1.3" + + for opv in kilo liberty mitaka; do + make_repo --os-ver rhel7 --package-tag $opv \ + --ansible-dir $COMPASS_PATH/deploy/adapters/ansible \ + --default-package "rsyslog-7.6.7-1.el7 strace net-tools wget vim openssh-server \ + dracut-config-rescue-033-241.el7_1.5 dracut-network-033-241.el7_1.5" + done + +# for opv in osp9; do +# make_repo --os-ver redhat7 --package-tag $opv \ +# --ansible-dir $COMPASS_PATH/deploy/adapters/ansible \ +# --default-package "strace net-tools wget vim openssh-server" +# done + +} + +function make_compass_repo() +{ + make_repo --os-ver rhel7 --package-tag compass \ + --tmpl "${COMPASS_PATH}/repo/openstack/make_ppa/centos/rhel7/compass/compass_core.tmpl" \ + --default-package "kernel-devel epel-release wget libxml2 glibc gcc perl openssl-libs mkisofs createrepo lsof \ + python-yaml python-jinja2 python-paramiko elasticsearch logstash bind-license vim nmap-ncat \ + yum cobbler cobbler-web createrepo mkisofs syslinux pykickstart bind rsync fence-agents \ + dhcp xinetd tftp-server httpd libselinux-python python-setuptools python-devel mysql-devel \ + mysql-server mysql MySQL-python redis mod_wsgi net-tools rabbitmq-server nfs-utils" \ + --special-package "kibana jdk" +} + +function make_feature_repo() +{ + if [[ -d $COMPASS_PATH/work/repo/packages ]]; then + rm -rf $COMPASS_PATH/work/repo/packages + fi + + if [[ -d $COMPASS_PATH/work/repo/temp ]]; then + rm -rf $COMPASS_PATH/work/repo/temp + fi + + mkdir -p $COMPASS_PATH/work/repo/packages + mkdir -p $COMPASS_PATH/work/repo/temp + + echo "$OPNFV_VERSION" + + for i in $OPNFV_VERSION; do + mkdir -p $COMPASS_PATH/work/repo/packages/$i + mkdir -p $COMPASS_PATH/work/repo/temp/$i + if [[ -d $COMPASS_PATH/work/repo/temp/make_pkg ]]; then + rm -rf $COMPASS_PATH/work/repo/temp/make_pkg + fi + mkdir -p $COMPASS_PATH/work/repo/temp/make_pkg + + if [[ ! -d $COMPASS_PATH/repo/features/$i ]]; then + echo "No $i in compass feature directory." + return + fi + + cp -rf $COMPASS_PATH/repo/features/$i/* $COMPASS_PATH/work/repo/temp/make_pkg + + feature_dockerfile=Dockerfile + feature_docker_tag=trusty/feature + + if [[ ! -f $COMPASS_PATH/repo/features/$feature_dockerfile ]]; then + echo "No Dockerfile in compass feature directory." + return + fi + + cp -f $COMPASS_PATH/repo/features/$feature_dockerfile $COMPASS_PATH/work/repo/temp/ + +cat <<EOF >${COMPASS_PATH}/work/repo/temp/cp_pkg.sh +#!/bin/bash +set -ex +cp /*.tar.gz /feature -f +EOF + +cat <<EOF >${COMPASS_PATH}/work/repo/temp/feature_run.sh +#!/bin/bash +set -ex +_script=\`ls /run_script\` +for z in \$_script; do + . /run_script/\$z +done +EOF + sudo docker build --no-cache=true -t ${feature_docker_tag} -f ${COMPASS_PATH}/work/repo/temp/${feature_dockerfile} ${COMPASS_PATH}/work/repo/temp + sudo docker run -t -v ${COMPASS_PATH}/work/repo/packages:/feature ${feature_docker_tag} + + image_id=$(sudo docker images|grep ${feature_docker_tag}|awk '{print $3}') + + sudo docker rmi -f ${image_id} + + mv ${COMPASS_PATH}/work/repo/packages/*.tar.gz $COMPASS_PATH/work/repo/packages/$i + + done + + cd ${COMPASS_PATH}/work/repo/ + tar -zcvf ${COMPASS_PATH}/work/repo/packages.tar.gz packages/ + cd - +} + + diff --git a/util/check_valid.py b/util/check_valid.py index 36d74ba4..5b3a8ab3 100644 --- a/util/check_valid.py +++ b/util/check_valid.py @@ -101,7 +101,7 @@ def check_dha_file(dha): hosts: - name: %s interfaces: - - %s: %s''' % (i['name'], j.keys()[0], j.values()[0])) + - %s: %s''' % (i['name'], j.keys()[0], j.values()[0])) # noqa: E501 invalid = True if not is_valid_ip(i['ipmiIp']): err_print('''invalid address: |