示例#1
0
文件: quorum.py 项目: tomjelinek/pcs
def set_options(lib_env, options, skip_offline_nodes=False, force=False):
    """
    Set corosync quorum options, distribute and reload corosync.conf if live

    LibraryEnvironment lib_env
    dict options -- quorum options
    bool skip_offline_nodes -- continue even if not all nodes are accessible
    bool force -- force changes
    """
    cfg = lib_env.get_corosync_conf()
    lib_env.report_processor.process_list(
        corosync_conf_validators.update_quorum_options(
            options,
            cfg.has_quorum_device(),
            cfg.get_quorum_options()
        )
    )
    cfg.set_quorum_options(options)
    if lib_env.is_corosync_conf_live:
        _check_if_atb_can_be_disabled(
            lib_env.cmd_runner(),
            lib_env.report_processor,
            cfg,
            cfg.is_enabled_auto_tie_breaker(),
            force
        )
    lib_env.push_corosync_conf(cfg, skip_offline_nodes)
示例#2
0
文件: quorum.py 项目: kmalyjur/pcs
def set_options(
    lib_env: LibraryEnvironment,
    options,
    skip_offline_nodes=False,
    force=False,
):
    """
    Set corosync quorum options, distribute and reload corosync.conf if live

    LibraryEnvironment lib_env
    dict options -- quorum options
    bool skip_offline_nodes -- continue even if not all nodes are accessible
    bool force -- force changes
    """
    cfg = lib_env.get_corosync_conf()
    if lib_env.report_processor.report_list(
            corosync_conf_validators.update_quorum_options(
                options, cfg.has_quorum_device(),
                cfg.get_quorum_options())).has_errors:
        raise LibraryError()
    cfg.set_quorum_options(options)
    if lib_env.is_corosync_conf_live:
        _check_if_atb_can_be_disabled(
            lib_env.service_manager,
            lib_env.report_processor,
            cfg,
            cfg.is_enabled_auto_tie_breaker(),
            force,
        )
    lib_env.push_corosync_conf(cfg, skip_offline_nodes)