From d463d3f7bf23585fe6fe3b3795e1872ce1653f8c Mon Sep 17 00:00:00 2001 From: Scott Solkhon Date: Tue, 13 Aug 2019 12:35:46 +0000 Subject: [PATCH] Enable Swift Recon This commit adds the necessary configuration to the Swift account, container and object configuration files to enable the Swift recon cli. In order to give the object server on each Swift host access to the recon files, a Docker volume is mounted into each container which generates them. The volume is then mounted read only into the object server container. Note that multiple containers append to the same file. This should not be a problem since Swift uses a lock when appending. Change-Id: I343d8f45a78ebc3c11ed0c68fe8bec24f9ea7929 Co-authored-by: Doug Szumski --- ansible/group_vars/all.yml | 1 + ansible/roles/swift/tasks/start.yml | 10 ++++++ ansible/roles/swift/templates/account.conf.j2 | 8 ++++- .../roles/swift/templates/container.conf.j2 | 8 ++++- ansible/roles/swift/templates/object.conf.j2 | 8 ++++- doc/source/reference/storage/swift-guide.rst | 34 +++++++++++++++++-- .../notes/swift-recon-91592dd93526f1a8.yaml | 16 +++++++++ 7 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/swift-recon-91592dd93526f1a8.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index f58b495c0f..dab3e2c9ec 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -627,6 +627,7 @@ enable_solum: "no" enable_storm: "{{ enable_monasca | bool }}" enable_swift: "no" enable_swift_s3api: "no" +enable_swift_recon: "no" enable_tacker: "no" enable_telegraf: "no" enable_tempest: "no" diff --git a/ansible/roles/swift/tasks/start.yml b/ansible/roles/swift/tasks/start.yml index 648b6e92c8..bb18521be2 100644 --- a/ansible/roles/swift/tasks/start.yml +++ b/ansible/roles/swift/tasks/start.yml @@ -74,6 +74,7 @@ - "{{ node_config_directory }}/swift-account-auditor/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-account-server'] - name: Starting swift-account-replication-server container @@ -108,6 +109,7 @@ - "{{ node_config_directory }}/swift-account-replicator/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-account-server'] - name: Starting swift-account-reaper container @@ -150,6 +152,7 @@ - "{{ node_config_directory }}/swift-container-auditor/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-container-server'] - name: Starting swift-container-replication-server container @@ -184,6 +187,7 @@ - "{{ node_config_directory }}/swift-container-replicator/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-container-server'] - name: Starting swift-container-updater container @@ -198,6 +202,7 @@ - "{{ node_config_directory }}/swift-container-updater/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-container-server'] - name: Starting swift-object-server container @@ -212,6 +217,7 @@ - "{{ node_config_directory }}/swift-object-server/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift:ro" when: inventory_hostname in groups['swift-object-server'] - name: Starting swift-object-auditor container @@ -226,6 +232,7 @@ - "{{ node_config_directory }}/swift-object-auditor/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-object-server'] - name: Starting swift-object-replication-server container @@ -260,6 +267,7 @@ - "{{ node_config_directory }}/swift-object-replicator/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-object-server'] - name: Starting swift-object-updater container @@ -274,6 +282,7 @@ - "{{ node_config_directory }}/swift-object-updater/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-object-server'] - name: Starting swift-object-expirer container @@ -288,6 +297,7 @@ - "{{ node_config_directory }}/swift-object-expirer/:{{ container_config_directory }}/:ro" - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}:shared" - "/etc/localtime:/etc/localtime:ro" + - "swift_recon_cache:/var/cache/swift" when: inventory_hostname in groups['swift-object-server'] - name: Starting swift-proxy-server container diff --git a/ansible/roles/swift/templates/account.conf.j2 b/ansible/roles/swift/templates/account.conf.j2 index e0a6a522f1..78f73bdbec 100644 --- a/ansible/roles/swift/templates/account.conf.j2 +++ b/ansible/roles/swift/templates/account.conf.j2 @@ -12,7 +12,13 @@ log_level = {{ swift_log_level }} workers = {{ openstack_service_workers }} [pipeline:main] -pipeline = account-server +pipeline = {% if enable_swift_recon %}recon {% endif %}account-server + +{% if enable_swift_recon %} +[filter:recon] +use = egg:swift#recon +recon_cache_path = /var/cache/swift +{% endif %} [app:account-server] use = egg:swift#account diff --git a/ansible/roles/swift/templates/container.conf.j2 b/ansible/roles/swift/templates/container.conf.j2 index f68464a9e7..62cf38aa1e 100644 --- a/ansible/roles/swift/templates/container.conf.j2 +++ b/ansible/roles/swift/templates/container.conf.j2 @@ -12,7 +12,13 @@ log_level = {{ swift_log_level }} workers = {{ openstack_service_workers }} [pipeline:main] -pipeline = container-server +pipeline = {% if enable_swift_recon %}recon {% endif %}container-server + +{% if enable_swift_recon %} +[filter:recon] +use = egg:swift#recon +recon_cache_path = /var/cache/swift +{% endif %} [app:container-server] use = egg:swift#container diff --git a/ansible/roles/swift/templates/object.conf.j2 b/ansible/roles/swift/templates/object.conf.j2 index 63c81b0639..537c952db8 100644 --- a/ansible/roles/swift/templates/object.conf.j2 +++ b/ansible/roles/swift/templates/object.conf.j2 @@ -16,7 +16,13 @@ workers = {{ openstack_service_workers }} {% if service_name == 'swift-object-expirer' %} pipeline = proxy-server {% else %} -pipeline = object-server +pipeline = {% if enable_swift_recon %}recon {% endif %}object-server +{% endif %} + +{% if enable_swift_recon %} +[filter:recon] +use = egg:swift#recon +recon_cache_path = /var/cache/swift {% endif %} [app:object-server] diff --git a/doc/source/reference/storage/swift-guide.rst b/doc/source/reference/storage/swift-guide.rst index bba79d272a..18b9c238d4 100644 --- a/doc/source/reference/storage/swift-guide.rst +++ b/doc/source/reference/storage/swift-guide.rst @@ -272,6 +272,34 @@ S3 API The Swift S3 API can be enabled by setting ``enable_swift_s3api`` to ``true`` in ``globals.yml``. It is disabled by default. In order to use this API it is -necessary to obtain EC2 credentials from Keystone. See the `Swift documentation -`__ -for details. +necessary to obtain EC2 credentials from Keystone. See the :swift-doc:`the +Swift documentation +` for +details. + +Swift Recon +~~~~~~~~~~~ + +Enable Swift Recon in ``/etc/kolla/globals.yml``: + +.. code-block:: yaml + + enable_swift_recon : "yes" + + +The Swift role in Kolla-Ansible is still using the old role format. Unlike many +other Kolla Ansible roles, it won't automatically add the new volume to the +containers in existing deployments when running `kolla-ansible reconfigure`. +Instead we must use the `kolla-ansible upgrade` command, which will remove the +existing containers and then put them back again. + +Example usage: + +.. code-block:: console + + $ sudo docker exec swift_object_server swift-recon --all` + + + +For more information, see :swift-doc:`the Swift documentation +`. diff --git a/releasenotes/notes/swift-recon-91592dd93526f1a8.yaml b/releasenotes/notes/swift-recon-91592dd93526f1a8.yaml new file mode 100644 index 0000000000..2e703989f5 --- /dev/null +++ b/releasenotes/notes/swift-recon-91592dd93526f1a8.yaml @@ -0,0 +1,16 @@ +--- +features: + - | + Enable Swift Recon + + Adds the necessary configuration to the Swift account, container + and object configuration files to enable the Swift recon cli. + + In order to give the object server on each Swift host access to the + recon files, a Docker volume is mounted into each container which + generates them. The volume is then mounted read only into the object + server container. Note that multiple containers append to the same + file. This should not be a problem since Swift uses a lock when + appending. + + Example usage: `sudo docker exec swift_object_server swift-recon --all`