Enable charm to configure mds cache options.

Closes-Bug: #1891409
Func-Test-PR: https://github.com/openstack-charmers/zaza-openstack-tests/pull/774
Change-Id: If2bdd5c0f2afa1843e686cf69570a50901c85875
This commit is contained in:
Ethan Myers 2022-05-19 09:44:34 -06:00
parent 721df6ebf7
commit 8f31a33a0f
4 changed files with 44 additions and 0 deletions

View File

@ -258,3 +258,24 @@ options:
description: |
Value of bluestore compression max blob size for solid state media on
pools requested by this charm.
mds-cache-memory-limit:
type: string
default: 4Gi
description: |
Set the maximum size of Metadata Server (MDS) cache, in bytes. The MDS
will try to stay under this value by (1 - mds_cache_reservation) as a
percent. This is not a hard limit.
mds-cache-reservation:
type: float
default: 0.05
description: |
The cache reservation for the MDS cache to maintain. The MDS will try
to stay under this value as a percent by (1 - mds_cache_reservation)
as a percent.
mds-health-cache-threshold:
type: float
default: 1.5
description: |
If the MDS exceeds the cache size specified in mds-cache-memory-limit,
this parameter sets the memory limit, as a percentage of
mds_cache_reservation, that triggers a health warning.

View File

@ -53,6 +53,10 @@ class CephFSCharmConfigurationAdapter(
def networks(self):
return self.charm_instance.get_networks('ceph-public-network')
@property
def mds_cache(self):
return self.charm_instance.get_mds_cache()
@property
def public_addr(self):
if ch_core.hookenv.config('prefer-ipv6'):
@ -119,6 +123,13 @@ class BaseCephFSCharm(charms_openstack.plugins.CephCharm):
return self.get_host_ip()
def get_mds_cache(self):
return {'mds-cache-memory-limit': config('mds-cache-memory-limit'),
'mds-cache-reservation': config('mds-cache-reservation'),
'mds-health-cache-threshold':
config('mds-health-cache-threshold')
}
@cached
@staticmethod
def get_host_ip(hostname=None):

View File

@ -26,6 +26,9 @@ log file = /var/log/ceph.log
[mds]
keyring = /var/lib/ceph/mds/$cluster-$id/keyring
mds cache memory limit = {{ options.mds_cache_memory_limit }}
mds cache reservation = {{ options.mds_cache_reservation }}
mds health cache threshold = {{ options.mds_health_cache_threshold }}
[mds.{{ options.mds_name }}]
host = {{ options.hostname }}

View File

@ -80,3 +80,12 @@ class TestCephFsCharm(test_utils.PatchHelper):
self.assertEquals(
self.target.options.public_addr,
'2001:db8::fake')
self.patch_target('get_mds_cache')
self.get_mds_cache.return_value = {
'mds-cache-memory-limit': '4Gi',
'mds-cache-reservation': 0.05,
'mds-health-cache-threshold': 1.5}
self.assertEquals(self.target.options.mds_cache, {
'mds-cache-memory-limit': '4Gi',
'mds-cache-reservation': 0.05,
'mds-health-cache-threshold': 1.5})