File: dencoder.py

package info (click to toggle)
ceph 18.2.7%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,186,140 kB
  • sloc: cpp: 6,278,388; ansic: 3,507,431; python: 372,964; asm: 216,381; java: 133,450; sh: 125,043; xml: 39,398; ruby: 32,026; makefile: 29,004; javascript: 23,994; cs: 18,980; perl: 9,708; sql: 7,833; lisp: 5,920; pascal: 3,109; ada: 1,681; yacc: 478; awk: 188; f90: 55; php: 1
file content (94 lines) | stat: -rw-r--r-- 3,118 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import logging


from teuthology import misc
from teuthology.orchestra import run
from teuthology.task import Task

log = logging.getLogger(__name__)

class DENcoder(Task):
    """
    This task is used to test dencoder on the data on the given device.
    The task is expected to be run on a remote host.
    The task will run the DENcoder binary on the remote host
    """
    
    def __init__(self, ctx, config):
        super(DENcoder, self).__init__(ctx, config)
        self.ctx = ctx
        self.config = config
        self.testdir = misc.get_testdir(ctx)
        self.branch_N = config.get('branch_N', 'main')
        self.branch_N_2 = config.get('branch_N-2', 'quincy')
        self.log = log
        self.log.info('Starting DENcoder task...')

    def setup(self):
        """
        cloning the ceph repository on the remote host
        and submodules including the ceph-object-corpus
        that way we will have the readable.sh script available
        """
        super(DENcoder, self).setup()
        self.first_mon = next(iter(self.ctx.cluster.only(misc.get_first_mon(self.ctx, self.config)).remotes.keys()))
        self.first_mon.run(
                args=[
                    'git', 'clone', '-b', self.branch_N,
                    'https://github.com/ceph/ceph.git',
                    '{tdir}/ceph'.format(tdir=self.testdir)
                ]
        )
        self.ceph_dir = '{tdir}/ceph'.format(tdir=self.testdir)

        self.first_mon.run(
                args=[
                    'cd', '{tdir}/ceph'.format(tdir=self.testdir),
                    run.Raw('&&'),
                    'git', 'submodule', 'update', '--init', '--recursive'
                ]
        )
        self.corpus_dir = '{ceph_dir}/ceph-object-corpus'.format(ceph_dir=self.ceph_dir)

    def begin(self):
        """
        Run the dencoder readable.sh script on the remote host
        find any errors in the output
        """
        super(DENcoder, self).begin()
        self.log.info('Running DENcoder task...')
        self.log.info('Running DENcoder on the remote host...')
        # print ceph-dencoder version
        self.first_mon.run(
            args=[
                'cd', self.ceph_dir,
                run.Raw('&&'),
                'ceph-dencoder', 'version'
            ]
        )
        # run first check for type ceph-dencoder type MonMap
        self.first_mon.run(
            args=[
                'ceph-dencoder', 'type', 'MonMap'
            ]
        )

        # run the readable.sh script
        self.first_mon.run(
            args=[
                'CEPH_ROOT={ceph_dir}'.format(ceph_dir=self.ceph_dir),
                'CEPH_BUILD_DIR={ceph_dir}'.format(ceph_dir=self.ceph_dir),
                'CEPH_BIN=/usr/bin',
                'CEPH_LIB=/usr/lib',
                'src/test/encoding/readable.sh','ceph-dencoder'
            ]
        )
        # check for errors in the output
        
        self.log.info('DENcoder task completed...')

    def end(self):
        super(DENcoder, self).end()
        self.log.info('DENcoder task ended...')
        
task = DENcoder