def start_chassis(): """ """ global conf global ssh1 global ssh2 global chassis conf = fixtures.ChassisConfig().get_chassis_info() conf["data"]["pn"] = "What_ever_SN" conf["data"]["sn"] = "What_ever_SN" conf["data"]["psu1_pn"] = "A380-B737-C909" node0_log = "/tmp/qemu_node0.log" node1_log = "/tmp/qemu_node1.log" compute_0 = conf["nodes"][0]["compute"] compute_0["storage_backend"][0]["drives"][0][ "file"] = fixtures.a_boot_image compute_0["extra_option"] = "-D {} -trace events=/tmp/trace_items".format( node0_log) compute_0["ntb"] = [{ "addr": 'a.0', "bus": "pcie.0", "bar1_exp": 15, "bar2_exp": 15, "id": "ntb0", "peer_id": "ntb1" }] compute_1 = conf["nodes"][1]["compute"] compute_1["storage_backend"][0]["drives"][0][ "file"] = fixtures.b_boot_image compute_1["extra_option"] = "-D {} -trace events=/tmp/trace_items".format( node1_log) compute_1["ntb"] = [{ "addr": 'a.0', "bus": "pcie.0", "bar1_exp": 15, "bar2_exp": 15, "id": "ntb1", "peer_id": "ntb0" }] if os.path.exists(node0_log): os.remove(node0_log) if os.path.exists(node1_log): os.remove(node1_log) chassis = model.CChassis(conf["name"], conf) chassis.precheck() chassis.init() data_file_dir = os.path.join( ChassisWorkspace(conf).get_workspace_data(), "oem_data.json") with open(data_file_dir, "w") as f: json.dump(data_file, f) chassis.start() ssh1 = helper.prepare_ssh(nodes_ip[0], 8022) ssh2 = helper.prepare_ssh(nodes_ip[1], 8022)
def stop(self, chassis_name=None): try: if ChassisWorkspace.check_workspace_exists(chassis_name): chassis_info = ChassisWorkspace.get_chassis_info_in_workspace(chassis_name) else: chassis_info = cm.get_item_info(chassis_name) chassis = model.CChassis(chassis_name, chassis_info) chassis.init() except InfraSimError, e: print e.value logger_cmd.error("cmd res: {}".format(e.value)) return
def start_chassis(): """ """ global conf global ssh global chassis conf = fixtures.ChassisConfig().get_chassis_info() conf["data"]["pn"] = "What_ever_SN" conf["data"]["sn"] = "What_ever_SN" conf["data"]["psu1_pn"] = "A380-B737-C909" node0_log = "/tmp/qemu_node0.log" node1_log = "/tmp/qemu_node1.log" compute_0 = conf["nodes"][0]["compute"] compute_0["storage_backend"][0]["drives"][0][ "file"] = fixtures.a_boot_image compute_0["extra_option"] = "-D {} -trace events=/tmp/trace_items".format( node0_log) compute_1 = conf["nodes"][1]["compute"] compute_1["storage_backend"][0]["drives"][0][ "file"] = fixtures.b_boot_image compute_1["extra_option"] = "-D {} -trace events=/tmp/trace_items".format( node1_log) if os.path.exists(node0_log): os.remove(node0_log) if os.path.exists(node1_log): os.remove(node1_log) chassis = model.CChassis(conf["name"], conf) chassis.precheck() chassis.init() data_file_dir = os.path.join( ChassisWorkspace(conf).get_workspace_data(), "oem_data.json") with open(data_file_dir, "w") as f: json.dump(data_file, f) chassis.start() ssh = helper.prepare_ssh("192.168.188.92", 8022)
def start(self, chassis_name=None): try: if ChassisWorkspace.check_workspace_exists(chassis_name): chassis_info = ChassisWorkspace.get_chassis_info_in_workspace( chassis_name) else: chassis_info = cm.get_item_info(chassis_name) chassis = model.CChassis(chassis_name, chassis_info) chassis.precheck() chassis.init() except InfraSimError as e: print e.value logger_cmd.error("cmd res: {}".format(e.value)) return chassis.start() # get IP address print "Chassis service for {} started".format(chassis_name) logger_cmd.info( "cmd res: start node {} chassis OK".format(chassis_name))
def destroy(self, chassis_name=None): if Workspace.check_workspace_exists(chassis_name): try: chassis_info = ChassisWorkspace.get_chassis_info_in_workspace( chassis_name) except InfraSimError as e: print e.value logger_cmd.error("cmd res: {}".format(e.value)) return else: print "Chassis {} runtime workspace is not found, destroy action is not applied.".\ format(chassis_name) logger_cmd.warning( "cmd res: Chassis {} runtime workspace is not found, " "destroy action is not applied.".format(chassis_name)) return chassis = model.CChassis(chassis_name, chassis_info) try: chassis.init() chassis.destroy() except InfraSimError as e: print e.value logger_cmd.error("cmd res: {}".format(e.value)) logger_cmd.info("cmd res: destroy chassis {} OK".format(chassis_name))
def start_chassis(): """ """ global conf global ssh conf = fixtures.ChassisConfig().get_chassis_info() conf["data"]["pn"] = "What_ever_SN" conf["data"]["sn"] = "What_ever_SN" conf["data"]["psu1_pn"] = "A380-B737-C909" node0_log = "/tmp/qemu_node0.log" node1_log = "/tmp/qemu_node1.log" compute_0 = conf["nodes"][0]["compute"] compute_0["storage_backend"][0]["drives"][0]["file"] = a_boot_image compute_0["extra_option"] = "-D {} -trace events=/tmp/trace_items".format( node0_log) compute_1 = conf["nodes"][1]["compute"] compute_1["storage_backend"][0]["drives"][0]["file"] = b_boot_image compute_1["extra_option"] = "-D {} -trace events=/tmp/trace_items".format( node1_log) if os.path.exists(node0_log): os.remove(node0_log) if os.path.exists(node1_log): os.remove(node1_log) global chassis chassis = model.CChassis(conf["name"], conf) chassis.precheck() chassis.init() chassis.start() ssh = helper.prepare_ssh("192.168.188.92", 8022)
@args("chassis_name", nargs='?', help="Chassis name") def destroy(self, chassis_name=None): if Workspace.check_workspace_exists(chassis_name): try: chassis_info = ChassisWorkspace.get_chassis_info_in_workspace(chassis_name) except InfraSimError, e: print e.value logger_cmd.error("cmd res: {}".format(e.value)) return else: print "Chassis {} runtime workspace is not found, destroy action is not applied.".\ format(chassis_name) logger_cmd.warning("cmd res: Chassis {} runtime workspace is not found, " "destroy action is not applied.".format(chassis_name)) return chassis = model.CChassis(chassis_name, chassis_info) try: chassis.init() chassis.destroy() except InfraSimError, e: print e.value logger_cmd.error("cmd res: {}".format(e.value)) logger_cmd.info("cmd res: destroy chassis {} OK".format(chassis_name)) class InfrasimCommands(object): def status(self): monitor = InfrasimMonitor() monitor.init() monitor.print_global_status()