Call request pool on config changed for cinder ceph

Cinder ceph does not re-request a pool on config changed, which meant it
was not responding to changes from configuration keys such as
replication factor.

Change-Id: I4e943cf9b40554280e104cb2090ecfc043f3afbb
This commit is contained in:
Guillaume Boutry 2024-03-05 14:53:34 +01:00
parent 6818929c8a
commit b7f9d99491
No known key found for this signature in database
GPG Key ID: E95E3326872E55DE

View File

@ -225,6 +225,13 @@ class CinderCephOperatorCharm(charm.OSBaseOperatorCharmK8S):
super().__init__(framework)
self._state.set_default(api_ready=False)
def configure_charm(self, event: ops.EventBase):
"""Catchall handler to configure charm services."""
super().configure_charm(event)
if self.has_ceph_relation() and self.ceph.ready:
logger.info("CONFIG changed and ceph ready: calling request pools")
self.ceph.request_pools(event)
def get_relation_handlers(self) -> List[relation_handlers.RelationHandler]:
"""Relation handlers for the service."""
handlers = super().get_relation_handlers()
@ -265,6 +272,13 @@ class CinderCephOperatorCharm(charm.OSBaseOperatorCharmK8S):
)
]
def has_ceph_relation(self) -> bool:
"""Returns whether or not the application has been related to Ceph.
:return: True if the ceph relation has been made, False otherwise.
"""
return self.model.get_relation("ceph") is not None
def api_ready(self, event) -> None:
"""Event handler for bootstrap of service when api services are ready."""
self._state.api_ready = True