]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: handle exceptions applying secondary services during bootstrap
authorAdam King <adking@redhat.com>
Wed, 15 Mar 2023 17:55:26 +0000 (13:55 -0400)
committerAdam King <adking@redhat.com>
Tue, 25 Apr 2023 12:36:55 +0000 (08:36 -0400)
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 <adking@redhat.com>
(cherry picked from commit a57fc000cc40066dff8692f489e4942d5bda1f56)

src/cephadm/cephadm.py

index dae9dbd529eacefa7f72e8349c77638d66f84c6c..d8c80361fb912626bdc7985170ecde867497aee0 100755 (executable)
@@ -5422,12 +5422,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(