]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm/bootstrap: spin-off waiting for mon
authorJoao Eduardo Luis <joao@suse.com>
Wed, 30 Dec 2020 19:29:19 +0000 (19:29 +0000)
committerJuan Miguel Olmo Martínez <jolmomar@redhat.com>
Mon, 25 Jan 2021 17:29:46 +0000 (18:29 +0100)
Signed-off-by: Joao Eduardo Luis <joao@suse.com>
(cherry picked from commit 6cab3f02aadf8e20bb3064a1a52fa5892ff38f85)

src/cephadm/cephadm

index 8ea06f98b450b1c6e650f79b5ac2b5642f86e6b8..6981d021d61ebc26ed704d7af6b8e4fec6af299c 100755 (executable)
@@ -3264,6 +3264,37 @@ def create_mon(
     return (mon_dir, log_dir)
 
 
+def wait_for_mon(
+    ctx: CephadmContext,
+    mon_id: str, mon_dir: str,
+    admin_keyring_path: str, config_path: str
+):
+    logger.info('Waiting for mon to start...')
+    c = CephContainer(
+        ctx,
+        image=ctx.args.image,
+        entrypoint='/usr/bin/ceph',
+        args=[
+            'status'],
+        volume_mounts={
+            mon_dir: '/var/lib/ceph/mon/ceph-%s:z' % (mon_id),
+            admin_keyring_path: '/etc/ceph/ceph.client.admin.keyring:z',
+            config_path: '/etc/ceph/ceph.conf:z',
+        },
+    )
+
+    # wait for the service to become available
+    def is_mon_available():
+        # type: () -> bool
+        timeout=ctx.args.timeout if ctx.args.timeout else 60 # seconds
+        out, err, ret = call(ctx, c.run_cmd(),
+                             desc=c.entrypoint,
+                             timeout=timeout)
+        return ret == 0
+
+    is_available(ctx, 'mon', is_mon_available)
+
+
 @default_image
 def command_bootstrap(ctx):
     # type: (CephadmContext) -> int
@@ -3316,7 +3347,7 @@ def command_bootstrap(ctx):
     l.acquire()
 
     # ip
-    (base_ip, addr_arg) = obtain_mon_ip(ctx)    
+    (base_ip, addr_arg) = obtain_mon_ip(ctx)
 
     mon_network = None
     if not ctx.args.skip_mon_network:
@@ -3396,29 +3427,7 @@ def command_bootstrap(ctx):
             volume_mounts=mounts,
         ).run(timeout=timeout)
 
-    logger.info('Waiting for mon to start...')
-    c = CephContainer(
-        ctx,
-        image=ctx.args.image,
-        entrypoint='/usr/bin/ceph',
-        args=[
-            'status'],
-        volume_mounts={
-            mon_dir: '/var/lib/ceph/mon/ceph-%s:z' % (mon_id),
-            admin_keyring.name: '/etc/ceph/ceph.client.admin.keyring:z',
-            tmp_config.name: '/etc/ceph/ceph.conf:z',
-        },
-    )
-
-    # wait for the service to become available
-    def is_mon_available():
-        # type: () -> bool
-        timeout=ctx.args.timeout if ctx.args.timeout else 60 # seconds
-        out, err, ret = call(ctx, c.run_cmd(),
-                             desc=c.entrypoint,
-                             timeout=timeout)
-        return ret == 0
-    is_available(ctx, 'mon', is_mon_available)
+    wait_for_mon(ctx, mon_id, mon_dir, admin_keyring.name, tmp_config.name)
 
     # assimilate and minimize config
     if not ctx.args.no_minimize_config: