コード例 #1
0
ファイル: backend.py プロジェクト: InfraSIM/infrasim-compute
    def handle_parms(self):
        # store chassis slot map to controller
        chassis_slot = CChassisSlot(self.__backend_storage_info,
                                    helper.get_ws_folder(self))

        for controller_obj in self.__controller_list:
            controller_obj.handle_parms()
            if isinstance(controller_obj, NVMeController):
                chassis_slot.add_slot_map(controller_obj.chassis_slot, controller_obj.dev_attrs)
        chassis_slot.handle_parms()

        for controller_obj in self.__controller_list:
            self.add_option(controller_obj.get_option())
コード例 #2
0
 def __init_diskarray(self):
     ws = os.path.join(helper.get_ws_folder(self), "data")
     diskarray = DiskArrayController(ws)
     diskarray.add_storage_backend(self.__backend_storage_info)
     dae_topo = diskarray.get_topo()
     if dae_topo is not None:
         filename = os.path.join(ws, "sas_topo.bin")
         with open(filename, "w") as f:
             f.write(dae_topo)
         diskarray.set_topo_file(self.__backend_storage_info, filename)
         diskarray.export_drv_data()
     diskarray.merge_drv_data(self.__backend_storage_info)
     self.__backend_storage_info = filter(lambda x: x["type"] != "disk_array", self.__backend_storage_info)
コード例 #3
0
    def handle_parms(self):
        # store chassis slot map to controller
        chassis_slot = CChassisSlot(self.__backend_storage_info,
                                    helper.get_ws_folder(self))

        for controller_obj in self.__controller_list:
            controller_obj.handle_parms()
            if isinstance(controller_obj, NVMeController):
                chassis_slot.add_slot_map(controller_obj.chassis_slot, controller_obj.dev_attrs)
        chassis_slot.handle_parms()

        for controller_obj in self.__controller_list:
            self.add_option(controller_obj.get_option())
コード例 #4
0
ファイル: backend.py プロジェクト: InfraSIM/infrasim-compute
    def __init_diskarray(self):
        ws = os.path.join(helper.get_ws_folder(self), "data")
        diskarray = DiskArrayController(ws)
        diskarray.add_storage_backend(self.__backend_storage_info)
        dae_topo = diskarray.get_topo()
        if dae_topo is not None:
            filename = os.path.join(ws, "sas_topo.bin")
            with open(filename, "w") as f:
                f.write(dae_topo)
            diskarray.set_topo_file(self.__backend_storage_info, filename)
            diskarray.export_drv_data()

        diskarray.merge_drv_data(self.__backend_storage_info)
        self.__backend_storage_info = filter(lambda x: x["type"] != "disk_array", self.__backend_storage_info)
コード例 #5
0
ファイル: storage.py プロジェクト: InfraSIM/infrasim-compute
    def _handle_diskarray(self):
        sas_topo = self._controller_info.get("sas_topo")
        if sas_topo:
            drv_args = []
            for drive_obj in self._drive_list:
                drive_obj.handle_parms()
                # export drv args to txt file
                drv_args.append(drive_obj.get_option())

            self._drive_list = []
            drv_args_file = os.path.join(helper.get_ws_folder(self), "data",
                                         "drv_args_{}.txt".format(self.controller_index))
            DiskArrayController.export_drv_args(drv_args_file, drv_args)
            self._attributes["drv_args"] = drv_args_file
            self._attributes["sas_topo"] = sas_topo
コード例 #6
0
    def _handle_diskarray(self):
        sas_topo = self._controller_info.get("sas_topo")
        if sas_topo:
            drv_args = []
            for drive_obj in self._drive_list:
                drive_obj.handle_parms()
                # export drv args to txt file
                drv_args.append(drive_obj.get_option())

            self._drive_list = []
            drv_args_file = os.path.join(
                helper.get_ws_folder(self), "data",
                "drv_args_{}.txt".format(self.controller_index))
            DiskArrayController.export_drv_args(drv_args_file, drv_args)
            self._attributes["drv_args"] = drv_args_file
            self._attributes["sas_topo"] = sas_topo
コード例 #7
0
    def init(self):
        super(LSISASController, self).init()

        self._iothread_id = self._controller_info.get("iothread")
        self.__use_msix = self._controller_info.get('use_msix')
        self.__sas_address = self._controller_info.get('sas_address')

        self._start_idx = self.controller_index
        idx = 0
        for drive_info in self._controller_info.get("drives", []):
            sd_obj = SCSIDrive(drive_info)
            sd_obj.logger = self.logger
            sd_obj.index = idx
            sd_obj.owner = self
            sd_obj.set_bus(self.controller_index +
                           idx / self._max_drive_per_controller)
            sd_obj.set_scsi_id(idx % self._max_drive_per_controller)
            self._drive_list.append(sd_obj)
            idx += 1

        for ses_info in self._controller_info.get("seses", []):
            ses_obj = SESDevice(ses_info)
            ses_obj.set_bus(self.controller_index +
                            idx / self._max_drive_per_controller)
            self._ses_list.append(ses_obj)

        for drive_obj in self._drive_list:
            drive_obj.init()

        for ses_obj in self._ses_list:
            ses_obj.init()

        # prepare dae file if disk array connected.
        if self._controller_info.get("hba_ports"):
            ws = helper.get_ws_folder(self)
            self.__dae_file = os.path.join(
                ws, "data", "diskarray{}.json".format(self.controller_index))

        # Update controller index, tell CBackendStorage what the controller index
        # should be for the next
        self.controller_index += (idx / self._max_drive_per_controller)