Add rsyncd image and related Ansible for Swift

Swift replicator services require rsync to function. This patch adds a
new container which is included automatically on each of the Swift
storage nodes.

Change-Id: If10fbe610ca4df21ef0f2c7a1025035d627cb4ba
Partial-Bug: #1477993
This commit is contained in:
Paul Bourke 2015-09-03 15:44:31 +00:00
parent e569d80182
commit 8fa96a1516
7 changed files with 107 additions and 0 deletions

View File

@ -40,6 +40,10 @@ swift_object_updater_image: "{{ docker_registry ~ '/' if docker_registry else ''
swift_object_updater_tag: "{{ openstack_release }}" swift_object_updater_tag: "{{ openstack_release }}"
swift_object_updater_image_full: "{{ swift_object_updater_image }}:{{ swift_object_updater_tag }}" swift_object_updater_image_full: "{{ swift_object_updater_image }}:{{ swift_object_updater_tag }}"
swift_rsyncd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-swift-rsyncd"
swift_rsyncd_tag: "{{ openstack_release }}"
swift_rsyncd_image_full: "{{ swift_rsyncd_image }}:{{ swift_rsyncd_tag }}"
#################### ####################
# Openstack # Openstack
#################### ####################

View File

@ -82,3 +82,14 @@
dest: "{{ node_config_directory }}/swift/container.ring.gz" } dest: "{{ node_config_directory }}/swift/container.ring.gz" }
- { src: "/etc/kolla/config/swift/account.ring.gz", - { src: "/etc/kolla/config/swift/account.ring.gz",
dest: "{{ node_config_directory }}/swift/account.ring.gz" } dest: "{{ node_config_directory }}/swift/account.ring.gz" }
- name: Ensuring swift-rsyncd config directory exists
file:
path: "{{ node_config_directory }}/swift-rsyncd/"
state: "directory"
recurse: "yes"
- name: Copying over swift-rsyncd config(s)
template:
src: "rsyncd.conf.j2"
dest: "{{ node_config_directory }}/swift-rsyncd/rsyncd.conf"

View File

@ -1,4 +1,24 @@
--- ---
- name: Starting Swift-rsyncd container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: swift_rsyncd
image: "{{ swift_rsyncd_image_full }}"
volumes: "{{ node_config_directory }}/swift-rsyncd/:/opt/kolla/swift-rsyncd/:ro"
volumes_from:
- swift_data
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
- name: Starting Swift Proxy Server container - name: Starting Swift Proxy Server container
docker: docker:
docker_api_version: "{{ docker_api_version }}" docker_api_version: "{{ docker_api_version }}"

View File

@ -0,0 +1,27 @@
uid = swift
gid = swift
address = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
{% if inventory_hostname in groups['swift-account-server'] %}
[account]
max connections = 2
path = {{ swift_devices_mount_point }}
read only = false
lock file = /var/lock/account.lock
{% endif %}
{% if inventory_hostname in groups['swift-container-server'] %}
[container]
max connections = 4
path = {{ swift_devices_mount_point }}
read only = false
lock file = /var/lock/container.lock
{% endif %}
{% if inventory_hostname in groups['swift-object-server'] %}
[object]
max connections = 8
path = {{ swift_devices_mount_point }}
read only = false
lock file = /var/lock/object.lock
{% endif %}

View File

@ -0,0 +1,22 @@
FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-swift-base:{{ tag }}
MAINTAINER Kolla Project (https://launchpad.net/kolla)
{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %}
RUN yum install -y rsync \
&& yum clean all
{% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get install -y --no-install-recommends \
rsync \
&& apt-get clean
{% endif %}
COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -0,0 +1,9 @@
#!/bin/bash
OWNER="swift"
if [[ -f "/opt/kolla/swift-rsyncd/rsyncd.conf" ]]; then
cp /opt/kolla/swift-rsyncd/rsyncd.conf /etc/rsyncd.conf
chown ${OWNER}: /etc/rsyncd.conf
chmod 0640 /etc/rsyncd.conf
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
set -o errexit
CMD="/usr/bin/rsync"
ARGS="--daemon --no-detach --config=/etc/rsyncd.conf"
# Loading common functions.
source /opt/kolla/kolla-common.sh
# Execute config strategy
set_configs
exec $CMD $ARGS