From 1f8ac43af3e7827b4070a86f38a9dd2333c2c593 Mon Sep 17 00:00:00 2001 From: Naresh Bannoth Date: Wed, 14 Feb 2024 16:18:56 +0530 Subject: [PATCH] fixing multipath flush problem in module_load_unload.py and config file multipath flush was failing due to string not matching exactly as below, nvme 55964 4 nvme_core 183368 5 nvme we were expecting only : "nvme 55964 4" the first line only. But it is matching all the line that contain the module name. -w option resolve this as below. nvme 55964 4 multipath is added in config file for nvme module. Signed-off-by: Naresh Bannoth --- io/driver/module_unload_load.py | 10 +++++++++- io/driver/module_unload_load.py.data/config | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/io/driver/module_unload_load.py b/io/driver/module_unload_load.py index d8a50fe57..8f37664f9 100755 --- a/io/driver/module_unload_load.py +++ b/io/driver/module_unload_load.py @@ -73,7 +73,7 @@ def flush_mpath(self, mdl): """ flush the multipath """ - cmd = "lsmod | grep -i ^%s" % mdl + cmd = "lsmod | grep -iw ^%s" % mdl for i in range(20): if process.getoutput(cmd).split(" ")[-1] == '0': return True @@ -106,18 +106,26 @@ def module_load_unload(self, module_list): if linux_modules.module_is_loaded(mod) is True: self.error_modules.append(mod) break + self.log.info("error_module list before unloading: %s, iteration : %s" % (self.error_modules, _)) self.log.info("unloading module %s " % mdl) linux_modules.unload_module(mdl) time.sleep(self.load_unload_sleep_time) if linux_modules.module_is_loaded(mdl) is True: + self.log.info("failed to unload the module, iteration : %s" % _) self.error_modules.append(mdl) break + else: + self.log.info("successfully unload: iteration : %s" % _) self.log.info("loading module : %s " % mdl) + self.log.info("error_module list before loading: %s,iteration : %s" % (self.error_modules, _)) linux_modules.load_module(mdl) time.sleep(self.load_unload_sleep_time) if linux_modules.module_is_loaded(mdl) is False: + self.log.info("failed to load the module, iteration : %s" % _) self.error_modules.append(mdl) break + else: + self.log.info("successfully load: iteration : %s" % _) def test(self): """ diff --git a/io/driver/module_unload_load.py.data/config b/io/driver/module_unload_load.py.data/config index 74cc20f01..bf0282854 100644 --- a/io/driver/module_unload_load.py.data/config +++ b/io/driver/module_unload_load.py.data/config @@ -5,3 +5,4 @@ qla2xxx=multipath lpfc=multipath ibmvfc=multipath nvme_fc=lpfc multipath +nvme=multipath