Use one data container for all data volumes

The previous method of using the API image for a data container
worked, but resulted in more data being bindmounted and copied
into the system.  This patch resolves that by essentially using
a distro-type as a FROM in a Dockerfile to generate
distro-type-data.  Further all of the data containers used
throughout ansible are modified to use this new data container.

Change-Id: I8846573d4f2d4b98d4f46c770bfefc6d4c5cd0b5
Partially-Implements: blueprint one-data-container
This commit is contained in:
Steven Dake 2015-08-13 14:26:55 -07:00
parent ac61653343
commit bd5e5bbb64
20 changed files with 52 additions and 23 deletions

View File

@ -28,6 +28,10 @@ cinder_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ dock
cinder_api_tag: "{{ openstack_release }}"
cinder_api_image_full: "{{ cinder_api_image }}:{{ cinder_api_tag }}"
cinder_data_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-data"
cinder_data_image_tag: "{{ openstack_release }}"
cinder_data_image_full: "{{ cinder_data_image }}:{{ cinder_data_image_tag }}"
####################
# Openstack
@ -41,4 +45,4 @@ cinder_logging_debug: "{{ openstack_logging_debug }}"
cinder_keystone_user: "cinder"
openstack_cinder_auth: "{'auth_url':'{{ openstack_auth_v2.auth_url }}','username':'{{ openstack_auth_v2.username }}','password':'{{ openstack_auth_v2.password }}','project_name':'{{ openstack_auth_v2.project_name }}'}"
openstack_cinder_auth: "{'auth_url':'{{ openstack_auth_v2.auth_url }}','username':'{{ openstack_auth_v2.username }}','password':'{{ openstack_auth_v2.password }}','project_name':'{{ openstack_auth_v2.project_name }}'}"

View File

@ -40,8 +40,7 @@
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: cinder_data
image: "{{ cinder_api_image_full }}"
command: "/bin/sleep infinity"
image: "{{ cinder_data_image_full }}"
volumes: "/var/lib/cinder/"
- name: Starting Cinder bootstrap container

View File

@ -20,6 +20,10 @@ glance_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ dock
glance_api_tag: "{{ openstack_release }}"
glance_api_image_full: "{{ glance_api_image }}:{{ glance_api_tag }}"
glance_data_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-data"
glance_data_image_tag: "{{ openstack_release }}"
glance_data_image_full: "{{ glance_data_image }}:{{ glance_data_image_tag }}"
####################
# Openstack

View File

@ -40,8 +40,7 @@
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: glance_data
image: "{{ glance_registry_image_full }}"
command: "/bin/sleep infinity"
image: "{{ glance_data_image_full }}"
volumes: "/var/lib/glance/"
- name: Starting Glance bootstrap container

View File

@ -13,3 +13,7 @@ database_cluster_name: "openstack"
mariadb_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-galera"
mariadb_tag: "{{ openstack_release }}"
mariadb_image_full: "{{ mariadb_image }}:{{ mariadb_tag }}"
mariadb_data_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-data"
mariadb_data_tag: "{{ openstack_release }}"
mariadb_data_image_full: "{{ mariadb_data_image }}:{{ mariadb_data_tag }}"

View File

@ -49,8 +49,7 @@
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: mariadb_data
image: "{{ mariadb_image_full }}"
command: "/bin/sleep infinity"
image: "{{ mariadb_data_image_full }}"
volumes: "/var/lib/mysql/"
- name: Starting MariaDB bootstrap container

View File

@ -8,6 +8,10 @@ rabbitmq_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker
rabbitmq_tag: "{{ openstack_release }}"
rabbitmq_image_full: "{{ rabbitmq_image }}:{{ rabbitmq_tag }}"
rabbitmq_data_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-data"
rabbitmq_data_tag: "{{ openstack_release }}"
rabbitmq_data_image_full: "{{ rabbitmq_data_image }}:{{ rabbitmq_data_tag }}"
####################
# Message-Broker

View File

@ -20,8 +20,7 @@
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: rabbitmq_data
image: "{{ rabbitmq_image_full }}"
command: "/bin/sleep infinity"
image: "{{ rabbitmq_data_image_full }}"
volumes: "/var/lib/rabbitmq/"
- name: Starting RabbitMQ bootstrap container

View File

@ -0,0 +1,4 @@
FROM centos
MAINTAINER Kolla Project (https://launchpad.net/kolla)
CMD /bin/sleep infinity

View File

@ -0,0 +1 @@
../../../../tools/build-docker-image

View File

@ -19,7 +19,8 @@ RUN echo "[mariadb]" > /etc/yum.repos.d/MariaDB.repo && \
percona-xtrabackup \
pv \
tar \
expect
expect \
&& rm -rf /var/lib/mysql/*
COPY config-galera.sh /opt/kolla/config/
COPY config-external.sh /opt/kolla/

View File

@ -5,7 +5,8 @@ RUN yum -y install \
hostname \
rabbitmq-server && \
yum clean all && \
/usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management
/usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management \
&& rm -rf /var/lib/rabbitmq/*
COPY config-rabbit.sh config-external.sh /opt/kolla/
COPY start.sh /

View File

@ -0,0 +1,4 @@
FROM centos
MAINTAINER Kolla Project (https://launchpad.net/kolla)
CMD /bin/sleep infinity

View File

@ -0,0 +1 @@
../../../../tools/build-docker-image

View File

@ -74,13 +74,8 @@ function configure_db {
}
function populate_db {
if [[ $(ls /var/lib/mysql) == "" ]]; then
echo "POPULATING NEW DB"
mysql_install_db
chown -R mysql: /var/lib/mysql
else
echo "DB ALREADY EXISTS"
fi
mysql_install_db
chown -R mysql: /var/lib/mysql
}
function prepare_db {

View File

@ -2,6 +2,6 @@
function set_rabbitmq_cookie {
echo "${RABBITMQ_CLUSTER_COOKIE}" > /var/lib/rabbitmq/.erlang.cookie
chown rabbitmq: /var/lib/rabbitmq/.erlang.cookie
chown -R rabbitmq: /var/lib/rabbitmq
chmod 400 /var/lib/rabbitmq/.erlang.cookie
}

View File

@ -0,0 +1,4 @@
FROM {{ base_distro }}:{{ base_distro_tag }}
MAINTAINER Kolla Project (https://launchpad.net/kolla)
CMD /bin/sleep infinity

View File

@ -21,12 +21,16 @@ RUN yum install -y http://www.percona.com/redir/downloads/percona-release/redhat
percona-xtrabackup \
pv \
tar \
expect
expect \
&& rm -rf /var/lib/mysql/*
{% elif base_distro in ['ubuntu', 'debian'] %}
RUN ["/bin/false"]
# TODO(sdake) when ubuntu support is implemented we will need a line
# && rm -rf /var/lib/mysql/
{% endif %}
COPY config-galera.sh /opt/kolla/config/

View File

@ -6,14 +6,16 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install \
hostname \
rabbitmq-server \
&& yum clean all
&& yum clean all \
&& rm -rf /var/lib/rabbitmq/*
{% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get install -y --no-install-recommends \
hostname \
rabbitmq-server \
&& apt-get clean
&& apt-get clean \
&& rm -rf /var/lib/rabbitmq/*
{% endif %}

View File

@ -37,7 +37,7 @@ if ! [ -f "$IMAGE" ]; then
curl -L -o ./$IMAGE $IMAGE_URL/$IMAGE
fi
echo Creating glance image.
glance image-create --name cirros --progress --disk-format qcow2 --container-format bare --visibility public --progress --file ./$IMAGE
glance image-create --name cirros --progress --disk-format qcow2 --container-format bare --progress --file ./$IMAGE
if [[ "${NETWORK_MANAGER}" == "nova" ]] ; then
echo Configuring nova networking.