Beispiel #1
0
def test_only_bad_reassign(current_actor_context):
    bad_reassign_config = MultipathConfig(pathname='bad_reassign.conf',
                                          reassign_maps=True)
    facts = MultipathConfFacts(configs=[bad_reassign_config])

    current_actor_context.feed(facts)
    current_actor_context.run()
    reports = list(current_actor_context.consume(Report))
    assert reports and len(reports) == 1
    _assert_reassign_maps(reports[0].report, 'bad_reassign.conf')
Beispiel #2
0
def test_only_bad_detect(current_actor_context):
    bad_detect_config = MultipathConfig(pathname='bad_detect.conf',
                                        default_detect_prio=True,
                                        default_detect_checker=False)
    facts = MultipathConfFacts(configs=[bad_detect_config])

    current_actor_context.feed(facts)
    current_actor_context.run()
    reports = list(current_actor_context.consume(Report))
    assert reports and len(reports) == 1
    _assert_default_detect_report(reports[0].report, 'bad_detect.conf')
Beispiel #3
0
def test_only_bad_checker(current_actor_context):
    bad_checker_config = MultipathConfig(pathname='bad_checker.conf',
                                         default_path_checker='rdac',
                                         default_retain_hwhandler=True)
    facts = MultipathConfFacts(configs=[bad_checker_config])

    current_actor_context.feed(facts)
    current_actor_context.run()
    reports = list(current_actor_context.consume(Report))
    assert reports and len(reports) == 1
    _assert_default_checker_report(reports[0].report, 'bad_checker.conf')
Beispiel #4
0
def get_multipath_conf_facts(config_file='/etc/multipath.conf'):
    res_configs = []
    conf = _parse_config(config_file)
    if not conf:
        return None
    res_configs.append(conf)
    if conf.config_dir:
        res_configs.extend(_parse_config_dir(conf.config_dir))
    else:
        res_configs.extend(_parse_config_dir('/etc/multipath/conf.d'))
    return MultipathConfFacts(configs=res_configs)
Beispiel #5
0
def test_config_all_good(current_actor_context):
    config = MultipathConfig(pathname='all_good.conf',
                             default_path_checker='tur',
                             reassign_maps=False,
                             default_detect_checker=True,
                             default_detect_prio=True,
                             default_retain_hwhandler=True)
    facts = MultipathConfFacts(configs=[config])

    current_actor_context.feed(facts)
    current_actor_context.run()
    assert not current_actor_context.consume(Report)
Beispiel #6
0
def test_config_all_bad(current_actor_context):
    config = MultipathConfig(pathname='all_bad.conf',
                             default_path_checker='directio',
                             reassign_maps=True,
                             default_detect_checker=False,
                             default_detect_prio=False,
                             default_retain_hwhandler=False)
    facts = MultipathConfFacts(configs=[config])

    current_actor_context.feed(facts)
    current_actor_context.run()
    reports = list(current_actor_context.consume(Report))
    assert reports and len(reports) == 3
    _assert_default_checker_report(reports[0].report, 'all_bad.conf')
    _assert_default_detect_report(reports[1].report, 'all_bad.conf')
    _assert_reassign_maps(reports[2].report, 'all_bad.conf')
Beispiel #7
0
def test_config_unimportant(current_actor_context):
    option = MultipathConfigOption(name='path_checker', value='rdac')
    config = MultipathConfig(pathname='unimportant.conf',
                             hw_str_match_exists=True,
                             ignore_new_boot_devs_exists=True,
                             new_bindings_in_boot_exists=True,
                             unpriv_sgio_exists=True,
                             detect_path_checker_exists=True,
                             overrides_hwhandler_exists=True,
                             overrides_pg_timeout_exists=True,
                             queue_if_no_path_exists=True,
                             all_devs_section_exists=True,
                             all_devs_options=[option])
    facts = MultipathConfFacts(configs=[config])

    current_actor_context.feed(facts)
    current_actor_context.run()
    assert not current_actor_context.consume(Report)
Beispiel #8
0
def test_different_files(current_actor_context):
    bad_detect_checker_config = MultipathConfig(
        pathname='bad_detect_checker.conf', default_detect_checker=False)
    bad_detect_prio_config = MultipathConfig(pathname='bad_detect_prio.conf',
                                             default_detect_prio=False)
    bad_retain_hwhandler_config = MultipathConfig(
        pathname='bad_retain_hwhandler.conf', default_retain_hwhandler=False)
    facts = MultipathConfFacts(configs=[
        bad_detect_checker_config, bad_detect_prio_config,
        bad_retain_hwhandler_config
    ])

    current_actor_context.feed(facts)
    current_actor_context.run()
    reports = list(current_actor_context.consume(Report))
    assert reports and len(reports) == 1
    _assert_default_detect_report(
        reports[0].report, 'bad_detect_checker.conf, bad_detect_prio.conf and '
        'bad_retain_hwhandler.conf')