From: Adam King Date: Wed, 15 Mar 2023 17:55:26 +0000 (-0400) Subject: cephadm: handle exceptions applying secondary services during bootstrap X-Git-Tag: v17.2.7~489^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F50904%2Fhead;p=ceph.git cephadm: handle exceptions applying secondary services during bootstrap Otherwise we risk hitting a mismatch between the cephadm binary version and the container image version we're bootstrapping on, resulting in bootstrap failing. Example in the tracker. Fixes: https://tracker.ceph.com/issues/59082 Signed-off-by: Adam King (cherry picked from commit a57fc000cc40066dff8692f489e4942d5bda1f56) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index dbe2e639b661..f6ef534dc8dc 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -5272,12 +5272,22 @@ def prepare_ssh( if not ctx.skip_monitoring_stack: for t in ['ceph-exporter', 'prometheus', 'grafana', 'node-exporter', 'alertmanager']: logger.info('Deploying %s service with default placement...' % t) - cli(['orch', 'apply', t]) + try: + cli(['orch', 'apply', t]) + except RuntimeError: + ctx.error_code = -errno.EINVAL + logger.error(f'Failed to apply service type {t}. ' + 'Perhaps the ceph version being bootstrapped does not support it') if ctx.with_centralized_logging: for t in ['loki', 'promtail']: logger.info('Deploying %s service with default placement...' % t) - cli(['orch', 'apply', t]) + try: + cli(['orch', 'apply', t]) + except RuntimeError: + ctx.error_code = -errno.EINVAL + logger.error(f'Failed to apply service type {t}. ' + 'Perhaps the ceph version being bootstrapped does not support it') def enable_cephadm_mgr_module(