未验证 提交 f65cdf33 编写于 作者: C chunfu wen 提交者: GitHub

Merge pull request #2284 from qiankehan/scsi_delete

virttest: Delete scsi disk before scsi_debug mod unload
......@@ -2754,6 +2754,13 @@ def delete_scsi_disk():
"""
Delete scsi device by removing scsi_debug kernel module.
"""
scsi_dbg_check = process.run("lsscsi|grep scsi_debug", shell=True)
if scsi_dbg_check.exit_status == 0:
scsi_addr_pattern = '[0-9]+:[0-9]+:[0-9]+:[0-9]+'
for addr in re.findall(scsi_addr_pattern, scsi_dbg_check.stdout_text):
process.run("echo 1>/sys/class/scsi_device/{}/device/delete".format(addr),
shell=True)
if linux_modules.module_is_loaded("scsi_debug"):
linux_modules.unload_module("scsi_debug")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册