diff options
-rwxr-xr-x | ci/kolla-build.sh | 71 | ||||
-rwxr-xr-x | code/install_interface_patch.sh | 4 | ||||
-rwxr-xr-x | code/makefile_patch.sh | 68 | ||||
-rw-r--r-- | deploy/tempest.py | 12 | ||||
-rw-r--r-- | docker/Dockerfile | 5 | ||||
-rw-r--r-- | templates/virtual_environment/vms/all_in_one.xml | 4 |
6 files changed, 117 insertions, 47 deletions
diff --git a/ci/kolla-build.sh b/ci/kolla-build.sh index 6b7d330d..c7ea8884 100755 --- a/ci/kolla-build.sh +++ b/ci/kolla-build.sh @@ -13,6 +13,7 @@ # Parameters: $1 kolla git url, for example, # https://git.openstack.org/openstack/kolla # $2 kolla branch, for example, stable/newton +# $3 kolla tag, for example, 3.0.2 set -o errexit set -o nounset @@ -20,6 +21,7 @@ set -o pipefail KOLLA_GIT=$1 KOLLA_BRANCH=$2 +KOLLA_TAG=$3 KOLLA_GIT_VERSION= KOLLA_IMAGE_VERSION= KOLLA_GIT_DIR=/tmp/kolla-git @@ -40,6 +42,12 @@ function pre_check { python2-oslo-config:3.14.0 python-netaddr:0.7.13 \ python2-setuptools:16.0.0 python2-crypto:2.6 docker-engine:1.12 \ centos-release-openstack-newton:1 epel-release:7" + elif [ $KOLLA_BRANCH == "stable/ocata" ] ; then + RPM_REQUIRES="python-docker-py:1.10 python2-pbr:1.10 python-jinja2:2.8 \ + python-gitdb:0.6.4 GitPython:1.0.1 python-six:1.10.0 \ + python2-oslo-config:3.22.0 python-netaddr:0.7.18 \ + python2-setuptools:22.0.0 python2-crypto:2.6 docker-engine:1.12 \ + centos-release-openstack-ocata:1 epel-release:7" else exit 1 fi @@ -61,7 +69,7 @@ function pre_check { smallestversion=`printf "$realversion\n$expversion\n" | sort -V | head -1` if [ "$smallestversion" != "$expversion" ] ; then echo "$package version $realversion DOES NOT meet the \ - requirement verion $expversion" + requirement version $expversion" exit 1 fi done @@ -125,6 +133,8 @@ function start_registry_server { function pack_registry_data { echo "Packaging registry data" datetag=$(date +%y%m%d%H%M%S) + + #TODO: not compatible with "master" branch version=$(echo $KOLLA_BRANCH | awk -F'/' '{print $2}') if [ ! -d $BUILD_OUTPUT_DIR ] ; then @@ -144,30 +154,32 @@ function pack_registry_data { function update_kolla_code { echo "Updating Kolla code" - if [ ! -d $KOLLA_GIT_DIR ] ; then - mkdir -p $KOLLA_GIT_DIR - fi - if [ ! -d $KOLLA_GIT_DIR/kolla ] ; then - pushd $KOLLA_GIT_DIR - git clone $KOLLA_GIT - pushd $KOLLA_GIT_DIR/kolla - git checkout $KOLLA_BRANCH - popd - popd - else - pushd $KOLLA_GIT_DIR/kolla - git remote update - git checkout $KOLLA_BRANCH - git pull --ff-only - popd - fi + rm -rf $KOLLA_GIT_DIR + mkdir -p $KOLLA_GIT_DIR + pushd $KOLLA_GIT_DIR + git clone $KOLLA_GIT pushd $KOLLA_GIT_DIR/kolla + git checkout $KOLLA_BRANCH + + if [[ ! -z "$KOLLA_TAG" ]]; then + git checkout $KOLLA_TAG + fi + KOLLA_GIT_VERSION=$(git log -1 --pretty="%H") tox -e genconfig KOLLA_IMAGE_VERSION=$(cat $KOLLA_GIT_DIR/kolla/etc/kolla/kolla-build.conf \ | grep "#tag" | gawk -F' = ' '{print $2}') + + if [[ ! -z "$KOLLA_TAG" ]]; then + if ["$KOLLA_TAG" != $KOLLA_IMAGE_VERSION] ; then + echo "tag in git: $KOLLA_TAG, while tag in code: $KOLLA_IMAGE_VERSION" + exit 1 + fi + fi + + popd popd } @@ -185,7 +197,7 @@ function start_build { } function usage { - echo "Usage: $0 https://git.openstack.org/openstack/kolla stable/newton" + echo "Usage: $0 https://git.openstack.org/openstack/kolla stable/ocata" } if [ "$1" == "" -o "$2" == "" ] ; then @@ -193,6 +205,27 @@ if [ "$1" == "" -o "$2" == "" ] ; then exit 1 fi + + +exitcode="" +error_trap() +{ + local rc=$? + + set +e + + if [ -z "$exitcode" ]; then + exitcode=$rc + fi + + echo "Image build failed with $exitcode" + + exit $exitcode +} + + +trap "error_trap" EXIT SIGTERM + pre_check # Try to cleanup images of the last failed run, if any. cleanup_kolla_image diff --git a/code/install_interface_patch.sh b/code/install_interface_patch.sh index 6be5b5b4..312b82c7 100755 --- a/code/install_interface_patch.sh +++ b/code/install_interface_patch.sh @@ -8,8 +8,8 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -imagebranch="newton" -imageversion="latest" +imagebranch="ocata" +imageversion="170420124331" imageserver="http://120.24.17.215" imagedir="/var/lib/daisy/versionfile/kolla" imagename="kolla-image-$imagebranch-$imageversion.tgz" diff --git a/code/makefile_patch.sh b/code/makefile_patch.sh index 8d83f4e5..7d6c79bc 100755 --- a/code/makefile_patch.sh +++ b/code/makefile_patch.sh @@ -12,8 +12,8 @@ TOOLS_PATH=$1 CACHE_PATH=/home/cache -imagebranch="newton" -imageversion="latest" +imagebranch="ocata" +imageversion="170420124331" imageserver="http://120.24.17.215" imagename="kolla-image-$imagebranch-$imageversion.tgz" @@ -25,19 +25,59 @@ cirros_ver="0.3.5" cirros_filename="cirros-${cirros_ver}-x86_64-disk.img" cirros_url=${cirros_server}/${cirros_ver}/${cirros_filename} +function check_or_download_file() +{ + file_path=$1 + file_url=$2 + file_name=$(basename $2) + if [ $# -eq 3 ]; then md5_url=$3; else md5_url=""; fi + + pushd $file_path >/dev/null + + count=0 + MAX_DOWNLOAD_TIMES=2 + while [ $count -lt ${MAX_DOWNLOAD_TIMES} ]; do + count=$[count + 1] + + if [ ! -f ${file_name} ]; then + echo "Begin to download ${file_name}" + wget --progress=dot:giga ${file_url} + fi + + if [ ! -z ${md5_url} ]; then + rm -f $(basename ${md5_url}) + wget ${md5_url} + md5sum -c $(basename ${md5_url}) + if [ $? -ne 0 ]; then + echo "MD5 check failed !" + rm -f ${file_name} + else + echo "MD5 check succeeded !" + count=${MAX_DOWNLOAD_TIMES} + fi + else + wget --spider $file_url -o tmp_filesize + origin_size=$(cat tmp_filesize | grep Length | awk '{print $2}') + rm tmp_filesize + local_size=$(stat -c %s ${file_path}/${file_name} | tr -d '\n') + if [ ${local_size} -ne ${origin_size} ]; then + echo "The local ${file_name} is incomplete." + rm -f ${file_name} + else + echo "File ${file_path}/${file_name} is ok." + count=${MAX_DOWNLOAD_TIMES} + fi + fi + done + + popd > /dev/null +} + if [ ! -d $CACHE_PATH ]; then mkdir -p $CACHE_PATH ; fi -if [ ! -f $CACHE_PATH/${isoname} ]; then - wget -P $CACHE_PATH $isourl -fi -if [ ! -f $CACHE_PATH/$imagename ]; then - wget -P $CACHE_PATH "$imageserver/$imagename" -fi -if [ ! -f $CACHE_PATH/registry-server.tar ]; then - wget -P $CACHE_PATH "http://daisycloud.org/static/files/registry-server.tar" -fi -if [ ! -f $CACHE_PATH/${cirros_filename} ]; then - wget -P $CACHE_PATH ${cirros_url} -fi +check_or_download_file $CACHE_PATH $isourl +check_or_download_file $CACHE_PATH $imageserver/${imagename} ${imageserver}/${imagename}.md5 +check_or_download_file $CACHE_PATH "http://daisycloud.org/static/files/registry-server.tar" +check_or_download_file $CACHE_PATH ${cirros_url} cp $CACHE_PATH/${isoname} $TOOLS_PATH/setup/bin_temp/ cp $CACHE_PATH/$imagename $TOOLS_PATH/setup/bin_temp/ diff --git a/deploy/tempest.py b/deploy/tempest.py index bd1bc04f..3510528a 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -151,8 +151,7 @@ def discover_host(hosts_name): def update_network(cluster_id, network_map): network_meta = {'filters': {'cluster_id': cluster_id}} network_info_gernerator = client.networks.list(**network_meta) - network_info_list = [net for net in network_info_gernerator] - for net in network_info_list: + for net in network_info_gernerator: network_id = net.id network_name = net.name if network_map.get(network_name): @@ -162,9 +161,8 @@ def update_network(cluster_id, network_map): def get_hosts(): hosts_list_generator = client.hosts.list() - hosts_list = [host for host in hosts_list_generator] hosts_info = [] - for host in hosts_list: + for host in hosts_list_generator: host_info = client.hosts.get(host.id) hosts_info.append(host_info) return hosts_info @@ -172,8 +170,7 @@ def get_hosts(): def get_cluster(): cluster_list_generator = client.clusters.list() - cluster_list = [cluster for cluster in cluster_list_generator] - for cluster in cluster_list: + for cluster in cluster_list_generator: cluster_info = client.clusters.get(cluster.id) return cluster_info @@ -229,8 +226,7 @@ def add_host_role(cluster_id, host_id, host_exp_name, host_real_name, vip): def enable_cinder_backend(cluster_id, service_name, disk_name, protocol_type): role_meta = {'filters': {'cluster_id': cluster_id}} role_list_generator = client.roles.list(**role_meta) - role_list = [role for role in role_list_generator] - lb_role_id = [role.id for role in role_list if + lb_role_id = [role.id for role in role_list_generator if role.name == "CONTROLLER_LB"][0] service_disk_meta = {'service': service_name, 'disk_location': 'local', diff --git a/docker/Dockerfile b/docker/Dockerfile index 06002bff..3418a128 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,9 +1,9 @@ FROM centos:7 -LABEL daisy_image_version=1.0 +LABEL daisy_image_version=1.1 ARG BRANCH ENV BRANCH=${BRANCH:-master} RUN yum -y update -RUN yum -y install centos-release-openstack-newton +RUN yum -y install centos-release-openstack-ocata RUN yum -y install \ wget \ coreutils \ @@ -18,6 +18,7 @@ RUN yum -y install \ gcc \ autoconf \ automake \ + fontawesome-fonts-web \ glibc-devel \ python-sphinx \ python-XStatic-Angular \ diff --git a/templates/virtual_environment/vms/all_in_one.xml b/templates/virtual_environment/vms/all_in_one.xml index 4d08a68b..15f0305c 100644 --- a/templates/virtual_environment/vms/all_in_one.xml +++ b/templates/virtual_environment/vms/all_in_one.xml @@ -1,7 +1,7 @@ <domain type='kvm' id='4'> <name>all_in_one</name> - <memory unit='KiB'>4194304</memory> - <currentMemory unit='KiB'>4194304</currentMemory> + <memory unit='KiB'>16777216</memory> + <currentMemory unit='KiB'>16777216</currentMemory> <vcpu placement='static'>4</vcpu> <resource> <partition>/machine</partition> |