Don't clear osd_memory_target unconditionally

The charm can now set osd_memory_target, but it's not per device class
or type by the nature of how the charm works. Resetting
osd_memory_target always when osd_memory_target is not passed over the
relation is a bit risky behavior since operators may have set
osd_memory_target by hand with `ceph config` command out side of the
charm. Let's be less disruptive on the charm upgrade.

Closes-Bug: #1934143
Change-Id: I34dd33e54193a9ebdbc9571d153aa6206c85a067
This commit is contained in:
Nobuto Murata 2023-06-16 21:21:39 +09:00
parent 58469bc459
commit b31de1f027
1 changed files with 6 additions and 11 deletions

View File

@ -882,17 +882,12 @@ def osd_relation(relid=None, unit=None):
osd_memory_target = relation_get(
rid=relid, unit=unit, attribute='osd-memory-target'
)
if osd_host:
if osd_memory_target:
ceph.ceph_config_set(
"osd_memory_target",
osd_memory_target,
osd,
)
else:
subprocess.check_call(
["ceph", "config", "rm", osd, "osd_memory_target"]
)
if all([osd_host, osd_memory_target]):
ceph.ceph_config_set(
"osd_memory_target",
osd_memory_target,
osd,
)
else:
log('mon cluster not in quorum - deferring fsid provision')