]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: move get_valgrind_args to qa
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 3 Mar 2021 02:38:36 +0000 (18:38 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 3 Mar 2021 17:30:08 +0000 (09:30 -0800)
This method is unused in the teuthology repo. The helper method better
belongs here where it is more easily modified.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
qa/tasks/ceph.py
qa/tasks/ceph_fuse.py
qa/tasks/ceph_manager.py
qa/tasks/cephfs/fuse_mount.py
qa/tasks/cephfs_mirror.py
qa/tasks/rbd_fsx.py
qa/tasks/rbd_mirror.py
qa/tasks/rgw.py

index afd665f76ec44c4717b8c8bd32c2482e32f31551..4d0432f95cd4c25dc97e938057505ada547e0e41 100644 (file)
@@ -21,7 +21,7 @@ import socket
 import yaml
 
 from paramiko import SSHException
-from tasks.ceph_manager import CephManager, write_conf
+from tasks.ceph_manager import CephManager, write_conf, get_valgrind_args
 from tarfile import ReadError
 from tasks.cephfs.filesystem import Filesystem
 from teuthology import misc as teuthology
@@ -1385,9 +1385,7 @@ def run_daemon(ctx, config, type_):
                     valgrind_args = config['valgrind'][type_]
                 if role in config['valgrind']:
                     valgrind_args = config['valgrind'][role]
-                run_cmd = teuthology.get_valgrind_args(testdir, role,
-                                                       run_cmd,
-                                                       valgrind_args)
+                run_cmd = get_valgrind_args(testdir, role, run_cmd, valgrind_args)
 
             run_cmd.extend(run_cmd_tail)
             log_path = f'/var/log/ceph/{cluster_name}-{type_}.{id_}.log'
index 67432ead41d1d1e20b380c79ec922f270230e38a..d01c313110b3e3c9583807615401b1ca6499fe21 100644 (file)
@@ -5,7 +5,7 @@ Ceph FUSE client task
 import contextlib
 import logging
 
-from teuthology import misc as teuthology
+from teuthology import misc
 from tasks.cephfs.fuse_mount import FuseMount
 
 log = logging.getLogger(__name__)
@@ -78,7 +78,7 @@ def task(ctx, config):
     log.info('Running ceph_fuse task...')
 
     if config is None:
-        ids = teuthology.all_roles_of_type(ctx.cluster, 'client')
+        ids = misc.all_roles_of_type(ctx.cluster, 'client')
         client_roles = [f'client.{id_}' for id_ in ids]
         config = dict([r, dict()] for r in client_roles)
     elif isinstance(config, list):
@@ -90,8 +90,8 @@ def task(ctx, config):
         raise ValueError(f"Invalid config object: {config} ({config.__class__})")
     log.info(f"config is {config}")
 
-    clients = list(teuthology.get_clients(ctx=ctx, roles=client_roles))
-    testdir = teuthology.get_testdir(ctx)
+    clients = list(misc.get_clients(ctx=ctx, roles=client_roles))
+    testdir = misc.get_testdir(ctx)
     all_mounts = getattr(ctx, 'mounts', {})
     mounted_by_me = {}
     skipped = {}
@@ -113,7 +113,7 @@ def task(ctx, config):
                 client_config[k] = v
         # mount specific overrides
         client_config_overrides = overrides.get(entity)
-        teuthology.deep_merge(client_config, client_config_overrides)
+        misc.deep_merge(client_config, client_config_overrides)
         log.info(f"{entity} config is {client_config}")
 
         remotes.add(remote)
index f28565ef1cbf37bb778214c2cd4e548e56f80893..ce6fec15517ff030fc36cb50dcea9ab671201387 100644 (file)
@@ -68,6 +68,63 @@ def write_conf(ctx, conf_path=DEFAULT_CONF_PATH, cluster='ceph'):
     teuthology.feed_many_stdins_and_close(conf_fp, writes)
     run.wait(writes)
 
+def get_valgrind_args(testdir, name, preamble, v, exit_on_first_error=True):
+    """
+    Build a command line for running valgrind.
+
+    testdir - test results directory
+    name - name of daemon (for naming hte log file)
+    preamble - stuff we should run before valgrind
+    v - valgrind arguments
+    """
+    if v is None:
+        return preamble
+    if not isinstance(v, list):
+        v = [v]
+
+    # https://tracker.ceph.com/issues/44362
+    preamble.extend([
+        'env', 'OPENSSL_ia32cap=~0x1000000000000000',
+    ])
+
+    val_path = '/var/log/ceph/valgrind'
+    if '--tool=memcheck' in v or '--tool=helgrind' in v:
+        extra_args = [
+            'valgrind',
+            '--trace-children=no',
+            '--child-silent-after-fork=yes',
+            '--soname-synonyms=somalloc=*tcmalloc*',
+            '--num-callers=50',
+            '--suppressions={tdir}/valgrind.supp'.format(tdir=testdir),
+            '--xml=yes',
+            '--xml-file={vdir}/{n}.log'.format(vdir=val_path, n=name),
+            '--time-stamp=yes',
+            '--vgdb=yes',
+        ]
+    else:
+        extra_args = [
+            'valgrind',
+            '--trace-children=no',
+            '--child-silent-after-fork=yes',
+            '--soname-synonyms=somalloc=*tcmalloc*',
+            '--suppressions={tdir}/valgrind.supp'.format(tdir=testdir),
+            '--log-file={vdir}/{n}.log'.format(vdir=val_path, n=name),
+            '--time-stamp=yes',
+            '--vgdb=yes',
+        ]
+    if exit_on_first_error:
+        extra_args.extend([
+            # at least Valgrind 3.14 is required
+            '--exit-on-first-error=yes',
+            '--error-exitcode=42',
+        ])
+    args = [
+        'cd', testdir,
+        run.Raw('&&'),
+    ] + preamble + extra_args + v
+    log.debug('running %s under valgrind with args %s', name, args)
+    return args
+
 
 def mount_osd_data(ctx, remote, cluster, osd):
     """
index 9885c2015668c76bccec091a54eff2ff70a8291a..e8279d4b47c429baeb989eb23df1124987d82654 100644 (file)
@@ -5,11 +5,11 @@ import logging
 from io import StringIO
 from textwrap import dedent
 
-from teuthology import misc
 from teuthology.contextutil import MaxWhileTries
 from teuthology.contextutil import safe_while
 from teuthology.orchestra import run
 from teuthology.orchestra.run import CommandFailedError
+from tasks.ceph_manager import get_valgrind_args
 from tasks.cephfs.mount import CephFSMount
 
 log = logging.getLogger(__name__)
@@ -95,13 +95,13 @@ class FuseMount(CephFSMount):
 
         cwd = self.test_dir
         if self.client_config.get('valgrind') is not None:
-            run_cmd = misc.get_valgrind_args(
+            run_cmd = get_valgrind_args(
                 self.test_dir,
                 'client.{id}'.format(id=self.client_id),
                 run_cmd,
                 self.client_config.get('valgrind'),
             )
-            cwd = None # misc.get_valgrind_args chdir for us
+            cwd = None # get_valgrind_args chdir for us
 
         netns_prefix = ['sudo', 'nsenter',
                         '--net=/var/run/netns/{0}'.format(self.netns_name)]
index aa67fca135c8c390da91a3f7859e60c366445f59..42c01aaea0342e92d8d2020b5470c2ac89bf64e9 100644 (file)
@@ -8,6 +8,7 @@ from teuthology.orchestra import run
 from teuthology import misc
 from teuthology.exceptions import ConfigError
 from teuthology.task import Task
+from tasks.ceph_manager import get_valgrind_args
 from tasks.util import get_remote_for_role
 
 log = logging.getLogger(__name__)
@@ -42,7 +43,7 @@ class CephFSMirror(Task):
             ]
 
         if 'valgrind' in self.config:
-            args = misc.get_valgrind_args(
+            args = get_valgrind_args(
                 testdir, 'cephfs-mirror-{id}'.format(id=self.client),
                 args, self.config.get('valgrind'))
 
index 396d8fed2a21a4f539d8dabd473cbc23027c7758..efea7208e5e70c4048f5879eea61ed49405d3beb 100644 (file)
@@ -7,6 +7,7 @@ import logging
 from teuthology.exceptions import ConfigError
 from teuthology.parallel import parallel
 from teuthology import misc as teuthology
+from tasks.ceph_manager import get_valgrind_args
 
 log = logging.getLogger(__name__)
 
@@ -62,7 +63,7 @@ def _run_one_client(ctx, config, role):
     teuthology.deep_merge(config, overrides.get('rbd_fsx', {}))
 
     if config.get('valgrind'):
-        args = teuthology.get_valgrind_args(
+        args = get_valgrind_args(
             testdir,
             'fsx_{id}'.format(id=role),
             args,
index 5d6d1b2b6eb252ff08313ac2c19083b60f74d419..5da252560dc65d41176ecc586b2f5a3f52f67056 100644 (file)
@@ -8,6 +8,7 @@ from teuthology.orchestra import run
 from teuthology import misc
 from teuthology.exceptions import ConfigError
 from teuthology.task import Task
+from tasks.ceph_manager import get_valgrind_args
 from tasks.util import get_remote_for_role
 
 log = logging.getLogger(__name__)
@@ -85,7 +86,7 @@ class RBDMirror(Task):
             ]
 
         if 'valgrind' in self.config:
-            args = misc.get_valgrind_args(
+            args = get_valgrind_args(
                 testdir,
                 'rbd-mirror-{id}'.format(id=self.client),
                 args,
index 220165661819df089e689dd5942857c384255581..c5ffc9a6eb375051c871ed90b95e3f3bb0188b47 100644 (file)
@@ -9,6 +9,7 @@ from teuthology.orchestra import run
 from teuthology import misc as teuthology
 from teuthology import contextutil
 from teuthology.exceptions import ConfigError
+from tasks.ceph_manager import get_valgrind_args
 from tasks.util import get_remote_for_role
 from tasks.util.rgw import rgwadmin, wait_for_radosgw
 from tasks.util.rados import (create_ec_pool,
@@ -153,7 +154,7 @@ def start_rgw(ctx, config, clients):
             ])
 
         if client_config.get('valgrind'):
-            cmd_prefix = teuthology.get_valgrind_args(
+            cmd_prefix = get_valgrind_args(
                 testdir,
                 client_with_cluster,
                 cmd_prefix,