From b209da1306c454366210e88f5a7a0e14bdd88fc4 Mon Sep 17 00:00:00 2001 From: Qiu Yu Date: Fri, 29 Jan 2016 12:06:31 -0700 Subject: [PATCH] Fix Swift for multinode P+ACO deployment Current Swift playbook is based on the preassumption of AIO setup. However, if one goes with default multinode setup (ansible/inventory/multinode), it follows the P + ACO deployment model, which proxy-server runs on controller nodes where ACO (account/container/object services) run on storage nodes. It will break because swift proxy-server no longer has access (it shouldn't have) to /srv/node path. This change ensure disk mounting part only happens on storage node. It also moves chown from proxy-server Dockerfile to rsyncd because no matter with PACO, P+ACO or P+A+C+O model, rsyncd is always running on each storage node. Change-Id: I3aa20454902caa9c84d3901bb91e4e4c93ac5f34 Partially-Implements: blueprint swift-physical-disk Closes-Bug: #1537544 --- ansible/roles/swift/tasks/start.yml | 10 +++++++++- docker/swift/swift-base/Dockerfile.j2 | 1 - docker/swift/swift-proxy-server/Dockerfile.j2 | 3 --- docker/swift/swift-proxy-server/extend_start.sh | 3 --- docker/swift/swift-rsyncd/Dockerfile.j2 | 3 +++ .../config-swift.sh => swift-rsyncd/extend_start.sh} | 0 6 files changed, 12 insertions(+), 8 deletions(-) delete mode 100644 docker/swift/swift-proxy-server/extend_start.sh rename docker/swift/{swift-base/config-swift.sh => swift-rsyncd/extend_start.sh} (100%) diff --git a/ansible/roles/swift/tasks/start.yml b/ansible/roles/swift/tasks/start.yml index c5bb8ba545..9fbc9c562c 100644 --- a/ansible/roles/swift/tasks/start.yml +++ b/ansible/roles/swift/tasks/start.yml @@ -8,10 +8,16 @@ changed_when: "{{ swift_disk_lookup.stdout.find('localhost | SUCCESS => ') != -1 and (swift_disk_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: swift_disk_lookup.stdout.split()[2] != 'SUCCESS' + when: inventory_hostname in groups['swift-account-server'] or + inventory_hostname in groups['swift-container-server'] or + inventory_hostname in groups['swift-object-server'] - name: Reading data from variable set_fact: swift_disks: "{{ (swift_disk_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).disks|from_json }}" + when: inventory_hostname in groups['swift-account-server'] or + inventory_hostname in groups['swift-container-server'] or + inventory_hostname in groups['swift-object-server'] - name: Mounting Swift disks mount: @@ -21,6 +27,9 @@ state: mounted name: "{{ swift_devices_mount_point }}/{{ item['fs_label'] }}" with_items: swift_disks + when: inventory_hostname in groups['swift-account-server'] or + inventory_hostname in groups['swift-container-server'] or + inventory_hostname in groups['swift-object-server'] - name: Starting swift-rsyncd container kolla_docker: @@ -43,7 +52,6 @@ volumes: - "{{ node_config_directory }}/swift/:/var/lib/kolla/swift/:ro" - "{{ node_config_directory }}/swift-proxy-server/:{{ container_config_directory }}/:ro" - - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}" - "/var/lib/kolla/dev/log:/dev/log" when: inventory_hostname in groups['swift-proxy-server'] diff --git a/docker/swift/swift-base/Dockerfile.j2 b/docker/swift/swift-base/Dockerfile.j2 index 0fbe299739..880050cfb0 100644 --- a/docker/swift/swift-base/Dockerfile.j2 +++ b/docker/swift/swift-base/Dockerfile.j2 @@ -33,6 +33,5 @@ RUN ln -s swift-base-source/* swift \ {% endif %} -COPY config-swift.sh /usr/local/bin/kolla_config_swift COPY build-swift-ring.py /usr/local/bin/kolla_build_swift_ring RUN mkdir /opt/swift diff --git a/docker/swift/swift-proxy-server/Dockerfile.j2 b/docker/swift/swift-proxy-server/Dockerfile.j2 index 898103d5e6..8d8f739779 100644 --- a/docker/swift/swift-proxy-server/Dockerfile.j2 +++ b/docker/swift/swift-proxy-server/Dockerfile.j2 @@ -10,7 +10,4 @@ RUN yum -y install openstack-swift-proxy \ {% endif %} {% endif %} -COPY extend_start.sh /usr/local/bin/kolla_extend_start -RUN chmod 755 /usr/local/bin/kolla_extend_start - {{ include_footer }} diff --git a/docker/swift/swift-proxy-server/extend_start.sh b/docker/swift/swift-proxy-server/extend_start.sh deleted file mode 100644 index 8fce9c1543..0000000000 --- a/docker/swift/swift-proxy-server/extend_start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -source /usr/local/bin/kolla_config_swift diff --git a/docker/swift/swift-rsyncd/Dockerfile.j2 b/docker/swift/swift-rsyncd/Dockerfile.j2 index 5cb6734fcf..7afd4f8c2d 100644 --- a/docker/swift/swift-rsyncd/Dockerfile.j2 +++ b/docker/swift/swift-rsyncd/Dockerfile.j2 @@ -13,4 +13,7 @@ RUN apt-get install -y --no-install-recommends rsync \ {% endif %} +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start + {{ include_footer }} diff --git a/docker/swift/swift-base/config-swift.sh b/docker/swift/swift-rsyncd/extend_start.sh similarity index 100% rename from docker/swift/swift-base/config-swift.sh rename to docker/swift/swift-rsyncd/extend_start.sh