diff --git a/config.yaml b/config.yaml index fa38e73..1b3fd98 100644 --- a/config.yaml +++ b/config.yaml @@ -126,6 +126,13 @@ options: type: int description: | Timeout value used when copying account/container/object data between nodes. + file-allocation-reserve: + default: 0 + type: int + description: | + Set the reserve space for the swift filesystem mounts. + If a disk has less than this amount of space (in bytes) free, writes + will be handed off to another disk in the ring. nagios-check-params: default: "-m -r 60 180 10 20" type: string diff --git a/lib/swift_storage_context.py b/lib/swift_storage_context.py index 4436119..cac9349 100644 --- a/lib/swift_storage_context.py +++ b/lib/swift_storage_context.py @@ -102,6 +102,7 @@ class SwiftStorageServerContext(OSContextGenerator): 'object-replicator-concurrency'), 'object_rsync_timeout': config('object-rsync-timeout'), 'object_handoffs_first': config('object-handoffs-first'), + 'fallocate_reserve': config('file-allocation-reserve'), 'statsd_host': config('statsd-host'), 'statsd_port': config('statsd-port'), 'statsd_sample_rate': config('statsd-sample-rate'), diff --git a/templates/account-server.conf b/templates/account-server.conf index befb9b1..e6bb0e7 100644 --- a/templates/account-server.conf +++ b/templates/account-server.conf @@ -5,6 +5,9 @@ workers = {{ workers }} {% if node_timeout -%} node_timeout = {{ node_timeout }} {%- endif %} +{% if fallocate_reserve != 0 %} +fallocate_reserve = {{ fallocate_reserve }} +{% endif %} {% if statsd_host %} log_statsd_host = {{ statsd_host }} diff --git a/templates/container-server.conf b/templates/container-server.conf index fa73047..822537c 100644 --- a/templates/container-server.conf +++ b/templates/container-server.conf @@ -5,6 +5,9 @@ workers = {{ workers }} {% if node_timeout -%} node_timeout = {{ node_timeout }} {%- endif %} +{% if fallocate_reserve != 0 %} +fallocate_reserve = {{ fallocate_reserve }} +{% endif %} {% if statsd_host %} log_statsd_host = {{ statsd_host }} diff --git a/templates/object-server.conf b/templates/object-server.conf index 9574d4c..2717e51 100644 --- a/templates/object-server.conf +++ b/templates/object-server.conf @@ -5,6 +5,9 @@ workers = {{ workers }} {% if node_timeout -%} node_timeout = {{ node_timeout }} {%- endif %} +{% if fallocate_reserve != 0 %} +fallocate_reserve = {{ fallocate_reserve }} +{% endif %} {% if statsd_host %} log_statsd_host = {{ statsd_host }} diff --git a/unit_tests/test_swift_storage_context.py b/unit_tests/test_swift_storage_context.py index 4935301..a9a24a9 100644 --- a/unit_tests/test_swift_storage_context.py +++ b/unit_tests/test_swift_storage_context.py @@ -96,6 +96,7 @@ class SwiftStorageContextTests(CharmTestCase): self.test_config.set('object-max-connections', '10') self.test_config.set('object-rsync-timeout', '950') self.test_config.set('object-handoffs-first', True) + self.test_config.set('file-allocation-reserve', '10737418240') ctxt = swift_context.SwiftStorageServerContext() result = ctxt() ex = { @@ -112,6 +113,7 @@ class SwiftStorageContextTests(CharmTestCase): 'container_max_connections': '10', 'object_max_connections': '10', 'object_rsync_timeout': '950', + 'fallocate_reserve': '10737418240', 'standalone_replicator': True, 'object_handoffs_first': True, 'statsd_host': '',