def handle_parms(self): drv_args = [] # handle drive options if self.__dae_file: for drive_obj in self._drive_list: drive_obj.handle_parms() # export options to json file drv_args.append(drive_obj.get_option()) self._drive_list = [] super(PMCSASController, self).handle_parms() drive_nums = len(self._drive_list) cntrl_nums = int(math.ceil(float(drive_nums) / self._max_drive_per_controller)) or 1 for cntrl_index in range(0, cntrl_nums): self._attributes["id"] = "scsi{}".format(self._start_idx + cntrl_index) if self.__sas_address: self._attributes["sas_address"] = self.__sas_address if self.__dae_file is not None: self._attributes["dae_file"] = self.__dae_file self.add_option("{}".format(self._build_one_controller(self._model, **self._attributes)), 0) if self.__dae_file: DiskArrayController.export_json_data(self.__dae_file, drv_args, self._controller_info)
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)
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
def __create_controller(self, controller_info): controller_obj = None model = controller_info.get("type", "ahci") if model.startswith("megasas"): controller_obj = MegaSASController(controller_info) elif model.startswith("lsi"): controller_obj = LSISASController(controller_info) elif model.startswith("pmc"): controller_obj = PMCSASController(controller_info) elif "nvme" in model: controller_obj = NVMeController(controller_info) elif "ahci" in model: controller_obj = AHCIController(controller_info, self.__is_cdrom_connected) elif "disk_array" in model: if self.__diskarray: raise ArgsNotCorrect( "[BackendStorage] Only 1 disk array object allowed") controller_obj = DiskArrayController(controller_info) self.__diskarray = controller_obj else: raise ArgsNotCorrect( "[BackendStorage] Unsupported controller type: {}".format( model)) controller_obj.logger = self.logger # set owner controller_obj.owner = self return controller_obj
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
def __process_disk_array(self): ws = self.workspace.get_workspace_data() diskarray = DiskArrayController(ws) # set sharemeory id for sub node. for node in self.__chassis.get("nodes", []): storage = node["compute"].get("storage_backend") diskarray.add_storage_chassis_backend(storage) topo = diskarray.get_topo() if topo: for node in self.__chassis.get("nodes", []): storage = node["compute"].get("storage_backend") diskarray.set_topo_file(storage, "sas_topo") self.__dataset.append("sas_topo", topo) diskarray.export_drv_data()