]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: create ceph-exporter sock dir if it's not present 56102/head
authorAdam King <adking@redhat.com>
Sun, 10 Mar 2024 20:42:51 +0000 (16:42 -0400)
committerAdam King <adking@redhat.com>
Sun, 10 Mar 2024 20:42:51 +0000 (16:42 -0400)
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 <adking@redhat.com>
src/cephadm/cephadm.py

index 99e0ac740a0eb76512fb018b98fbcbd9cd4f08d6..74fe21528351ac1c8ccdcedd2292ce6633c82b88 100755 (executable)
@@ -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)