Skip to content

Commit 3b28df8

Browse files
committed
cephadm: fix handling of ceph-exporter sock-dir
Fixes: https://tracker.ceph.com/issues/69475 It turns out the sock-dir for ceph-exporter only needs to exist within the container, not on the host. Previous code, including the validation function this commit removes and previous patches trying to fix the ceph-exporter asok file not appearing on the host, were all done assuming it mattered what was on the host. This patch changes things so all we do with the sock dir is mount it to /var/run/ceph/<fsid> and don't worry about whether that dir exists on the host. Additionally, the patch makes it so /var/run/ceph/<fsid> is created during ceph-exporter deployment. Signed-off-by: Adam King <[email protected]>
1 parent cb47171 commit 3b28df8

File tree

1 file changed

+5
-13
lines changed
  • src/cephadm/cephadmlib/daemons

1 file changed

+5
-13
lines changed

src/cephadm/cephadmlib/daemons/ceph.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,9 @@ def get_daemon_args(self) -> List[str]:
343343
)
344344
return args
345345

346-
def validate(self) -> None:
347-
if not os.path.isdir(self.sock_dir):
348-
raise Error(
349-
f'Desired sock dir for ceph-exporter is not directory: {self.sock_dir}'
350-
)
351-
352346
def container(self, ctx: CephadmContext) -> CephContainer:
347+
uid, gid = self.uid_gid(ctx)
348+
make_run_dir(ctx.fsid, uid, gid)
353349
ctr = daemon_to_container(ctx, self)
354350
return to_deployment_container(ctx, ctr)
355351

@@ -366,6 +362,9 @@ def customize_container_mounts(
366362
) -> None:
367363
cm = Ceph.get_ceph_mounts(ctx, self.identity)
368364
mounts.update(cm)
365+
# we want to always mount /var/run/ceph/<fsid> to the sock
366+
# dir within the container. See https://tracker.ceph.com/issues/69475
367+
mounts.update({f'/var/run/ceph/{ctx.fsid}': self.sock_dir})
369368
if self.https_enabled:
370369
data_dir = self.identity.data_dir(ctx.data_dir)
371370
mounts.update({os.path.join(data_dir, 'etc/certs'): '/etc/certs'})
@@ -390,13 +389,6 @@ def customize_container_envs(
390389
def default_entrypoint(self) -> str:
391390
return self.entrypoint
392391

393-
def prepare_data_dir(self, data_dir: str, uid: int, gid: int) -> None:
394-
if not os.path.exists(self.sock_dir):
395-
os.mkdir(self.sock_dir)
396-
# part of validation is for the sock dir, so we postpone
397-
# it until now
398-
self.validate()
399-
400392
def create_daemon_dirs(self, data_dir: str, uid: int, gid: int) -> None:
401393
"""Create files under the container data dir"""
402394
if not os.path.isdir(data_dir):

0 commit comments

Comments
 (0)