From 48f79d69e1d3e65c29d7cfde50433afa18b67597 Mon Sep 17 00:00:00 2001 From: Bertrand NOEL Date: Mon, 19 Sep 2016 10:09:19 +0200 Subject: [PATCH] Updates Ubuntu Mesos build * Adds a script to install dependancies when building the Ubuntu Mesos image (used in OpenStack infra) * Fixes Dockerfile to build the Ubuntu Mesos image (it was missing components to add Heat agent in the image) * Changes the name of the Mesos Ubunutu image because the Ubuntu version and Mesos version has changed * Fixes a broken link in the doc Change-Id: I35ffd4bd358a62dd7cf0d0e485b531a36b6c262b --- doc/source/userguide.rst | 2 +- .../drivers/mesos_ubuntu_v1/image/Dockerfile | 9 ++++--- .../drivers/mesos_ubuntu_v1/image/README.md | 2 +- .../image/install_imagebuild_deps.sh | 22 +++++++++++++++ .../mesos_ubuntu_v1/image/validate_image.sh | 27 +++++++++++++++++++ 5 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 magnum/drivers/mesos_ubuntu_v1/image/install_imagebuild_deps.sh create mode 100644 magnum/drivers/mesos_ubuntu_v1/image/validate_image.sh diff --git a/doc/source/userguide.rst b/doc/source/userguide.rst index d894b2e343..1682ffcb14 100644 --- a/doc/source/userguide.rst +++ b/doc/source/userguide.rst @@ -1250,7 +1250,7 @@ an Ubuntu server:: $ diskimage-builder/bin/disk-image-create ubuntu vm docker mesos \ os-collect-config os-refresh-config os-apply-config \ heat-config heat-config-script \ - -o ubuntu-14.04.3-mesos-0.25.0.qcow2 + -o ubuntu-mesos.qcow2 Dockerfile ++++++++++ diff --git a/magnum/drivers/mesos_ubuntu_v1/image/Dockerfile b/magnum/drivers/mesos_ubuntu_v1/image/Dockerfile index 0570099d18..c1bf8e15ff 100644 --- a/magnum/drivers/mesos_ubuntu_v1/image/Dockerfile +++ b/magnum/drivers/mesos_ubuntu_v1/image/Dockerfile @@ -2,16 +2,17 @@ FROM ubuntu:trusty RUN \ apt-get -yqq update && \ - apt-get -yqq install git qemu-utils python-dev python-pip uuid-runtime curl sudo kpartx parted wget && \ - pip install pyyaml && \ + apt-get -yqq install git qemu-utils python-dev python-yaml python-six uuid-runtime curl sudo kpartx parted wget && \ mkdir /output WORKDIR /build -ENV PATH="/build/dib-utils/bin:$PATH" ELEMENTS_PATH="magnum/magnum/drivers/mesos_ubuntu_v1/image" DIB_RELEASE=trusty +ENV PATH="dib-utils/bin:$PATH" ELEMENTS_PATH="tripleo-image-elements/elements:heat-templates/hot/software-config/elements:magnum/magnum/drivers/mesos_ubuntu_v1/image" DIB_RELEASE=trusty RUN git clone https://git.openstack.org/openstack/magnum RUN git clone https://git.openstack.org/openstack/diskimage-builder.git RUN git clone https://git.openstack.org/openstack/dib-utils.git +RUN git clone https://git.openstack.org/openstack/tripleo-image-elements.git +RUN git clone https://git.openstack.org/openstack/heat-templates.git -CMD diskimage-builder/bin/disk-image-create ubuntu vm docker mesos -o /output/ubuntu-mesos.qcow2 +CMD diskimage-builder/bin/disk-image-create ubuntu vm docker mesos os-collect-config os-refresh-config os-apply-config heat-config heat-config-script -o /output/ubuntu-mesos.qcow2 diff --git a/magnum/drivers/mesos_ubuntu_v1/image/README.md b/magnum/drivers/mesos_ubuntu_v1/image/README.md index 9cf6d58ea6..9de8b2362a 100644 --- a/magnum/drivers/mesos_ubuntu_v1/image/README.md +++ b/magnum/drivers/mesos_ubuntu_v1/image/README.md @@ -1,4 +1,4 @@ Mesos elements ============== -See [Building an image](http://docs.openstack.org/developer/magnum/dev/dev-mesos.html) for instructions. +See [Building an image](http://docs.openstack.org/developer/magnum/userguide.html#building-mesos-image) for instructions. diff --git a/magnum/drivers/mesos_ubuntu_v1/image/install_imagebuild_deps.sh b/magnum/drivers/mesos_ubuntu_v1/image/install_imagebuild_deps.sh new file mode 100644 index 0000000000..e1a3bd9131 --- /dev/null +++ b/magnum/drivers/mesos_ubuntu_v1/image/install_imagebuild_deps.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# This script installs all needed dependencies to generate +# images using diskimage-builder. Please not it only has been +# tested on Ubuntu Trusty + +set -eux +set -o pipefail + +sudo apt-get update || true +sudo apt-get install -y \ + git \ + qemu-utils \ + python-dev \ + python-yaml \ + python-six \ + uuid-runtime \ + curl \ + sudo \ + kpartx \ + parted \ + wget diff --git a/magnum/drivers/mesos_ubuntu_v1/image/validate_image.sh b/magnum/drivers/mesos_ubuntu_v1/image/validate_image.sh new file mode 100644 index 0000000000..362ef2997b --- /dev/null +++ b/magnum/drivers/mesos_ubuntu_v1/image/validate_image.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +# check that image is valid +qemu-img check -q $1 + +# validate estimated size +FILESIZE=$(stat -c%s "$1") +MIN_SIZE=681574400 # 650MB + +if [ $FILESIZE -lt $MIN_SIZE ] ; then + echo "Error: generated image size is lower than expected." + exit 1 +fi