summaryrefslogtreecommitdiffstats
path: root/src/cephadm
diff options
context:
space:
mode:
Diffstat (limited to 'src/cephadm')
-rwxr-xr-xsrc/cephadm/cephadm.py37
-rw-r--r--src/cephadm/cephadmlib/daemons/ceph.py4
-rw-r--r--src/cephadm/cephadmlib/daemons/iscsi.py37
3 files changed, 45 insertions, 33 deletions
diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py
index 5ed8306fd47..df7a657e24c 100755
--- a/src/cephadm/cephadm.py
+++ b/src/cephadm/cephadm.py
@@ -2466,6 +2466,14 @@ def prepare_bootstrap_config(
):
cp.set('mon', 'auth_allow_insecure_global_id_reclaim', 'false')
+ if not cp.has_section('osd'):
+ cp.add_section('osd')
+ if (
+ not cp.has_option('osd', 'osd_memory_target_autotune')
+ and not cp.has_option('osd', 'osd memory target autotune')
+ ):
+ cp.set('osd', 'osd_memory_target_autotune', 'true')
+
if ctx.single_host_defaults:
logger.info('Adjusting default settings to suit single-host cluster...')
# replicate across osds, not hosts
@@ -2711,7 +2719,7 @@ def command_bootstrap(ctx):
if not os.path.isfile(ctx.custom_prometheus_alerts):
raise Error(f'No custom prometheus alerts file found at {ctx.custom_prometheus_alerts}')
- (user_conf, _) = get_config_and_keyring(ctx)
+ _, _ = get_config_and_keyring(ctx)
if ctx.ssh_user != 'root':
check_ssh_connectivity(ctx)
@@ -2811,18 +2819,17 @@ def command_bootstrap(ctx):
# create mgr
create_mgr(ctx, uid, gid, fsid, mgr_id, mgr_key, config, cli)
- if user_conf:
- # user given config settings were already assimilated earlier
- # but if the given settings contained any attributes in
- # the mgr (e.g. mgr/cephadm/container_image_prometheus)
- # they don't seem to be stored if there isn't a mgr yet.
- # Since re-assimilating the same conf settings should be
- # idempotent we can just do it again here.
- with tempfile.NamedTemporaryFile(buffering=0) as tmp:
- tmp.write(user_conf.encode('utf-8'))
- cli(['config', 'assimilate-conf',
- '-i', '/var/lib/ceph/user.conf'],
- {tmp.name: '/var/lib/ceph/user.conf:z'})
+ # user given config settings were already assimilated earlier
+ # but if the given settings contained any attributes in
+ # the mgr (e.g. mgr/cephadm/container_image_prometheus)
+ # they don't seem to be stored if there isn't a mgr yet.
+ # Since re-assimilating the same conf settings should be
+ # idempotent we can just do it again here.
+ with tempfile.NamedTemporaryFile(buffering=0) as tmp:
+ tmp.write(config.encode('utf-8'))
+ cli(['config', 'assimilate-conf',
+ '-i', '/var/lib/ceph/user.conf'],
+ {tmp.name: '/var/lib/ceph/user.conf:z'})
if getattr(ctx, 'log_dest', None):
ldkey = 'mgr/cephadm/cephadm_log_destination'
@@ -2904,10 +2911,6 @@ def command_bootstrap(ctx):
save_cluster_config(ctx, uid, gid, fsid)
- # enable autotune for osd_memory_target
- logger.info('Enabling autotune for osd_memory_target')
- cli(['config', 'set', 'osd', 'osd_memory_target_autotune', 'true'])
-
# Notify the Dashboard to show the 'Expand cluster' page on first log in.
cli(['config-key', 'set', 'mgr/dashboard/cluster/status', 'INSTALLED'])
diff --git a/src/cephadm/cephadmlib/daemons/ceph.py b/src/cephadm/cephadmlib/daemons/ceph.py
index e6392876cc6..55a92835129 100644
--- a/src/cephadm/cephadmlib/daemons/ceph.py
+++ b/src/cephadm/cephadmlib/daemons/ceph.py
@@ -292,8 +292,8 @@ class CephExporter(ContainerDaemonForm):
self.image = image
self.sock_dir = config_json.get('sock-dir', '/var/run/ceph/')
- ipv4_addrs, _ = get_ip_addresses(get_hostname())
- addrs = '0.0.0.0' if ipv4_addrs else '::'
+ _, ipv6_addrs = get_ip_addresses(get_hostname())
+ addrs = '::' if ipv6_addrs else '0.0.0.0'
self.addrs = config_json.get('addrs', addrs)
self.port = config_json.get('port', self.DEFAULT_PORT)
self.prio_limit = config_json.get('prio-limit', 5)
diff --git a/src/cephadm/cephadmlib/daemons/iscsi.py b/src/cephadm/cephadmlib/daemons/iscsi.py
index ade88a90af0..c4b60f4a771 100644
--- a/src/cephadm/cephadmlib/daemons/iscsi.py
+++ b/src/cephadm/cephadmlib/daemons/iscsi.py
@@ -119,22 +119,31 @@ class CephIscsi(ContainerDaemonForm):
@staticmethod
def get_version(ctx, container_id):
# type: (CephadmContext, str) -> Optional[str]
- version = None
- out, err, code = call(
- ctx,
- [
- ctx.container_engine.path,
- 'exec',
- container_id,
- '/usr/bin/python3',
- '-c',
- "import pkg_resources; print(pkg_resources.require('ceph_iscsi')[0].version)",
- ],
- verbosity=CallVerbosity.QUIET,
+ def python(s: str) -> Tuple[str, str, int]:
+ return call(
+ ctx,
+ [
+ ctx.container_engine.path,
+ 'exec',
+ container_id,
+ '/usr/bin/python3',
+ '-c',
+ s,
+ ],
+ verbosity=CallVerbosity.QUIET,
+ )
+
+ out, _, code = python(
+ "from importlib.metadata import version; print(version('ceph_iscsi'))"
+ )
+ if code == 0:
+ return out.strip()
+ out, _, code = python(
+ "import pkg_resources; print(pkg_resources.require('ceph_iscsi')[0].version)"
)
if code == 0:
- version = out.strip()
- return version
+ return out.strip()
+ return None
def validate(self):
# type: () -> None