예제 #1
0
파일: sbd.py 프로젝트: cwjenkins/pcs
def set_sbd_config_on_node(report_processor,
                           node_communicator,
                           node,
                           config,
                           watchdog,
                           device_list=None):
    """
    Send SBD configuration to 'node' with specified watchdog set. Also puts
    correct node name into SBD_OPTS option (SBD_OPTS="-n <node_name>").

    report_processor --
    node_communicator -- NodeCommunicator
    node -- NodeAddresses
    config -- dictionary in format: <SBD config option>: <value>
    watchdog -- path to watchdog device
    device_list -- list of strings
    """
    config = dict(config)
    config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node.label)
    if watchdog:
        config["SBD_WATCHDOG_DEV"] = watchdog
    if device_list:
        config["SBD_DEVICE"] = '"{0}"'.format(";".join(device_list))
    set_sbd_config(node_communicator, node, dict_to_environment_file(config))
    report_processor.process(reports.sbd_config_accepted_by_node(node.label))
예제 #2
0
    def test_success(self):
        cfg_dict = {"OPTION": "value", "ANOTHER": "option value", "ANOTHER ONE": '"complex value"'}
        expected = """# This file has been generated by pcs.
ANOTHER=option value
ANOTHER ONE="complex value"
OPTION=value
"""
        self.assertEqual(expected, tools.dict_to_environment_file(cfg_dict))
예제 #3
0
def create_sbd_config(base_config, node_label, watchdog, device_list=None):
    # TODO: figure out which name/ring has to be in SBD_OPTS
    config = dict(base_config)
    config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node_label)
    if watchdog:
        config["SBD_WATCHDOG_DEV"] = watchdog
    if device_list:
        config["SBD_DEVICE"] = '"{0}"'.format(";".join(device_list))
    return dict_to_environment_file(config)
예제 #4
0
파일: sbd.py 프로젝트: tomjelinek/pcs
def create_sbd_config(base_config, node_label, watchdog, device_list=None):
    # TODO: figure out which name/ring has to be in SBD_OPTS
    config = dict(base_config)
    config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node_label)
    if watchdog:
        config["SBD_WATCHDOG_DEV"] = watchdog
    if device_list:
        config["SBD_DEVICE"] = '"{0}"'.format(";".join(device_list))
    return dict_to_environment_file(config)
예제 #5
0
    def test_success(self):
        cfg_dict = {
            "OPTION": "value",
            "ANOTHER": "option value",
            "ANOTHER ONE": '"complex value"'
        }
        expected = """# This file has been generated by pcs.
ANOTHER=option value
ANOTHER ONE="complex value"
OPTION=value
"""
        self.assertEqual(expected, tools.dict_to_environment_file(cfg_dict))
예제 #6
0
파일: sbd.py 프로젝트: dchirikov/pcs
def set_sbd_config_on_node(report_processor, node_communicator, node, config):
    """
    Send SBD configuration to 'node'. Also puts correct node name into
        SBD_OPTS option (SBD_OPTS="-n <node_name>").

    report_processor --
    node_communicator -- NodeCommunicator
    node -- NodeAddresses
    config -- dictionary in format: <SBD config option>: <value>
    """
    config = dict(config)
    config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node.label)
    set_sbd_config(node_communicator, node, dict_to_environment_file(config))
    report_processor.process(
        reports.sbd_config_accepted_by_node(node.label)
    )
예제 #7
0
파일: sbd.py 프로젝트: idevat/pcs
def set_sbd_config_on_node(
    report_processor, node_communicator, node, config, watchdog
):
    """
    Send SBD configuration to 'node' with specified watchdog set. Also puts
    correct node name into SBD_OPTS option (SBD_OPTS="-n <node_name>").

    report_processor --
    node_communicator -- NodeCommunicator
    node -- NodeAddresses
    config -- dictionary in format: <SBD config option>: <value>
    watchdog -- path to watchdog device
    """
    config = dict(config)
    config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node.label)
    if watchdog:
        config["SBD_WATCHDOG_DEV"] = watchdog
    set_sbd_config(node_communicator, node, dict_to_environment_file(config))
    report_processor.process(
        reports.sbd_config_accepted_by_node(node.label)
    )