From 39b0e5d4438624a6a981c3ae4606b7ce200cbe28 Mon Sep 17 00:00:00 2001 From: Steve Lewis Date: Mon, 3 Aug 2015 22:56:24 -0700 Subject: [PATCH] Add sorting_method to swift proxy config as needed When read_affinity is used and sorting_method is not used warnings are generated in the swift proxy log indicating that the read_affinity is not being respected. When read_affinity is specified this change sets the sorting_method to affinity automatically, and otherwise uses a configured value which defaults to shuffle. Note that write_affinity does not respect sorting_method and follows a different code path and does not issue warnings in logs when used without sorting_method. Closes-bug: 1480581 Co-Authored-By: Andy McCrae Change-Id: I3cab89c95f288b4a59f4dd3c7360daca7a4f47bf --- etc/openstack_deploy/conf.d/swift.yml.example | 3 ++- playbooks/roles/os_swift/defaults/main.yml | 1 + playbooks/roles/os_swift/templates/proxy-server.conf.j2 | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/openstack_deploy/conf.d/swift.yml.example b/etc/openstack_deploy/conf.d/swift.yml.example index 95aee740e0..6bfe5c9277 100644 --- a/etc/openstack_deploy/conf.d/swift.yml.example +++ b/etc/openstack_deploy/conf.d/swift.yml.example @@ -245,7 +245,8 @@ # E.g. read_affinity: "r1=100" this would prefer region 1 # read_affinity: "r1z1=100, r1=200" this would prefer region 1 zone 1 # if that is unavailable region 1, otherwise any available region/zone. -# Lower number is higher priority. +# Lower number is higher priority. When this option is specified the +# sorting_method is set to 'affinity' automatically. # # Option: write_affinity (optional, string) # Specify which region to prefer when object PUT requests are made. diff --git a/playbooks/roles/os_swift/defaults/main.yml b/playbooks/roles/os_swift/defaults/main.yml index f74ae5e605..9dda635883 100644 --- a/playbooks/roles/os_swift/defaults/main.yml +++ b/playbooks/roles/os_swift/defaults/main.yml @@ -93,6 +93,7 @@ swift_allow_versions: True swift_allow_all_users: False # If you want to regenerate the swift keys, on a run, for rsync purposes set this var to True otherwise keys will be generated on the first run and not regenerated each run. swift_recreate_keys: False +swift_sorting_method: shuffle ## Swift ceilometer variables swift_reselleradmin_role: ResellerAdmin diff --git a/playbooks/roles/os_swift/templates/proxy-server.conf.j2 b/playbooks/roles/os_swift/templates/proxy-server.conf.j2 index fef3502d2b..518950df1e 100644 --- a/playbooks/roles/os_swift/templates/proxy-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/proxy-server.conf.j2 @@ -23,6 +23,7 @@ account_autocreate = true {% if swift_proxy_vars is defined %} {% if swift_proxy_vars.read_affinity is defined %} read_affinity = {{ swift_proxy_vars.read_affinity }} +{% set swift_sorting_method = 'affinity' %} {% endif %} {% if swift_proxy_vars.write_affinity is defined %} write_affinity = {{ swift_proxy_vars.write_affinity }} @@ -31,6 +32,7 @@ write_affinity_node_count = {{ swift_proxy_vars.write_affinity_node_count }} {% endif %} {% endif %} {% endif %} +sorting_method = {{ swift_sorting_method }} {% if 'tempauth' in swift_middleware_list %} [filter:tempauth]