From 897337cdd61f1702aa7e68da0466804bf0d21a86 Mon Sep 17 00:00:00 2001 From: Paul Bourke Date: Wed, 17 Jun 2015 11:14:59 +0000 Subject: Symlink all non Dockerfile resources in images The only files in the docker image directories that differ majorly between distros are the Dockerfiles (e.g. different package manager mechanisms, different repo sources, etc). The supporting files such as the start.sh/check.sh and config files should largely stay the same between base images. This change moves these files up into a "common" directory, and symlinks them in the same way that the build script is managed. This means when adding a new base distro only new Dockerfiles need to be created. Also, if a distro does happen to require a vastly different start.sh script for example, one can choose to simply not symlink to the common and instead drop in a custom one. Implements: blueprint refactor-base-image-layout Change-Id: Ic4db69d31ff54a1fb95af4853a2e5ae490064284 --- docker/common/nova-controller/nova-api/check.sh | 17 +++++++++ docker/common/nova-controller/nova-api/start.sh | 46 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 docker/common/nova-controller/nova-api/check.sh create mode 100755 docker/common/nova-controller/nova-api/start.sh (limited to 'docker/common/nova-controller/nova-api') diff --git a/docker/common/nova-controller/nova-api/check.sh b/docker/common/nova-controller/nova-api/check.sh new file mode 100755 index 000000000..b250682d8 --- /dev/null +++ b/docker/common/nova-controller/nova-api/check.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! nova list > /dev/null; then + echo "ERROR: nova list failed" >&2 + RES=1 + fi +fi + +exit $RES + diff --git a/docker/common/nova-controller/nova-api/start.sh b/docker/common/nova-controller/nova-api/start.sh new file mode 100755 index 000000000..7928370a4 --- /dev/null +++ b/docker/common/nova-controller/nova-api/start.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-nova.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + NOVA_KEYSTONE_USER NOVA_KEYSTONE_PASSWORD \ + ADMIN_TENANT_NAME NOVA_API_SERVICE_HOST \ + NOVA_EC2_API_SERVICE_HOST PUBLIC_IP NOVA_DB_NAME +fail_unless_os_service_running keystone +fail_unless_db $NOVA_DB_NAME + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="http://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +cfg=/etc/nova/nova.conf + +# configure logging +crudini --set $cfg DEFAULT log_file "${NOVA_API_LOG_FILE}" + +crux user-create --update \ + -n "${NOVA_KEYSTONE_USER}" \ + -p "${NOVA_KEYSTONE_PASSWORD}" \ + -t "${ADMIN_TENANT_NAME}" \ + -r admin + +crux endpoint-create --remove-all \ + -n ec2 -t ec2 \ + -I "http://${NOVA_EC2_API_SERVICE_HOST}:8773/services/Cloud" \ + -P "http://${PUBLIC_IP}:8773/services/Cloud" \ + -A "http://${NOVA_EC2_API_SERVICE_HOST}:8773/services/Admin" + +crux endpoint-create --remove-all \ + -n nova -t compute \ + -I "http://${NOVA_API_SERVICE_HOST}:8774/v2/\$(tenant_id)s" \ + -P "http://${PUBLIC_IP}:8774/v2/\$(tenant_id)s" \ + -A "http://${NOVA_API_SERVICE_HOST}:8774/v2/\$(tenant_id)s" + +crux endpoint-create --remove-all \ + -n novav3 -t computev3 \ + -I "http://${NOVA_API_SERVICE_HOST}:8774/v3" \ + -P "http://${PUBLIC_IP}:8774/v3" \ + -A "http://${NOVA_API_SERVICE_HOST}:8774/v3" + +exec /usr/bin/nova-api --config-file /etc/nova/nova.conf -- cgit v1.2.3