Merge "remove docker from devstack"

This commit is contained in:
Jenkins 2014-03-14 14:33:19 +00:00 committed by Gerrit Code Review
commit 509140e25c
10 changed files with 1 additions and 236 deletions

View File

@ -73,7 +73,7 @@ does not run if started as root.
This is a recent change (Oct 2013) from the previous behaviour of
automatically creating a ``stack`` user. Automatically creating
user accounts is not the right response to running as root, so
that bit is now an explicit step using ``tools/create-stack-user.sh``.
that bit is now an explicit step using ``tools/create-stack-user.sh``.
Run that (as root!) or just check it out to see what DevStack's
expectations are for the account it runs under. Many people simply
use their usual login (the default 'ubuntu' login on a UEC image
@ -253,10 +253,6 @@ If tempest has been successfully configured, a basic set of smoke tests can be r
If you would like to use Xenserver as the hypervisor, please refer to the instructions in `./tools/xen/README.md`.
# DevStack on Docker
If you would like to use Docker as the hypervisor, please refer to the instructions in `./tools/docker/README.md`.
# Additional Projects
DevStack has a hook mechanism to call out to a dispatch script at specific

View File

@ -44,9 +44,6 @@ source $TOP_DIR/exerciserc
# the exercise is skipped
is_service_enabled cinder || exit 55
# Also skip if the hypervisor is Docker
[[ "$VIRT_DRIVER" == "docker" ]] && exit 55
# Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

View File

@ -40,9 +40,6 @@ source $TOP_DIR/exerciserc
# the exercise is skipped
is_service_enabled n-api || exit 55
# Skip if the hypervisor is Docker
[[ "$VIRT_DRIVER" == "docker" ]] && exit 55
# Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

View File

@ -40,9 +40,6 @@ source $TOP_DIR/exerciserc
# the exercise is skipped
is_service_enabled n-api || exit 55
# Skip if the hypervisor is Docker
[[ "$VIRT_DRIVER" == "docker" ]] && exit 55
# Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

View File

@ -37,9 +37,6 @@ source $TOP_DIR/exerciserc
# the exercise is skipped
is_service_enabled n-api || exit 55
# Skip if the hypervisor is Docker
[[ "$VIRT_DRIVER" == "docker" ]] && exit 55
# Testing Security Groups
# =======================

View File

@ -41,9 +41,6 @@ source $TOP_DIR/exerciserc
# exercise is skipped.
is_service_enabled cinder || exit 55
# Also skip if the hypervisor is Docker
[[ "$VIRT_DRIVER" == "docker" ]] && exit 55
# Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

View File

@ -1,132 +0,0 @@
# lib/nova_plugins/docker
# Configure the Docker hypervisor
# Enable with:
#
# VIRT_DRIVER=docker
# Dependencies:
#
# - ``functions`` file
# - ``nova`` and ``glance`` configurations
# install_nova_hypervisor - install any external requirements
# configure_nova_hypervisor - make configuration changes, including those to other services
# start_nova_hypervisor - start any external services
# stop_nova_hypervisor - stop any external services
# cleanup_nova_hypervisor - remove transient data and cache
# Save trace setting
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# Set up default directories
DOCKER_DIR=$DEST/docker
DOCKER_UNIX_SOCKET=/var/run/docker.sock
DOCKER_PID_FILE=/var/run/docker.pid
DOCKER_REGISTRY_PORT=${DOCKER_REGISTRY_PORT:-5042}
DOCKER_IMAGE=${DOCKER_IMAGE:-cirros:latest}
DOCKER_IMAGE_NAME=$DEFAULT_IMAGE_NAME
DOCKER_REGISTRY_IMAGE=${DOCKER_REGISTRY_IMAGE:-registry:latest}
DOCKER_REGISTRY_IMAGE_NAME=registry
DOCKER_REPOSITORY_NAME=${SERVICE_HOST}:${DOCKER_REGISTRY_PORT}/${DOCKER_IMAGE_NAME}
DOCKER_APT_REPO=${DOCKER_APT_REPO:-https://get.docker.io/ubuntu}
# Entry Points
# ------------
# clean_nova_hypervisor - Clean up an installation
function cleanup_nova_hypervisor {
stop_service docker
# Clean out work area
sudo rm -rf /var/lib/docker
}
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor {
iniset $NOVA_CONF DEFAULT compute_driver docker.DockerDriver
iniset $GLANCE_API_CONF DEFAULT container_formats ami,ari,aki,bare,ovf,docker
}
# is_docker_running - Return 0 (true) if Docker is running, otherwise 1
function is_docker_running {
local docker_pid
if [ -f "$DOCKER_PID_FILE" ]; then
docker_pid=$(cat "$DOCKER_PID_FILE")
fi
if [[ -z "$docker_pid" ]] || ! ps -p "$docker_pid" | grep [d]ocker; then
return 1
fi
return 0
}
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor {
# So far this is Ubuntu only
if ! is_ubuntu; then
die $LINENO "Docker is only supported on Ubuntu at this time"
fi
# Make sure Docker is installed
if ! is_package_installed lxc-docker; then
die $LINENO "Docker is not installed. Please run tools/docker/install_docker.sh"
fi
if ! (is_docker_running); then
die $LINENO "Docker not running"
fi
}
# start_nova_hypervisor - Start any required external services
function start_nova_hypervisor {
if ! (is_docker_running); then
die $LINENO "Docker not running"
fi
# Start the Docker registry container
docker run -d -p ${DOCKER_REGISTRY_PORT}:5000 \
-e SETTINGS_FLAVOR=openstack -e OS_USERNAME=${OS_USERNAME} \
-e OS_PASSWORD=${OS_PASSWORD} -e OS_TENANT_NAME=${OS_TENANT_NAME} \
-e OS_GLANCE_URL="${SERVICE_PROTOCOL}://${GLANCE_HOSTPORT}" \
-e OS_AUTH_URL=${OS_AUTH_URL} \
$DOCKER_REGISTRY_IMAGE_NAME ./docker-registry/run.sh
echo "Waiting for docker registry to start..."
DOCKER_REGISTRY=${SERVICE_HOST}:${DOCKER_REGISTRY_PORT}
if ! timeout $SERVICE_TIMEOUT sh -c "while ! curl -s $DOCKER_REGISTRY; do sleep 1; done"; then
die $LINENO "docker-registry did not start"
fi
# Tag image if not already tagged
if ! docker images | grep $DOCKER_REPOSITORY_NAME; then
docker tag $DOCKER_IMAGE_NAME $DOCKER_REPOSITORY_NAME
fi
# Make sure we copied the image in Glance
if ! (glance image-show "$DOCKER_IMAGE"); then
docker push $DOCKER_REPOSITORY_NAME
fi
}
# stop_nova_hypervisor - Stop any external services
function stop_nova_hypervisor {
# Stop the docker registry container
docker kill $(docker ps | grep docker-registry | cut -d' ' -f1)
}
# Restore xtrace
$MY_XTRACE
# Local variables:
# mode: shell-script
# End:

View File

@ -320,9 +320,6 @@ case "$VIRT_DRIVER" in
openvz)
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ubuntu-12.04-x86_64}
IMAGE_URLS=${IMAGE_URLS:-"http://download.openvz.org/template/precreated/ubuntu-12.04-x86_64.tar.gz"};;
docker)
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-cirros}
IMAGE_URLS=${IMAGE_URLS:-};;
libvirt)
case "$LIBVIRT_TYPE" in
lxc) # the cirros root disk in the uec tarball is empty, so it will not work for lxc

View File

@ -1,13 +0,0 @@
# DevStack on Docker
Using Docker as Nova's hypervisor requries two steps:
* Configure DevStack by adding the following to `localrc`::
VIRT_DRIVER=docker
* Download and install the Docker service and images::
tools/docker/install_docker.sh
After this, `stack.sh` should run as normal.

View File

@ -1,68 +0,0 @@
#!/usr/bin/env bash
# **install_docker.sh** - Do the initial Docker installation and configuration
# install_docker.sh
#
# Install docker package and images
# * downloads a base busybox image and a glance registry image if necessary
# * install the images in Docker's image cache
# Keep track of the current directory
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $SCRIPT_DIR/../..; pwd)
# Import common functions
source $TOP_DIR/functions
# Load local configuration
source $TOP_DIR/stackrc
FILES=$TOP_DIR/files
# Get our defaults
source $TOP_DIR/lib/nova_plugins/hypervisor-docker
SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60}
# Install Docker Service
# ======================
if is_fedora; then
install_package docker-io socat
else
# Stop the auto-repo updates and do it when required here
NO_UPDATE_REPOS=True
# Set up home repo
curl https://get.docker.io/gpg | sudo apt-key add -
install_package python-software-properties && \
sudo sh -c "echo deb $DOCKER_APT_REPO docker main > /etc/apt/sources.list.d/docker.list"
apt_get update
install_package --force-yes lxc-docker socat
fi
# Start the daemon - restart just in case the package ever auto-starts...
restart_service docker
echo "Waiting for docker daemon to start..."
DOCKER_GROUP=$(groups | cut -d' ' -f1)
CONFIGURE_CMD="while ! /bin/echo -e 'GET /v1.3/version HTTP/1.0\n\n' | socat - unix-connect:$DOCKER_UNIX_SOCKET 2>/dev/null | grep -q '200 OK'; do
# Set the right group on docker unix socket before retrying
sudo chgrp $DOCKER_GROUP $DOCKER_UNIX_SOCKET
sudo chmod g+rw $DOCKER_UNIX_SOCKET
sleep 1
done"
if ! timeout $SERVICE_TIMEOUT sh -c "$CONFIGURE_CMD"; then
die $LINENO "docker did not start"
fi
# Get guest container image
docker pull $DOCKER_IMAGE
docker tag $DOCKER_IMAGE $DOCKER_IMAGE_NAME
# Get docker-registry image
docker pull $DOCKER_REGISTRY_IMAGE
docker tag $DOCKER_REGISTRY_IMAGE $DOCKER_REGISTRY_IMAGE_NAME