Esempio n. 1
0
def start_ipmi(conf_file=VM_DEFAULT_CONFIG):
    try:
        with open(conf_file, 'r') as f_yml:
            conf = yaml.load(f_yml)

        node = CNode(conf)
        if "name" in conf:
            node.set_node_name(conf["name"])
        node.init_workspace()

        bmc = CBMC(conf.get('bmc', {}))
        node_name = conf["name"] if "name" in conf else "node-0"
        bmc.set_task_name("{}-bmc".format(node_name))
        bmc.set_log_path("/var/log/infrasim/{}/openipmi.log".
                         format(node_name))
        bmc.set_type(conf["type"])
        bmc.set_workspace(node.workspace)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()
        cmd = bmc.get_commandline()
        logger.debug(cmd)
        run_command(cmd+" &", True, None, None)

        logger.info("bmc start")
    except CommandRunFailed as e:
        logger.error(e.value)
        raise e
    except ArgsNotCorrect as e:
        logger.error(e.value)
        raise e
Esempio n. 2
0
    def init(self):
        for node in self.__chassis['nodes']:
            node_obj = CNode(node)
            node_obj.set_node_name(self.__chassis['name'])
            self.__node_list.append(node_obj)

        for node_obj in self.__node_list:
            node_obj.init()
Esempio n. 3
0
def start_ipmi(conf_file=VM_DEFAULT_CONFIG):
    try:
        with open(conf_file, 'r') as f_yml:
            conf = yaml.load(f_yml)

        node = CNode(conf)
        if "name" in conf:
            node.set_node_name(conf["name"])
        node.init_workspace()

        bmc = CBMC(conf.get('bmc', {}))
        node_name = conf["name"] if "name" in conf else "node-0"
        bmc.set_task_name("{}-bmc".format(node_name))
        bmc.set_log_path("/var/log/infrasim/{}/openipmi.log".
                         format(node_name))
        bmc.set_type(conf["type"])
        bmc.set_workspace(node.workspace)
        bmc.init()
        bmc.write_bmc_config()
        bmc.precheck()
        cmd = bmc.get_commandline()
        logger.debug(cmd)
        run_command(cmd+" &", True, None, None)

        logger.info("bmc start")
    except CommandRunFailed as e:
        logger.error(e.value)
        raise e
    except ArgsNotCorrect as e:
        logger.error(e.value)
        raise e
Esempio n. 4
0
 def init(self, *args):
     for node in self.__chassis['nodes']:
         node_obj = CNode(node)
         node_obj.set_node_name(node["name"])
         self.__node_list[node["name"]] = node_obj
     self.process_by_node_names("init", *args)