Skip to content

Commit

Permalink
Add wait in create_scsi_disk method
Browse files Browse the repository at this point in the history
In some extreme situation, loading scsi_debug module may not be returned smoothly,
and it leads to failure in finding scsi device

Signed-off-by: chunfuwen <[email protected]>
  • Loading branch information
chunfuwen committed Aug 4, 2023
1 parent fb39a11 commit c30d331
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions virttest/utils_test/libvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2876,8 +2876,9 @@ def create_scsi_disk(scsi_option, scsi_size="2048"):
# Unload it first if it's already loaded.
if linux_modules.module_is_loaded("scsi_debug"):
linux_modules.unload_module("scsi_debug")
linux_modules.load_module("scsi_debug dev_size_mb=%s %s" %
(scsi_size, scsi_option))
utils_misc.wait_for(lambda: linux_modules.load_module("scsi_debug dev_size_mb=%s %s" %
(scsi_size, scsi_option)),
timeout=10, ignore_errors=True)
# Get the scsi device name
result = process.run("lsscsi|grep scsi_debug|awk '{print $6}'",
shell=True)
Expand Down

0 comments on commit c30d331

Please sign in to comment.