From 0e3b4fa36b4574397dfbdb30f033ffbeec722bd8 Mon Sep 17 00:00:00 2001 From: Adam King Date: Sun, 10 Mar 2024 16:42:51 -0400 Subject: [PATCH] cephadm: create ceph-exporter sock dir if it's not present Since this is usually /var/run/ceph/ which ends up getting created by other daemons as well, it was common to see ceph-exporter fail to deploy and then deploy fine after once other daemons were down on the host. I don't see any reason we can't just try to make the directory here instead of bailing out. This patch had to be rewritten for reef, as it depended on changes in cephadm that will not be backported to reef. Fixes: https://tracker.ceph.com/issues/64491 Signed-off-by: Adam King --- src/cephadm/cephadm.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 99e0ac740a0..74fe2152835 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -1339,6 +1339,13 @@ class CephExporter(object): ] return args + def create_daemon_dirs(self, data_dir: str, uid: int, gid: int) -> None: + if not os.path.exists(self.sock_dir): + os.mkdir(self.sock_dir) + # part of validation is for the sock dir, so we postpone + # it until now + self.validate() + def validate(self) -> None: if not os.path.isdir(self.sock_dir): raise Error(f'Directory does not exist. Got: {self.sock_dir}') @@ -3303,6 +3310,10 @@ def create_daemon_dirs(ctx, fsid, daemon_type, daemon_id, uid, gid, node_proxy = NodeProxy.init(ctx, fsid, daemon_id) node_proxy.create_daemon_dirs(data_dir, uid, gid) + elif daemon_type == CephExporter.daemon_type: + ceph_exporter = CephExporter.init(ctx, fsid, daemon_id) + ceph_exporter.create_daemon_dirs(data_dir, uid, gid) + _write_custom_conf_files(ctx, daemon_type, str(daemon_id), fsid, uid, gid) -- 2.39.5