From 26508884ef1a273aa82f938471253813b975c093 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Mon, 9 Feb 2015 17:00:22 -0600 Subject: [PATCH] Add os-disk-config element and image Initial version of the os-disk-config element and an image target to allow building a minimal image for testing and demo purposes. None of this has been tested yet, but the image build completes successfully so it should be a starting point anyway. --- elements/os-disk-config/element-deps | 2 ++ .../10-os-disk-config-install-options.bash | 7 ++++ .../install.d/10-os-disk-config | 33 +++++++++++++++++++ .../source-repository-os-disk-config | 1 + scripts/instack-build-images | 13 ++++++++ 5 files changed, 56 insertions(+) create mode 100644 elements/os-disk-config/element-deps create mode 100644 elements/os-disk-config/environment.d/10-os-disk-config-install-options.bash create mode 100755 elements/os-disk-config/install.d/10-os-disk-config create mode 100644 elements/os-disk-config/source-repository-os-disk-config diff --git a/elements/os-disk-config/element-deps b/elements/os-disk-config/element-deps new file mode 100644 index 000000000..9d8b6b7a5 --- /dev/null +++ b/elements/os-disk-config/element-deps @@ -0,0 +1,2 @@ +os-apply-config +os-refresh-config diff --git a/elements/os-disk-config/environment.d/10-os-disk-config-install-options.bash b/elements/os-disk-config/environment.d/10-os-disk-config-install-options.bash new file mode 100644 index 000000000..ae672e45e --- /dev/null +++ b/elements/os-disk-config/environment.d/10-os-disk-config-install-options.bash @@ -0,0 +1,7 @@ +#!/bin/bash + +export DIB_INSTALLTYPE_os_disk_config="${DIB_INSTALLTYPE_os_cloud_config:-"source"}" + +if [ -z "${OS_DISK_CONFIG_VENV_DIR:-}" ]; then + export OS_DISK_CONFIG_VENV_DIR="${OPENSTACK_VENV_DIR:-"/opt/stack/venvs/os-disk-config"}" +fi diff --git a/elements/os-disk-config/install.d/10-os-disk-config b/elements/os-disk-config/install.d/10-os-disk-config new file mode 100755 index 000000000..6d07384c4 --- /dev/null +++ b/elements/os-disk-config/install.d/10-os-disk-config @@ -0,0 +1,33 @@ +#!/bin/bash + +set -eux +set -o pipefail + +virtualenv --setuptools ${OS_DISK_CONFIG_VENV_DIR} +set +u +source ${OS_DISK_CONFIG_VENV_DIR}/bin/activate +set -u + +# bug #1201253 : virtualenv-1.10.1 embeds setuptools-0.9.8, which +# doesn't manage correctly HTTPS sockets when downloading pbr from +# https://pypi.python.org/simple/ if using http_proxy and https_proxy +# envvars +${OS_DISK_CONFIG_VENV_DIR}/bin/pip install -U 'setuptools>=1.0' +# bug #1293812 : Avoid easy_install triggering on pbr. +${OS_DISK_CONFIG_VENV_DIR}/bin/pip install -U 'pbr>=0.6,<1.0' +if [ -e /opt/stack/os-disk-config/requirements.txt ]; then + reqs=/opt/stack/os-disk-config/requirements.txt +else + reqs="" +fi +if [ -n "$reqs" ] ; then + pip install -r $reqs +fi + +pip install /opt/stack/os-disk-config + +set +u +deactivate +set -u + +ln -s ${OS_DISK_CONFIG_VENV_DIR}/bin/os-disk-config /usr/local/bin/ diff --git a/elements/os-disk-config/source-repository-os-disk-config b/elements/os-disk-config/source-repository-os-disk-config new file mode 100644 index 000000000..b2eacf752 --- /dev/null +++ b/elements/os-disk-config/source-repository-os-disk-config @@ -0,0 +1 @@ +os-disk-config git /opt/stack/os-disk-config https://github.com/agroup/os-disk-config diff --git a/scripts/instack-build-images b/scripts/instack-build-images index a6f283045..a7ddbc566 100755 --- a/scripts/instack-build-images +++ b/scripts/instack-build-images @@ -251,6 +251,19 @@ function openstack-full { fi } +function os-disk-config { + # Super basic image including os-disk-config for demonstrating its functionality + if [ ! -f os-disk-config.qcow2 ]; then + unset DIB_COMMON_ELEMENTS + disk-image-create \ + -a $NODE_ARCH \ + -o os-disk-config \ + $NODE_DIST \ + os-disk-config baremetal \ + 2>&1 | tee dib-os-disk-config.log + fi +} + if [ "$image_build" = "all" ]; then deploy-ramdisk discovery-ramdisk