]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
implement a check for dangerous number of OSDs per host
authorAlfredo Deza <alfredo.deza@inktank.com>
Wed, 10 Sep 2014 17:54:15 +0000 (13:54 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Wed, 10 Sep 2014 17:54:15 +0000 (13:54 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/osd.py

index a86a7bd5cc19b2fd93066a3dca03f92ea9eafa66..69f9ef9a4c4b25dfe6e54dd07995072278f7c88d 100644 (file)
@@ -244,6 +244,31 @@ def prepare_disk(
         )
 
 
+def exceeds_max_osds(args, reasonable=20):
+    """
+    A very simple function to check against multiple OSDs getting created and
+    warn about the possibility of more than the recommended which would cause
+    issues with max allowed PIDs in a system.
+
+    The check is done against the ``args.disk`` object that should look like::
+
+        [
+            ('cephnode-01', '/dev/sdb', '/dev/sda5'),
+            ('cephnode-01', '/dev/sdc', '/dev/sda6'),
+            ...
+        ]
+    """
+    hosts = [item[0] for item in args.disk]
+    per_host_count = dict(
+        (
+            (h, hosts.count(h)) for h in set(hosts)
+            if hosts.count(h) > reasonable
+        )
+    )
+
+    return per_host_count
+
+
 def prepare(args, cfg, activate_prepared_disk):
     LOG.debug(
         'Preparing cluster %s disks %s',
@@ -251,6 +276,14 @@ def prepare(args, cfg, activate_prepared_disk):
         ' '.join(':'.join(x or '' for x in t) for t in args.disk),
         )
 
+    hosts_in_danger = exceeds_max_osds(args)
+
+    if hosts_in_danger:
+        LOG.warning('if ``kernel.pid_max`` is not increased to a high enough value')
+        LOG.warning('the following hosts will encounter issues:')
+        for host, count in hosts_in_danger.items():
+            LOG.warning('Host: %8s, OSDs: %s' % (host, count))
+
     key = get_bootstrap_osd_key(cluster=args.cluster)
 
     bootstrapped = set()