]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: store logs in normal location
authorSage Weil <sage@inktank.com>
Sun, 17 Feb 2013 07:44:03 +0000 (23:44 -0800)
committerSage Weil <sage@inktank.com>
Mon, 18 Feb 2013 21:39:05 +0000 (13:39 -0800)
We need to switch around how these are compressed and pulled, since they
aren't in the regular archive dir anymore.

Signed-off-by: Sage Weil <sage@inktank.com>
teuthology/ceph.conf.template
teuthology/misc.py
teuthology/task/ceph.py
teuthology/task/internal.py

index d4689b592824e5187f705791bf01452020d1b6a0..202a245403e07e052b72810ca48be1f496e4a236 100644 (file)
@@ -1,5 +1,4 @@
 [global]
-       log file = {testdir}/archive/log/$name.log
        chdir = ""
        pid file = $name.pid
         auth supported = cephx
 
        osd crush chooseleaf type = 0
 
-[mon]
-       mon cluster log file = {testdir}/archive/log/cluster.mon.$id.log
-
 [osd]
         osd journal size = 100
-        osd class dir = /usr/lib/rados-classes
 
         osd scrub load threshold = 5.0
        osd scrub max interval = 600
index 06bf521f41017494721d1583a8c03b6bed92b9ad..35f640ee2e8bbc5cc92b8bacee8ef06a6274ea3b 100644 (file)
@@ -293,11 +293,13 @@ def pull_directory(remote, remotedir, localdir):
     """
     Copy a remote directory to a local directory.
     """
-    os.mkdir(localdir)
     log.debug('Transferring archived files from %s:%s to %s',
               remote.shortname, remotedir, localdir)
+    if not os.path.exists(localdir):
+        os.mkdir(localdir)
     proc = remote.run(
         args=[
+            'sudo',
             'tar',
             'c',
             '-f', '-',
@@ -636,7 +638,7 @@ def get_valgrind_args(testdir, name, v):
         return []
     if not isinstance(v, list):
         v = [v]
-    val_path = '{tdir}/archive/log/valgrind'.format(tdir=testdir)
+    val_path = '/var/log/ceph/valgrind'.format(tdir=testdir)
     if '--tool=memcheck' in v or '--tool=helgrind' in v:
         extra_args = [
             '{tdir}/chdir-coredump'.format(tdir=testdir),
index 3d75e51e90997a655e484b2e8d600c87e85c33f5..e06c58fbd327a1d656336763f054576c2e184364 100644 (file)
@@ -77,17 +77,17 @@ class CephState(object):
     def iter_daemons_of_role(self, role):
         return self.daemons.get(role, {}).values()
 
+
 @contextlib.contextmanager
 def ceph_log(ctx, config):
-    log.info('Creating log directories...')
-    archive_dir = '{tdir}/archive'.format(tdir=teuthology.get_testdir(ctx))
+    log.info('Creating extra log directories...')
     run.wait(
         ctx.cluster.run(
             args=[
+                'sudo',
                 'install', '-d', '-m0755', '--',
-                '{adir}/log'.format(adir=archive_dir),
-                '{adir}/log/valgrind'.format(adir=archive_dir),
-                '{adir}/profiling-logger'.format(adir=archive_dir),
+                '/var/log/ceph/valgrind',
+                '/var/log/ceph/profiling-logger',
                 ],
             wait=False,
             )
@@ -95,32 +95,9 @@ def ceph_log(ctx, config):
 
     try:
         yield
-    finally:
 
-        if ctx.archive is not None:
-            log.info('Compressing logs...')
-            run.wait(
-                ctx.cluster.run(
-                    args=[
-                        'find',
-                        '{adir}/log'.format(adir=archive_dir),
-                        '-name',
-                        '*.log',
-                        '-print0',
-                        run.Raw('|'),
-                        'xargs',
-                        '-0',
-                        '--no-run-if-empty',
-                        '--',
-                        'gzip',
-                        '--',
-                        ],
-                    wait=False,
-                    ),
-                )
-
-            # log file transfer is done by the generic archive data
-            # handling
+    finally:
+        pass
 
 @contextlib.contextmanager
 def ship_utilities(ctx, config):
@@ -908,6 +885,40 @@ def cluster(ctx, config):
                             '/var/lib/ceph/mon',
                             path + '/' + role + '.tgz')
 
+            # and logs
+            log.info('Compressing logs...')
+            run.wait(
+                ctx.cluster.run(
+                    args=[
+                        'sudo',
+                        'find',
+                        '/var/log/ceph',
+                        '-name',
+                        '*.log',
+                        '-print0',
+                        run.Raw('|'),
+                        'sudo',
+                        'xargs',
+                        '-0',
+                        '--no-run-if-empty',
+                        '--',
+                        'gzip',
+                        '--',
+                        ],
+                    wait=False,
+                    ),
+                )
+
+            log.info('Archiving logs...')
+            path = os.path.join(ctx.archive, 'remote')
+            os.makedirs(path)
+            for remote in ctx.cluster.remotes.iterkeys():
+                sub = os.path.join(path, remote.shortname)
+                os.makedirs(sub)
+                teuthology.pull_directory(remote, '/var/log/ceph',
+                                          os.path.join(sub, 'log'))
+
+
         log.info('Cleaning ceph cluster...')
         run.wait(
             ctx.cluster.run(
index cbbb87c48ca28112cd0f81af4af90fdb1a8a2a8f..7195e31cb1fdda8772e51eb2254d2d2f50c53af6 100644 (file)
@@ -252,7 +252,6 @@ def archive(ctx, config):
         if ctx.archive is not None:
             log.info('Transferring archived files...')
             logdir = os.path.join(ctx.archive, 'remote')
-            os.mkdir(logdir)
             for remote in ctx.cluster.remotes.iterkeys():
                 path = os.path.join(logdir, remote.shortname)
                 teuthology.pull_directory(remote, archive_dir, path)