Revision 1c6f4d42

b/snf-pithos-backend/pithos/workers/glue.py
33 33
# interpreted as representing official policies, either expressed
34 34
# or implied, of GRNET S.A.
35 35

  
36
import re
36
import ConfigParser
37 37

  
38 38

  
39 39
class WorkerGlue(object):
......
56 56
        ARCHIPELAGO_SEGMENT_TYPE = 'segdev'
57 57
        ARCHIPELAGO_SEGMENT_NAME = 'xsegbd'
58 58
        cfg = {}
59
        bcfg = open(ARCHIPELAGO_CONF_FILE).read()
60
        cfg['SEGMENT_PORTS'] = re.search('SEGMENT_PORTS\s*=\s*\d+',
61
                                         bcfg).group(0).split('=')[1]
62
        cfg['SEGMENT_SIZE'] = re.search('SEGMENT_SIZE\s*=\s*\d+',
63
                                        bcfg).group(0).split('=')[1]
59
        bcfg = ConfigParser.ConfigParser()
60
        bcfg.readfp(open(ARCHIPELAGO_CONF_FILE))
61
        cfg['SEGMENT_PORTS'] = bcfg.getint('XSEG', 'SEGMENT_PORTS')
62
        cfg['SEGMENT_DYNPORTS'] = bcfg.getint('XSEG', 'SEGMENT_DYNPORTS')
63
        cfg['SEGMENT_SIZE'] = bcfg.getint('XSEG', 'SEGMENT_SIZE')
64
        ARCHIPELAGO_SEGMENT_DYNPORTS = int(cfg['SEGMENT_DYNPORTS'])
64 65
        ARCHIPELAGO_SEGMENT_PORTS = int(cfg['SEGMENT_PORTS'])
65 66
        ARCHIPELAGO_SEGMENT_SIZE = int(cfg['SEGMENT_SIZE'])
66 67
        ARCHIPELAGO_SEGMENT_ALIGNMENT = 12
......
71 72
                super(XsegPool, self).__init__(size=pool_size)
72 73
                self.segment = Segment(ARCHIPELAGO_SEGMENT_TYPE,
73 74
                                       ARCHIPELAGO_SEGMENT_NAME,
75
                                       ARCHIPELAGO_SEGMENT_DYNPORTS,
74 76
                                       ARCHIPELAGO_SEGMENT_PORTS,
75 77
                                       ARCHIPELAGO_SEGMENT_SIZE,
76 78
                                       ARCHIPELAGO_SEGMENT_ALIGNMENT)

Also available in: Unified diff