Revision 83929f53 xseg/tools/archipelago/archipelago/common.py

b/xseg/tools/archipelago/archipelago/common.py
661 661
    sec_dic = {}
662 662
    sec_dic['portno_start'] = cfg.getint(section, 'portno_start')
663 663
    sec_dic['portno_end'] = cfg.getint(section, 'portno_end')
664
    sec_dic['log_level'] = cfg.getint(section, 'log_level')
665 664
    sec_dic['nr_ops'] = cfg.getint(section, 'nr_ops')
666
    if section == "BLOCKERB" or section == "BLOCKERM":
667
        try:
668
            sec_dic['nr_threads'] = cfg.getint(section, 'nr_threads')
669
            sec_dic['archip_dir'] = cfg.get(section, 'archip_dir')
665
    if cfg.has_option(section, 'logfile'):
666
        sec_dic['logfile'] = str(cfg.get(section, 'logfile'))
667
    if cfg.has_option(section, 'threshold'):
668
        sec_dic['threshold'] = cfg.getint(section, 'threshold')
669
    if cfg.has_option(section, 'log_level'):
670
        sec_dic['log_level'] = cfg.getint(section, 'log_level')
671

  
672
    t = str(cfg.get(section, 'type'))
673
    if t == 'file_blocker':
674
        sec_dic['nr_threads'] = cfg.getint(section, 'nr_threads')
675
        sec_dic['archip_dir'] = cfg.get(section, 'archip_dir')
676
        if cfg.has_option(section, 'fdcache'):
670 677
            sec_dic['fdcache'] = cfg.getint(section, 'fdcache')
671
        except:
672
            sec_dic['pool'] = cfg.get(section, 'pool')
673
    elif section == "MAPPERD":
678
        if cfg.has_option(section, 'direct'):
679
            sec_dic['direct'] = cfg.getboolean(section, 'direct')
680
        if cfg.has_option(section, 'unique_str'):
681
            sec_dic['unique_str'] = cfg.getint(section, 'unique_str')
682
        if cfg.has_option(section, 'prefix'):
683
            sec_dic['prefix'] = cfg.getint(section, 'prefix')
684
    elif t == 'rados_blocker':
685
        if cfg.has_option(section, 'nr_threads'):
686
            sec_dic['nr_threads'] = cfg.getint(section, 'nr_threads')
687
        sec_dic['pool'] = cfg.get(section, 'pool')
688
    elif t == 'mapperd':
674 689
        sec_dic['blockerb_port'] = cfg.getint(section, 'blockerb_port')
675 690
        sec_dic['blockerm_port'] = cfg.getint(section, 'blockerm_port')
676
    elif section == "VLMCD":
691
    elif t == 'vlmcd':
677 692
        sec_dic['blocker_port'] = cfg.getint(section, 'blocker_port')
678 693
        sec_dic['mapper_port'] = cfg.getint(section, 'mapper_port')
679
    else:
680
        raise Exception("No such section '%s'" % section)
694

  
681 695
    return sec_dic
682 696

  
683 697

  
......
694 708
    cfg = ConfigParser.ConfigParser()
695 709
    cfg.readfp(cfg_fd)
696 710
    config['SEGMENT_PORTS'] = cfg.getint('XSEG','SEGMENT_PORTS')
711
    config['SEGMENT_DYNPORTS'] = cfg.getint('XSEG', 'SEGMENT_DYNPORTS')
697 712
    config['SEGMENT_SIZE'] = cfg.getint('XSEG','SEGMENT_SIZE')
698 713
    config['XSEGBD_START'] = cfg.getint('XSEG','XSEGBD_START')
699 714
    config['XSEGBD_END'] = cfg.getint('XSEG','XSEGBD_END')
700 715
    config['VTOOL_START'] = cfg.getint('XSEG','VTOOL_START')
701 716
    config['VTOOL_END'] = cfg.getint('XSEG','VTOOL_END')
702
    config['roles'] = eval(cfg.get('ROLES','order'))
703
    config['blockerb'] = createDict(cfg, 'BLOCKERB')
704
    config['blockerm'] = createDict(cfg, 'BLOCKERM')
705
    config['mapperd'] = createDict(cfg, 'MAPPERD')
706
    config['vlmcd'] = createDict(cfg, 'VLMCD')
717
    roles = cfg.get('PEERS', 'ROLES')
718
    roles = str(roles)
719
    roles = roles.split(' ')
720
    config['roles'] = [(r, str(cfg.get(r, 'type'))) for r in roles]
721
    for r in roles:
722
        config[r] = createDict(cfg, r)
707 723

  
708 724
    if not check_conf():
709 725
        raise Error("Invalid conf file")

Also available in: Unified diff