]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: fix adoption of osds from custom name clusters 46264/head
authorAdam King <adking@redhat.com>
Fri, 13 May 2022 16:53:09 +0000 (12:53 -0400)
committerAdam King <adking@redhat.com>
Fri, 13 May 2022 16:55:10 +0000 (12:55 -0400)
Fixes: https://tracker.ceph.com/issues/55654
Signed-off-by: Adam King <adking@redhat.com>
src/cephadm/cephadm

index 5eb3f1e321a8befa4e7129ce337d59b50eca1be9..b21015ae7ac261264bc3bc79151442ff8d09b60b 100755 (executable)
@@ -3300,6 +3300,16 @@ def deploy_daemon_units(
                     bind_mounts=get_container_binds(ctx, fsid, daemon_type, daemon_id),
                     cname='ceph-%s-%s.%s-activate' % (fsid, daemon_type, daemon_id),
                 )
+                if 'cluster' in ctx and ctx.cluster:
+                    # ctx.cluster is only set during adoption of a daemon from a cluster
+                    # with a custom name (not "ceph"). The initial activate command the first
+                    # time we start the new cephadm based systemd unit for this osd must account
+                    # for this by mounting to the correct data dir in the container. Otherwise
+                    # necessary files from the old data dir of the daemon won't be copied over
+                    # to the new data dir on the host. After the first start (e.g. on any redeploys)
+                    # this is no longer necessary as we will have these files in the data dir on the host
+                    if data_dir in prestart.volume_mounts:
+                        prestart.volume_mounts[data_dir] = f'/var/lib/ceph/osd/{ctx.cluster}-{daemon_id}'
                 _write_container_cmd_to_bash(ctx, f, prestart, 'LVM OSDs use ceph-volume lvm activate')
         elif daemon_type == CephIscsi.daemon_type:
             f.write(' '.join(CephIscsi.configfs_mount_umount(data_dir, mount=True)) + '\n')