Skip to content

Commit

Permalink
fixing multipath flush problem in module_load_unload.py and config file
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Naresh-ibm committed Feb 15, 2024
1 parent 885dfc9 commit 9daf848
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion io/driver/module_unload_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -98,6 +98,7 @@ def module_load_unload(self, module_list):
for mod in sub_mod.split(' '):
if mod == 'multipath':
if self.flush_mpath(mdl) is False:
self.error("failed to flush the multipath")
self.error_modules.append(mdl)
break
else:
Expand All @@ -106,18 +107,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):
"""
Expand Down
1 change: 1 addition & 0 deletions io/driver/module_unload_load.py.data/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ qla2xxx=multipath
lpfc=multipath
ibmvfc=multipath
nvme_fc=lpfc multipath
nvme=multipath

0 comments on commit 9daf848

Please sign in to comment.