def _luns_mapped(*, args: str) -> CheckEntry: """ Check if Storage LUNs are properly mapped :param args: luns_mapped check specific parameters and arguments :return: """ res: CheckEntry = CheckEntry(cfg.Checks.LUNS_MAPPED.value) if cortx_py_utils_import_error: res.set_fail(checked_target=cfg.ALL_MINIONS, comment="Package cortx-py-utils not installed") return res try: nodes = Check._get_nodes_list() lun_args = [cfg.LUNS_MAPPED_CHECK] + nodes StorageV().validate('luns', lun_args) except Exception as exc: res.set_fail(checked_target=cfg.ALL_MINIONS, comment=str(exc)) else: res.set_passed(checked_target=cfg.ALL_MINIONS, comment="LUNs Mapped " f"Validated: {lun_args}") return res
def _storage_lvms(*, args: str) -> CheckEntry: """Storage lvms check.""" res: CheckEntry = CheckEntry(cfg.Checks.STORAGE_LVMS.value) if cortx_py_utils_import_error: res.set_fail(checked_target=cfg.ALL_MINIONS, comment="Package cortx-py-utils not installed") return res try: nodes = Check._get_pillar_data("cluster/node_list") StorageV().validate('lvms', nodes) except Exception as exc: res.set_fail(checked_target=cfg.ALL_MINIONS, comment=str(exc)) else: res.set_passed(checked_target=cfg.ALL_MINIONS) return res
def _storage_luns(*, args: str) -> Union[CheckEntry, List[CheckEntry]]: """ Check if Storage LUNs are proper :param args: storage_luns check specific parameters and arguments :return: """ check_value: CheckEntry = CheckEntry(cfg.Checks.STORAGE_LUNS.value) if cortx_py_utils_import_error: check_value.set_fail( checked_target=cfg.ALL_MINIONS, comment="Package cortx-py-utils not installed") return check_value try: nodes = Check._get_nodes_list() except Exception as exc: check_value.set_fail(checked_target=cfg.ALL_MINIONS, comment=str(exc)) return check_value res: List[CheckEntry] = list() for luns_check in cfg.LUNS_CHECKS: check_res: CheckEntry = CheckEntry(cfg.Checks.STORAGE_LUNS.value) try: lun_args = [luns_check] + nodes StorageV().validate('luns', lun_args) except Exception as exc: check_res.set_fail(checked_target=cfg.ALL_MINIONS, comment=str(exc)) else: check_res.set_passed(checked_target=cfg.ALL_MINIONS, comment="LUNs Accessibility, " "and Volume Size " f"Validated: {lun_args}") res.append(check_res) return res
def _storage_hba(*, args: str) -> Union[CheckEntry, List[CheckEntry]]: """ Check if Storage HBA is proper :param args: storage_hba check specific parameters and arguments :return: """ check_value: CheckEntry = CheckEntry(cfg.Checks.STORAGE_HBA.value) if cortx_py_utils_import_error: check_value.set_fail( checked_target=cfg.ALL_MINIONS, comment="Package cortx-py-utils not installed") return check_value try: nodes = Check._get_nodes_list() except Exception as exc: check_value.set_fail(checked_target=cfg.ALL_MINIONS, comment=str(exc)) return check_value res: List[CheckEntry] = list() for provider in cfg.HBA_PROVIDER: check_res: CheckEntry = CheckEntry(cfg.Checks.STORAGE_HBA.value) try: hba_args = [provider] + nodes StorageV().validate('hba', hba_args) except Exception as exc: check_res.set_fail(checked_target=cfg.ALL_MINIONS, comment=str(exc)) else: check_res.set_passed(checked_target=cfg.ALL_MINIONS, comment="HBA Presence and " f"Ports Validated: {hba_args}") res.append(check_res) return res
def test_luns_wrong_hosts(self): """Check LUNs mapping.""" self.assertRaises(VError, StorageV().validate, 'luns', ["mapped", 'srvnode-1'])
def test_lvm_error(self): """Check LVM not present.""" self.assertRaises(VError, StorageV().validate, 'lvms', ["srvnode-1", "srvnode-2"])
def test_luns_size(self): """Check LUNs Size.""" StorageV().validate('luns', ["size", 'srvnode-1'])
def test_luns_size_error(self): """Check LUNs Ports.""" dummy_hosts = ['srv-1', 'srv-2'] self.assertRaises(VError, StorageV().validate, 'luns', ["size", dummy_hosts])
def test_luns_accessible_error(self): """Check LUNs accessible.""" dummy_hosts = ['srv-1', 'srv-2'] self.assertRaises(VError, StorageV().validate, 'luns', ["accessible", dummy_hosts])
def test_luns_accessible(self): """Check LUNs Accessible.""" StorageV().validate('luns', ["accessible", 'srvnode-1'])
def test_hba_not_present(self): """Check HBA not present.""" dummy_hosts = ['srv-1', 'srv-2'] self.assertRaises(VError, StorageV().validate, 'hba', ["lsi", dummy_hosts])
def test_hba_provider(self): """Check HBA present.""" self.assertRaises(VError, StorageV().validate, 'hba', ["abcd", 'srvnode-1'])
def test_hba_present(self): """Check HBA present.""" StorageV().validate('hba', ["lsi", 'srvnode-1'])