diff options
Diffstat (limited to 'legacy/docker')
-rw-r--r-- | legacy/docker/Dockerfile | 70 | ||||
-rw-r--r-- | legacy/docker/README.md | 11 | ||||
-rw-r--r-- | legacy/docker/ansible.cfg.default | 2 | ||||
-rw-r--r-- | legacy/docker/cleanup_qtip_image.sh | 24 | ||||
-rw-r--r-- | legacy/docker/prepare_qtip_image.sh | 49 | ||||
-rwxr-xr-x | legacy/docker/push_db.sh | 3 | ||||
-rwxr-xr-x | legacy/docker/run_qtip.sh | 39 | ||||
-rw-r--r-- | legacy/docker/supervisord.conf | 13 |
8 files changed, 211 insertions, 0 deletions
diff --git a/legacy/docker/Dockerfile b/legacy/docker/Dockerfile new file mode 100644 index 00000000..369fa6c8 --- /dev/null +++ b/legacy/docker/Dockerfile @@ -0,0 +1,70 @@ +########################################## +#####Docker container for QTIP############ +########################################## + + +FROM ubuntu:14.04 +MAINTAINER Yujun Zhang <zhang.yujunz@zte.com.cn> +LABEL version="0.1" description="OPNFV QTIP Docker container" + +ARG BRANCH=master + +ENV REPOS_DIR /home/opnfv/repos +ENV QTIP_DIR /home/opnfv/repos/qtip +ENV PYTHONPATH /home/opnfv/repos/qtip +ENV HOME /home/opnfv +WORKDIR /home/opnfv + +# Packaged Dependencies +RUN apt-get update && apt-get install -y \ +software-properties-common \ +wget \ +git \ +gcc \ +ssh \ +expect \ +python-matplotlib \ +python-dev \ +python-pip \ +libjpeg62 \ +libjpeg62-dev \ +zlib1g-dev \ +python-tk \ +curl \ +supervisor \ +python-setuptools \ +--no-install-recommends + +RUN pip install 'setuptools>=17.1' + +RUN apt-add-repository ppa:ansible/ansible -y +RUN apt-key update -y +RUN apt-get update -y +RUN apt-get install ansible --force-yes -y + + +RUN mkdir -p ${REPOS_DIR} +RUN mkdir -p /root/.ssh +RUN mkdir -p $HOME/qtip/logs +RUN mkdir -p $HOME/qtip/results + +RUN chmod 700 /root/.ssh + +#Config ansible +COPY ansible.cfg.default /root/.ansible.cfg + +#Cloning Repos + +RUN git config --global http.sslVerify false +RUN git clone -b $BRANCH https://gerrit.opnfv.org/gerrit/qtip $REPOS_DIR/qtip +RUN git clone https://gerrit.opnfv.org/gerrit/releng $REPOS_DIR/releng + +RUN pip install -r $REPOS_DIR/qtip/requirements.txt + +#Config supervisor + +RUN mkdir -p /var/log/supervisor +RUN locale-gen en_US en_US.UTF-8 +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +CMD ["/usr/bin/supervisord"] diff --git a/legacy/docker/README.md b/legacy/docker/README.md new file mode 100644 index 00000000..35ac0935 --- /dev/null +++ b/legacy/docker/README.md @@ -0,0 +1,11 @@ +# QTIP The Indices for Performance + +[QTIP] is an [OPNFV] project. + +It aims to build a platform for creating and sharing indices of [NFVI] performance. + +See the [project vision](https://wiki.opnfv.org/display/qtip/Vision) for more details. + +[QTIP]: https://wiki.opnfv.org/display/qtip +[OPNFV]: https://www.opnfv.org +[NFVI]: https://en.wikipedia.org/wiki/Network_function_virtualization diff --git a/legacy/docker/ansible.cfg.default b/legacy/docker/ansible.cfg.default new file mode 100644 index 00000000..0451870a --- /dev/null +++ b/legacy/docker/ansible.cfg.default @@ -0,0 +1,2 @@ +[defaults] +callback_whitelist = profile_tasks diff --git a/legacy/docker/cleanup_qtip_image.sh b/legacy/docker/cleanup_qtip_image.sh new file mode 100644 index 00000000..9c2b59db --- /dev/null +++ b/legacy/docker/cleanup_qtip_image.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +if [[ ! -f ${QTIP_DIR}/openrc ]];then + source ${REPOS_DIR}/releng/utils/fetch_os_creds.sh \ + -d ${QTIP_DIR}/openrc \ + -i ${INSTALLER_TYPE} \ + -a ${INSTALLER_IP} +fi + +source ${QTIP_DIR}/openrc + +cleanup_image() +{ + echo + if ! glance image-list; then + return + fi + + echo "Deleting image QTIP_CentOS..." + glance image-delete $(glance image-list | grep -e QTIP_CentOS | awk '{print $2}') + +} + +cleanup_image diff --git a/legacy/docker/prepare_qtip_image.sh b/legacy/docker/prepare_qtip_image.sh new file mode 100644 index 00000000..4095c806 --- /dev/null +++ b/legacy/docker/prepare_qtip_image.sh @@ -0,0 +1,49 @@ +#!/bin/bash +IMGNAME='QTIP_CentOS.qcow2' +IMGPATH='/home/opnfv/imgstore' +IMGURL='http://build.opnfv.org/artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2' + +load_image() +{ + if [[ -n $( glance image-list | grep -e QTIP_CentOS) ]]; then + return + fi + + test -d $IMGPATH || mkdir -p $IMGPATH + if [[ ! -f "$IMGPATH/$IMGNAME" ]];then + echo + echo "========== Downloading QTIP_CentOS image ==========" + cd $IMGPATH + wget -c --progress=dot:giga $IMGURL + fi + + echo + echo "========== Loading QTIP_CentOS image ==========" + output=$(glance image-create \ + --name QTIP_CentOS \ + --visibility public \ + --disk-format qcow2 \ + --container-format bare \ + --file $IMGPATH/$IMGNAME ) + echo "$output" + + IMAGE_ID=$(echo "$output" | grep " id " | awk '{print $(NF-1)}') + + if [ -z "$IMAGE_ID" ]; then + echo 'Failed uploading QTIP_CentOS image to cloud'. + exit 1 + fi + + echo "QTIP_CentOS image id: $IMAGE_ID" +} + +rm -rf ${QTIP_DIR}/openrc + +${REPOS_DIR}/releng/utils/fetch_os_creds.sh \ +-d ${QTIP_DIR}/openrc \ +-i ${INSTALLER_TYPE} \ +-a ${INSTALLER_IP} + +source ${QTIP_DIR}/openrc + +load_image diff --git a/legacy/docker/push_db.sh b/legacy/docker/push_db.sh new file mode 100755 index 00000000..50341eac --- /dev/null +++ b/legacy/docker/push_db.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +cd ${QTIP_DIR} && python qtip/utils/dashboard/pushtoDB.py diff --git a/legacy/docker/run_qtip.sh b/legacy/docker/run_qtip.sh new file mode 100755 index 00000000..98abf139 --- /dev/null +++ b/legacy/docker/run_qtip.sh @@ -0,0 +1,39 @@ +#! /bin/bash + +QTIP=qtip/run.py + +run_test_suite() +{ + if [ "$TEST_CASE" == "compute" ]; then + cd ${QTIP_DIR} && python ${QTIP} -l default -f compute + cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py compute + elif [ "$TEST_CASE" == "storage" ]; then + cd ${QTIP_DIR} && python ${QTIP} -l default -f storage + cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py storage + elif [ "$TEST_CASE" == "network" ]; then + cd ${QTIP_DIR} && python ${QTIP} -l default -f network + cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py network + elif [ "$TEST_CASE" == "all" ]; then + cd ${QTIP_DIR} && python ${QTIP} -l default -f compute + cd ${QTIP_DIR} && python ${QTIP} -l default -f storage + cd ${QTIP_DIR} && python ${QTIP} -l default -f network + + cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py compute + cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py storage + cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py network + fi +} + +rm -f ${QTIP_DIR}/config/QtipKey* + +echo "Generating ssh keypair" +ssh-keygen -t rsa -N "" -f ${QTIP_DIR}/config/QtipKey -q + +source ${QTIP_DIR}/docker/prepare_qtip_image.sh + +run_test_suite + +source ${QTIP_DIR}/docker/cleanup_qtip_image.sh + +echo "Remove ssh keypair" +rm -f ${QTIP_DIR}/config/QtipKey* diff --git a/legacy/docker/supervisord.conf b/legacy/docker/supervisord.conf new file mode 100644 index 00000000..a6d457dd --- /dev/null +++ b/legacy/docker/supervisord.conf @@ -0,0 +1,13 @@ +[supervisord] +nodaemon=true + +[program:qtip_server] +command=bash -c "cd $REPOS_DIR/qtip&&python qtip/api/qtip_server.py" +numprocs=1 +autostart=true +autorestart=true +user=root +environment=INSTALLER_TYPE="%(ENV_INSTALLER_TYPE)s",INSTALLER_IP="%(ENV_INSTALLER_IP)s",NODE_NAME="%(ENV_NODE_NAME)s" +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s.log + |