]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix FSID not being set in ceph.conf
authorJohn Spray <jcspray@gmail.com>
Thu, 12 Dec 2013 21:33:19 +0000 (13:33 -0800)
committerJohn Spray <jcspray@gmail.com>
Thu, 12 Dec 2013 21:34:52 +0000 (13:34 -0800)
Symptom was that 'ceph --admin-daemon... config get fsid'
returned zeros, while correct fsid was present in cluster maps.
Fix it by populating FSID in ceph.conf, after extracting it from
monmap.

teuthology/misc.py
teuthology/task/ceph.py

index 6895c2547727a1d4d7664813d13c1b2348095e27..85e386d45a733880cc57d91c1c6cf929c943f76d 100644 (file)
@@ -13,6 +13,7 @@ import urllib2
 import urlparse
 import yaml
 import json
+import re
 
 from teuthology import safepath
 from .orchestra import run
@@ -251,6 +252,8 @@ def create_simple_monmap(ctx, remote, conf):
     Assumes ceph_conf is up to date.
 
     Assumes mon sections are named "mon.*", with the dot.
+
+    :return the FSID (as a string) of the newly created monmap
     """
     def gen_addresses():
         for section, data in conf.iteritems():
@@ -280,9 +283,14 @@ def create_simple_monmap(ctx, remote, conf):
             '--print',
             '{tdir}/monmap'.format(tdir=testdir),
             ])
-    remote.run(
+
+    r = remote.run(
         args=args,
+        stdout=StringIO()
         )
+    monmap_output = r.stdout.getvalue()
+    fsid = re.search("generated fsid (.+)$", monmap_output, re.MULTILINE).group(1)
+    return fsid
 
 def write_file(remote, path, data):
     remote.run(
index e7e335b7c2cc3500e84ce46c94d00d322474df88..4bd2b59e835fe96d8aa81c029d50b7040607388f 100644 (file)
@@ -523,30 +523,8 @@ def cluster(ctx, config):
     ctx.ceph = argparse.Namespace()
     ctx.ceph.conf = conf
 
-    conf_path = config.get('conf_path', '/etc/ceph/ceph.conf')
     keyring_path = config.get('keyring_path', '/etc/ceph/ceph.keyring')
 
-    log.info('Writing configs...')
-    conf_fp = StringIO()
-    conf.write(conf_fp)
-    conf_fp.seek(0)
-    writes = ctx.cluster.run(
-        args=[
-            'sudo', 'mkdir', '-p', '/etc/ceph', run.Raw('&&'),
-            'sudo', 'chmod', '0755', '/etc/ceph', run.Raw('&&'),
-            'sudo', 'python',
-            '-c',
-            'import shutil, sys; shutil.copyfileobj(sys.stdin, file(sys.argv[1], "wb"))',
-            conf_path,
-            run.Raw('&&'),
-            'sudo', 'chmod', '0644', conf_path,
-            ],
-        stdin=run.PIPE,
-        wait=False,
-        )
-    teuthology.feed_many_stdins_and_close(conf_fp, writes)
-    run.wait(writes)
-
     coverage_dir = '{tdir}/archive/coverage'.format(tdir=testdir)
 
     firstmon = teuthology.get_first_mon(ctx, config)
@@ -584,11 +562,36 @@ def cluster(ctx, config):
             ],
         )
     (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
-    teuthology.create_simple_monmap(
+    fsid = teuthology.create_simple_monmap(
         ctx,
         remote=mon0_remote,
         conf=conf,
         )
+    if not 'global' in conf:
+        conf['global'] = {}
+    conf['global']['fsid'] = fsid
+
+    log.info('Writing ceph.conf for FSID %s...' % fsid)
+    conf_path = config.get('conf_path', '/etc/ceph/ceph.conf')
+    conf_fp = StringIO()
+    conf.write(conf_fp)
+    conf_fp.seek(0)
+    writes = ctx.cluster.run(
+        args=[
+            'sudo', 'mkdir', '-p', '/etc/ceph', run.Raw('&&'),
+            'sudo', 'chmod', '0755', '/etc/ceph', run.Raw('&&'),
+            'sudo', 'python',
+            '-c',
+            'import shutil, sys; shutil.copyfileobj(sys.stdin, file(sys.argv[1], "wb"))',
+            conf_path,
+            run.Raw('&&'),
+            'sudo', 'chmod', '0644', conf_path,
+            ],
+        stdin=run.PIPE,
+        wait=False,
+        )
+    teuthology.feed_many_stdins_and_close(conf_fp, writes)
+    run.wait(writes)
 
     log.info('Creating admin key on %s...' % firstmon)
     ctx.cluster.only(firstmon).run(