def stop_qemu(conf_file=config.infrasim_default_config): try: with open(conf_file, 'r') as f_yml: conf = yaml.load(f_yml) compute = CCompute(conf["compute"]) node_name = conf["name"] if "name" in conf else "node-0" # Set attributes compute.set_task_name("{}-node".format(node_name)) compute.set_log_path("/var/log/infrasim/{}/qemu.log". format(node_name)) compute.set_workspace("{}/.infrasim/{}". format(os.environ["HOME"], node_name)) compute.set_type(conf["type"]) # Set interface if "type" not in conf: raise ArgsNotCorrect("Can't get infrasim type") else: compute.set_type(conf['type']) if "serial_socket" in conf: compute.set_socket_serial(conf["serial_socket"]) if "bmc_connection_port" in conf: compute.set_port_qemu_ipmi(conf["bmc_connection_port"]) compute.init() compute.terminate() logger.info("qemu stopped") except Exception, e: logger.error(e.value) raise e
def stop_qemu(conf_file=VM_DEFAULT_CONFIG): try: with open(conf_file, 'r') as f_yml: conf = yaml.load(f_yml) compute = CCompute(conf["compute"]) node_name = conf["name"] if "name" in conf else "node-0" # Set attributes compute.set_task_name("{}-node".format(node_name)) compute.set_log_path("/var/log/infrasim/{}/qemu.log". format(node_name)) compute.set_workspace("{}/.infrasim/{}". format(os.environ["HOME"], node_name)) compute.set_type(conf["type"]) # Set interface if "type" not in conf: raise ArgsNotCorrect("Can't get infrasim type") else: compute.set_type(conf['type']) if "serial_port" in conf: compute.set_port_serial(conf["serial_port"]) if "bmc_connection_port" in conf: compute.set_port_qemu_ipmi(conf["bmc_connection_port"]) compute.init() compute.terminate() logger.info("qemu stopped") except Exception, e: logger.error(e.value) raise e