From: Sage Weil Date: Thu, 5 Aug 2021 17:32:00 +0000 (-0400) Subject: cephadm: use generic ceph-volume activate X-Git-Tag: v17.1.0~502^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4e9c3288720836a5c7dd23269dd9919c3bc2c1cc;p=ceph.git cephadm: use generic ceph-volume activate This allows us to activate raw or LVM osds. (In fact, LVM osds often activate via the raw method because the LVs are already available.) Signed-off-by: Sage Weil --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 87c69987f5e69..063fc88418d0c 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2813,15 +2813,42 @@ def deploy_daemon_units( p = os.path.join(data_dir, n) f.write('[ ! -L {p} ] || chown {uid}:{gid} {p}\n'.format(p=p, uid=uid, gid=gid)) else: - prestart = CephContainer( + # if ceph-volume does not support 'ceph-volume activate', we must + # do 'ceph-volume lvm activate'. + test_cv = CephContainer( ctx, image=ctx.image, entrypoint='/usr/sbin/ceph-volume', - args=[ + args=['activate', '--bad-option'], + privileged=True, + volume_mounts=get_container_mounts(ctx, fsid, daemon_type, daemon_id), + bind_mounts=get_container_binds(ctx, fsid, daemon_type, daemon_id), + cname='ceph-%s-%s.%s-activate-test' % (fsid, daemon_type, daemon_id), + ) + out, err, ret = call(ctx, test_cv.run_cmd(), verbosity=CallVerbosity.SILENT) + # bad: ceph-volume: error: unrecognized arguments: activate --bad-option + # good: ceph-volume: error: unrecognized arguments: --bad-option + if 'unrecognized arguments: activate' in err: + # older ceph-volume without top-level activate or --no-tmpfs + cmd = [ 'lvm', 'activate', str(daemon_id), osd_fsid, - '--no-systemd' - ], + '--no-systemd', + ] + else: + cmd = [ + 'activate', + '--osd-id', str(daemon_id), + '--osd-uuid', osd_fsid, + '--no-systemd', + '--no-tmpfs', + ] + + prestart = CephContainer( + ctx, + image=ctx.image, + entrypoint='/usr/sbin/ceph-volume', + args=cmd, privileged=True, volume_mounts=get_container_mounts(ctx, fsid, daemon_type, daemon_id), bind_mounts=get_container_binds(ctx, fsid, daemon_type, daemon_id),