From f0de8613681a9114b14c11cc93b5ba3d790f0094 Mon Sep 17 00:00:00 2001 From: Xav Paice Date: Wed, 3 May 2017 14:54:38 +1200 Subject: [PATCH] Add options for osd backfill pressure Added options for osd_max_backfills and osd_recovery_max_active, if we should want to override the default. Change-Id: Iaeb93d3068b1fab242acf2d741c36be5f4b29b57 Closes-bug: #1661560 --- config.yaml | 18 ++++++++++++++++++ hooks/ceph_hooks.py | 2 ++ templates/ceph.conf | 6 ++++++ unit_tests/test_ceph_hooks.py | 14 ++++++++++++++ 4 files changed, 40 insertions(+) diff --git a/config.yaml b/config.yaml index aa716d22..e61f1fec 100644 --- a/config.yaml +++ b/config.yaml @@ -135,6 +135,24 @@ options: default, the initial crush weight for the newly added osd is set to its volume size in TB. Leave this option unset to use the default provided by Ceph itself. This option only affects NEW OSDs, not existing ones. + osd-max-backfills: + type: int + default: + description: | + The maximum number of backfills allowed to or from a single OSD. + . + Setting this option on a running Ceph OSD node will not affect running + OSD devices, but will add the setting to ceph.conf for the next restart. + osd-recovery-max-active: + type: int + default: + description: | + The number of active recovery requests per OSD at one time. More requests + will accelerate recovery, but the requests places an increased load on the + cluster. + . + Setting this option on a running Ceph OSD node will not affect running + OSD devices, but will add the setting to ceph.conf for the next restart. ignore-device-errors: type: boolean default: False diff --git a/hooks/ceph_hooks.py b/hooks/ceph_hooks.py index 8253d8b8..ed6bd7bd 100755 --- a/hooks/ceph_hooks.py +++ b/hooks/ceph_hooks.py @@ -244,6 +244,8 @@ def get_ceph_context(upgrading=False): 'old_auth': cmp_pkgrevno('ceph', "0.51") < 0, 'crush_initial_weight': config('crush-initial-weight'), 'osd_journal_size': config('osd-journal-size'), + 'osd_max_backfills': config('osd-max-backfills'), + 'osd_recovery_max_active': config('osd-recovery-max-active'), 'use_syslog': str(config('use-syslog')).lower(), 'ceph_public_network': public_network, 'ceph_cluster_network': cluster_network, diff --git a/templates/ceph.conf b/templates/ceph.conf index 4a967cf0..bbef3dee 100644 --- a/templates/ceph.conf +++ b/templates/ceph.conf @@ -74,6 +74,12 @@ journal dio = {{ dio }} osd max object name len = 256 osd max object namespace len = 64 {% endif %} +{%- if osd_max_backfills %} +osd max backfills = {{ osd_max_backfills }} +{%- endif %} +{%- if osd_recovery_max_active %} +osd recovery max active = {{ osd_recovery_max_active }} +{%- endif %} {% if osd -%} # The following are user-provided options provided via the config-flags charm option. {% for key in osd -%} diff --git a/unit_tests/test_ceph_hooks.py b/unit_tests/test_ceph_hooks.py index 874603cf..9ec304e6 100644 --- a/unit_tests/test_ceph_hooks.py +++ b/unit_tests/test_ceph_hooks.py @@ -25,6 +25,8 @@ CHARM_CONFIG = {'config-flags': '', 'loglevel': 1, 'use-syslog': True, 'osd-journal-size': 1024, + 'osd-max-backfills': 1, + 'osd-recovery-max-active': 2, 'use-direct-io': True, 'osd-format': 'ext4', 'prefer-ipv6': False, @@ -63,6 +65,8 @@ class CephHooksTestCase(unittest.TestCase): 'old_auth': False, 'crush_initial_weight': '0', 'osd_journal_size': 1024, + 'osd_max_backfills': 1, + 'osd_recovery_max_active': 2, 'public_addr': '10.0.0.1', 'short_object_len': True, 'upgrade_in_progress': False, @@ -98,6 +102,8 @@ class CephHooksTestCase(unittest.TestCase): 'old_auth': False, 'crush_initial_weight': '0', 'osd_journal_size': 1024, + 'osd_max_backfills': 1, + 'osd_recovery_max_active': 2, 'public_addr': '10.0.0.1', 'short_object_len': True, 'upgrade_in_progress': False, @@ -133,6 +139,8 @@ class CephHooksTestCase(unittest.TestCase): 'old_auth': False, 'crush_initial_weight': '0', 'osd_journal_size': 1024, + 'osd_max_backfills': 1, + 'osd_recovery_max_active': 2, 'public_addr': '10.0.0.1', 'short_object_len': True, 'upgrade_in_progress': False, @@ -169,6 +177,8 @@ class CephHooksTestCase(unittest.TestCase): 'old_auth': False, 'crush_initial_weight': '0', 'osd_journal_size': 1024, + 'osd_max_backfills': 1, + 'osd_recovery_max_active': 2, 'public_addr': '10.0.0.1', 'short_object_len': True, 'upgrade_in_progress': False, @@ -205,6 +215,8 @@ class CephHooksTestCase(unittest.TestCase): 'osd': {'osd max write size': 1024}, 'crush_initial_weight': '0', 'osd_journal_size': 1024, + 'osd_max_backfills': 1, + 'osd_recovery_max_active': 2, 'public_addr': '10.0.0.1', 'short_object_len': True, 'upgrade_in_progress': False, @@ -243,6 +255,8 @@ class CephHooksTestCase(unittest.TestCase): 'osd': {'osd max write size': 1024}, 'crush_initial_weight': '0', 'osd_journal_size': 1024, + 'osd_max_backfills': 1, + 'osd_recovery_max_active': 2, 'public_addr': '10.0.0.1', 'short_object_len': True, 'upgrade_in_progress': False,