Skip to content

Commit

Permalink
Merge pull request #3776 from SiboWang1997/update_indirect_image_blac…
Browse files Browse the repository at this point in the history
…klist

Update the indirect_image_blacklist dynamically
  • Loading branch information
YongxueHong authored Aug 21, 2023
2 parents 4e6a747 + 558cf3c commit af9b31d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qemu/tests/cfg/multi_disk.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
force_create_image = no
pre_command = "modprobe -r scsi_debug; modprobe sg; modprobe scsi_debug add_host=9 dev_size_mb=50"
post_command = "rmmod scsi_debug"
disk_check_cmd = "ls -1d /dev/nvme* || ls -1d /dev/sda*"
image_stg_blacklist = "/dev/sda[\d]* /dev/sg0"
stg_params += "image_raw_device:yes "
stg_params += "image_format:raw "
stg_params += "indirect_image_select:range(-9,0) "
Expand Down
13 changes: 13 additions & 0 deletions qemu/tests/multi_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import string

from avocado.utils import astring
from avocado.utils import process

from virttest import env_process
from virttest import error_context
Expand Down Expand Up @@ -249,6 +250,18 @@ def _get_data_disks():
astring.tabular_output(param_table, param_table_header))
return

disk_check_cmd = params.get('disk_check_cmd')
indirect_image_blacklist = params.get('indirect_image_blacklist').split()

if disk_check_cmd:
image_stg_blacklist = params.get('image_stg_blacklist').split()
matching_images = process.run(disk_check_cmd, ignore_status=True,
shell=True).stdout_text
for disk in image_stg_blacklist:
if not re.search(disk, matching_images):
indirect_image_blacklist.remove(disk)
params["indirect_image_blacklist"] = " ".join(indirect_image_blacklist)

# Always recreate VMs and disks
error_context.context("Start the guest with new disks", test.log.info)
for vm_name in params.objects("vms"):
Expand Down

0 comments on commit af9b31d

Please sign in to comment.