From b8fa505969c1ad7d38a83d6d87c9891326e20622 Mon Sep 17 00:00:00 2001 From: Matthew Oliver Date: Thu, 19 Nov 2015 15:01:52 +1100 Subject: [PATCH] Add container-reconciler and object-expirer to os-swift The container-reconciler and object-expirer were missing from the os-swift role. The reconciler makes sure incorrectly placed objets live in the correct storage policy. The expirer is the service that deletes expired objects. This change also adds the abilty to optionally specify a reclaim_age in the swift section of the configuration, which is now set in all the locations required, still with the default of 604800 seconds (7 days). Change-Id: Ic56a714c3fb3c84b9bb5ed8e2ae3c86dad474161 Closes-Bug: #1516877 --- etc/openstack_deploy/conf.d/swift.yml.example | 4 ++ playbooks/roles/os_swift/defaults/main.yml | 6 +++ .../tasks/swift_storage_hosts_container.yml | 13 +++++ .../tasks/swift_storage_hosts_object.yml | 13 +++++ .../account-server-replicator.conf.j2 | 1 + .../os_swift/templates/account-server.conf.j2 | 1 + .../templates/container-reconciler.conf.j2 | 29 +++++++++++ .../container-server-replicator.conf.j2 | 1 + .../templates/container-server.conf.j2 | 1 + .../os_swift/templates/object-expirer.conf.j2 | 50 +++++++++++++++++++ .../object-server-replicator.conf.j2 | 1 + .../os_swift/templates/object-server.conf.j2 | 1 + 12 files changed, 121 insertions(+) create mode 100644 playbooks/roles/os_swift/templates/container-reconciler.conf.j2 create mode 100644 playbooks/roles/os_swift/templates/object-expirer.conf.j2 diff --git a/etc/openstack_deploy/conf.d/swift.yml.example b/etc/openstack_deploy/conf.d/swift.yml.example index 0616ca1aae..a15a54f095 100644 --- a/etc/openstack_deploy/conf.d/swift.yml.example +++ b/etc/openstack_deploy/conf.d/swift.yml.example @@ -81,6 +81,10 @@ # Weight of a disk. Applies to all disks in all storage hosts unless # overridden deeper in the structure. Defaults to 100. # +# Option: reclaim_age (optional, integer, default 604800) +# The amount of time in seconds before items, such as tombstones are +# reclaimed, default is 604800 (7 Days). +# # Example: # # Define a typical deployment: diff --git a/playbooks/roles/os_swift/defaults/main.yml b/playbooks/roles/os_swift/defaults/main.yml index 897dc75b11..04795ea389 100644 --- a/playbooks/roles/os_swift/defaults/main.yml +++ b/playbooks/roles/os_swift/defaults/main.yml @@ -118,9 +118,11 @@ swift_account_replicator_program_config_options: /etc/swift/account-server/accou swift_container_server_program_config_options: /etc/swift/container-server/container-server.conf swift_container_replicator_program_config_options: /etc/swift/container-server/container-server-replicator.conf +swift_container_reconciler_program_config_options: /etc/swift/container-server/container-reconciler.conf swift_object_server_program_config_options: /etc/swift/object-server/object-server.conf swift_object_replicator_program_config_options: /etc/swift/object-server/object-server-replicator.conf +swift_object_expirer_program_config_options: /etc/swift/object-server/object-expirer.conf swift_proxy_server_program_config_options: /etc/swift/proxy-server/proxy-server.conf @@ -221,6 +223,7 @@ swift_container_program_names: - swift-container-sync - swift-container-updater - swift-container-replicator-server + - swift-container-reconciler swift_object_program_names: - swift-object-server @@ -228,6 +231,7 @@ swift_object_program_names: - swift-object-replicator - swift-object-updater - swift-object-replicator-server + - swift-object-expirer swift_proxy_program_names: - swift-proxy-server @@ -239,6 +243,8 @@ swift_proxy_server_conf_overrides: {} swift_account_server_conf_overrides: {} swift_account_server_replicator_conf_overrides: {} swift_container_server_conf_overrides: {} +swift_container_reconciler_conf_overrides: {} swift_container_server_replicator_conf_overrides: {} swift_object_server_conf_overrides: {} +swift_object_expirer_conf_overrides: {} swift_object_server_replicator_conf_overrides: {} diff --git a/playbooks/roles/os_swift/tasks/swift_storage_hosts_container.yml b/playbooks/roles/os_swift/tasks/swift_storage_hosts_container.yml index 7cf784ed6a..0d31bc46c2 100644 --- a/playbooks/roles/os_swift/tasks/swift_storage_hosts_container.yml +++ b/playbooks/roles/os_swift/tasks/swift_storage_hosts_container.yml @@ -88,6 +88,15 @@ system_group: "{{ swift_system_group_name }}" service_home: "{{ swift_system_home_folder }}" +- include: swift_upstart_common_init.yml + vars: + program_name: "swift-container-reconciler" + program_config_options: "{{ swift_container_reconciler_program_config_options }}" + service_name: "{{ swift_service_name }}" + system_user: "{{ swift_system_user_name }}" + system_group: "{{ swift_system_group_name }}" + service_home: "{{ swift_system_home_folder }}" + - name: "Swift container server configuration" config_template: src: "{{ item.src }}" @@ -102,6 +111,10 @@ dest: "/etc/swift/container-server/container-server.conf" config_overrides: "{{ swift_container_server_conf_overrides }}" config_type: "ini" + - src: "container-reconciler.conf.j2" + dest: "/etc/swift/container-server/container-reconciler.conf" + config_overrides: "{{ swift_container_reconciler_conf_overrides }}" + config_type: "ini" notify: Restart swift container services # We only create the dedicated replicator configuration when using a dedicated replication_network diff --git a/playbooks/roles/os_swift/tasks/swift_storage_hosts_object.yml b/playbooks/roles/os_swift/tasks/swift_storage_hosts_object.yml index 8d96fd8fae..974a0e474e 100644 --- a/playbooks/roles/os_swift/tasks/swift_storage_hosts_object.yml +++ b/playbooks/roles/os_swift/tasks/swift_storage_hosts_object.yml @@ -79,6 +79,15 @@ system_group: "{{ swift_system_group_name }}" service_home: "{{ swift_system_home_folder }}" +- include: swift_upstart_common_init.yml + vars: + program_name: "swift-object-expirer" + program_config_options: "{{ swift_object_expirer_program_config_options }}" + service_name: "{{ swift_service_name }}" + system_user: "{{ swift_system_user_name }}" + system_group: "{{ swift_system_group_name }}" + service_home: "{{ swift_system_home_folder }}" + - name: "Swift object server configuration" config_template: src: "{{ item.src }}" @@ -93,6 +102,10 @@ dest: "/etc/swift/object-server/object-server.conf" config_overrides: "{{ swift_object_server_conf_overrides }}" config_type: "ini" + - src: "object-expirer.conf.j2" + dest: "/etc/swift/object-server/object-expirer.conf" + config_overrides: "{{ swift_object_expirer_conf_overrides }}" + config_type: "ini" notify: Restart swift object services # We only create the dedicated replicator configuration when using a dedicated replication_network diff --git a/playbooks/roles/os_swift/templates/account-server-replicator.conf.j2 b/playbooks/roles/os_swift/templates/account-server-replicator.conf.j2 index 5afdb9a3a7..2dfe13dd39 100644 --- a/playbooks/roles/os_swift/templates/account-server-replicator.conf.j2 +++ b/playbooks/roles/os_swift/templates/account-server-replicator.conf.j2 @@ -21,3 +21,4 @@ replication_server = True [account-replicator] log_facility = LOG_LOCAL2 per_diff = 10000 +reclaim_age = {{ reclaim_age | default(604800) }} diff --git a/playbooks/roles/os_swift/templates/account-server.conf.j2 b/playbooks/roles/os_swift/templates/account-server.conf.j2 index 64024d9353..937d28c862 100644 --- a/playbooks/roles/os_swift/templates/account-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/account-server.conf.j2 @@ -32,6 +32,7 @@ recon_lock_path = /var/lock [account-replicator] log_facility = LOG_LOCAL2 per_diff = 10000 +reclaim_age = {{ reclaim_age | default(604800) }} {% endif %} [account-auditor] diff --git a/playbooks/roles/os_swift/templates/container-reconciler.conf.j2 b/playbooks/roles/os_swift/templates/container-reconciler.conf.j2 new file mode 100644 index 0000000000..0f18864b83 --- /dev/null +++ b/playbooks/roles/os_swift/templates/container-reconciler.conf.j2 @@ -0,0 +1,29 @@ +[DEFAULT] +swift_dir = /etc/swift +user = {{ swift_system_user_name }} +log_facility = LOG_LOCAL3 + +[container-reconciler] +# The reconciler will re-attempt reconciliation if the source object is not +# available up to reclaim_age seconds before it gives up and deletes the entry +# in the queue. +reclaim_age = {{ reclaim_age | default(604800) }} +# The cycle time of the daemon +interval = 30 +# Server errors from requests will be retried by default +request_tries = 3 + +[pipeline:main] +pipeline = catch_errors proxy-logging cache proxy-server + +[app:proxy-server] +use = egg:swift#proxy + +[filter:cache] +use = egg:swift#memcache + +[filter:proxy-logging] +use = egg:swift#proxy_logging + +[filter:catch_errors] +use = egg:swift#catch_errors diff --git a/playbooks/roles/os_swift/templates/container-server-replicator.conf.j2 b/playbooks/roles/os_swift/templates/container-server-replicator.conf.j2 index 6c7dae393b..7420df3c58 100644 --- a/playbooks/roles/os_swift/templates/container-server-replicator.conf.j2 +++ b/playbooks/roles/os_swift/templates/container-server-replicator.conf.j2 @@ -20,3 +20,4 @@ replication_server = True [container-replicator] log_facility = LOG_LOCAL3 +reclaim_age = {{ reclaim_age | default(604800) }} diff --git a/playbooks/roles/os_swift/templates/container-server.conf.j2 b/playbooks/roles/os_swift/templates/container-server.conf.j2 index a15a1057db..16372de1ce 100644 --- a/playbooks/roles/os_swift/templates/container-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/container-server.conf.j2 @@ -32,6 +32,7 @@ recon_lock_path = /var/lock {% if swift.replication_network is not defined or swift.replication_network == swift.storage_network %} [container-replicator] log_facility = LOG_LOCAL3 +reclaim_age = {{ reclaim_age | default(604800) }} {% endif %} [container-updater] diff --git a/playbooks/roles/os_swift/templates/object-expirer.conf.j2 b/playbooks/roles/os_swift/templates/object-expirer.conf.j2 new file mode 100644 index 0000000000..87d8a0d0d8 --- /dev/null +++ b/playbooks/roles/os_swift/templates/object-expirer.conf.j2 @@ -0,0 +1,50 @@ +# {{ ansible_managed }} + +[DEFAULT] +swift_dir = /etc/swift +user = {{ swift_system_user_name }} +log_facility = LOG_LOCAL4 + +[object-expirer] +interval = 300 +auto_create_account_prefix = . +expiring_objects_account_name = expiring_objects +report_interval = 300 +# concurrency is the level of concurrency to use to do the work, this value +# must be set to at least 1 +concurrency = 3 +# processes is how many parts to divide the work into, one part per process +# that will be doing the work +# processes set 0 means that a single process will be doing all the work +# processes can also be specified on the command line and will override the +# config value +processes = {{ groups['swift_hosts'] | length }} +# process is which of the parts a particular process will work on +# process can also be specified on the command line and will override the config +# value +# process is "zero based", if you want to use 3 processes, you should run +# processes with process set to 0, 1, and 2 +process = {{ groups['swift_hosts'].index(inventory_hostname) }} +# The expirer will re-attempt expiring if the source object is not available +# up to reclaim_age seconds before it gives up and deletes the entry in the +# queue. +reclaim_age = {{ reclaim_age | default(604800) }} +recon_cache_path = /var/cache/swift + +[pipeline:main] +pipeline = catch_errors proxy-logging cache proxy-server + +[app:proxy-server] +use = egg:swift#proxy +# See proxy-server.conf-sample for options + +[filter:cache] +use = egg:swift#memcache +# See proxy-server.conf-sample for options + +[filter:catch_errors] +use = egg:swift#catch_errors +# See proxy-server.conf-sample for options + +[filter:proxy-logging] +use = egg:swift#proxy_logging diff --git a/playbooks/roles/os_swift/templates/object-server-replicator.conf.j2 b/playbooks/roles/os_swift/templates/object-server-replicator.conf.j2 index ef9ead2291..5193d3b792 100644 --- a/playbooks/roles/os_swift/templates/object-server-replicator.conf.j2 +++ b/playbooks/roles/os_swift/templates/object-server-replicator.conf.j2 @@ -21,3 +21,4 @@ replication_server = True [object-replicator] log_facility = LOG_LOCAL4 concurrency = 6 +reclaim_age = {{ reclaim_age | default(604800) }} diff --git a/playbooks/roles/os_swift/templates/object-server.conf.j2 b/playbooks/roles/os_swift/templates/object-server.conf.j2 index e0cb57279c..8cff6e2f75 100644 --- a/playbooks/roles/os_swift/templates/object-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/object-server.conf.j2 @@ -34,6 +34,7 @@ recon_lock_path = /var/lock [object-replicator] log_facility = LOG_LOCAL4 concurrency = 6 +reclaim_age = {{ reclaim_age | default(604800) }} {% endif %} [object-updater]