Skip to content

Commit 22716d3

Browse files
authored
Merge pull request ceph#57829 from gukaifeng/adjust_bootstrap_config_priorities
cephadm: the user config is preferred during the bootstrap Reviewed-by: Adam King <[email protected]>
2 parents ab67e5a + 2931d61 commit 22716d3

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

src/cephadm/cephadm.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,6 +2465,14 @@ def prepare_bootstrap_config(
24652465
):
24662466
cp.set('mon', 'auth_allow_insecure_global_id_reclaim', 'false')
24672467

2468+
if not cp.has_section('osd'):
2469+
cp.add_section('osd')
2470+
if (
2471+
not cp.has_option('osd', 'osd_memory_target_autotune')
2472+
and not cp.has_option('osd', 'osd memory target autotune')
2473+
):
2474+
cp.set('osd', 'osd_memory_target_autotune', 'true')
2475+
24682476
if ctx.single_host_defaults:
24692477
logger.info('Adjusting default settings to suit single-host cluster...')
24702478
# replicate across osds, not hosts
@@ -2792,7 +2800,7 @@ def command_bootstrap(ctx):
27922800
if not os.path.isfile(ctx.custom_prometheus_alerts):
27932801
raise Error(f'No custom prometheus alerts file found at {ctx.custom_prometheus_alerts}')
27942802

2795-
(user_conf, _) = get_config_and_keyring(ctx)
2803+
_, _ = get_config_and_keyring(ctx)
27962804

27972805
if ctx.ssh_user != 'root':
27982806
check_ssh_connectivity(ctx)
@@ -2892,18 +2900,17 @@ def cli(cmd, extra_mounts={}, timeout=DEFAULT_TIMEOUT, verbosity=CallVerbosity.V
28922900
# create mgr
28932901
create_mgr(ctx, uid, gid, fsid, mgr_id, mgr_key, config, cli)
28942902

2895-
if user_conf:
2896-
# user given config settings were already assimilated earlier
2897-
# but if the given settings contained any attributes in
2898-
# the mgr (e.g. mgr/cephadm/container_image_prometheus)
2899-
# they don't seem to be stored if there isn't a mgr yet.
2900-
# Since re-assimilating the same conf settings should be
2901-
# idempotent we can just do it again here.
2902-
with tempfile.NamedTemporaryFile(buffering=0) as tmp:
2903-
tmp.write(user_conf.encode('utf-8'))
2904-
cli(['config', 'assimilate-conf',
2905-
'-i', '/var/lib/ceph/user.conf'],
2906-
{tmp.name: '/var/lib/ceph/user.conf:z'})
2903+
# user given config settings were already assimilated earlier
2904+
# but if the given settings contained any attributes in
2905+
# the mgr (e.g. mgr/cephadm/container_image_prometheus)
2906+
# they don't seem to be stored if there isn't a mgr yet.
2907+
# Since re-assimilating the same conf settings should be
2908+
# idempotent we can just do it again here.
2909+
with tempfile.NamedTemporaryFile(buffering=0) as tmp:
2910+
tmp.write(config.encode('utf-8'))
2911+
cli(['config', 'assimilate-conf',
2912+
'-i', '/var/lib/ceph/user.conf'],
2913+
{tmp.name: '/var/lib/ceph/user.conf:z'})
29072914

29082915
if getattr(ctx, 'log_dest', None):
29092916
ldkey = 'mgr/cephadm/cephadm_log_destination'
@@ -2985,10 +2992,6 @@ def mgr_has_latest_epoch():
29852992

29862993
save_cluster_config(ctx, uid, gid, fsid)
29872994

2988-
# enable autotune for osd_memory_target
2989-
logger.info('Enabling autotune for osd_memory_target')
2990-
cli(['config', 'set', 'osd', 'osd_memory_target_autotune', 'true'])
2991-
29922995
# Notify the Dashboard to show the 'Expand cluster' page on first log in.
29932996
cli(['config-key', 'set', 'mgr/dashboard/cluster/status', 'INSTALLED'])
29942997

0 commit comments

Comments
 (0)