Skip to content

Commit

Permalink
Support to specify virtio-win's version range
Browse files Browse the repository at this point in the history
Add a checkpoint here to check the virtio-win version,
if the version is in the specified range, test will
continue, if not, cancel the test.

Signed-off-by: Leidong Wang <[email protected]>
  • Loading branch information
leidwang committed Jan 16, 2024
1 parent fb0bc42 commit 0b2da7f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions virttest/env_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,27 @@ def preprocess(test, params, env):
version_info["vm_bootloader_version"] = str(vm_bootloader_ver)
LOG.debug("vm bootloader version: %s", vm_bootloader_ver)

# Checking required virtio-win version, if not satisfied, cancel test
if params.get("required_virtio_win"):
if params.get("cdrom_virtio"):
required_virtio_win = params["required_virtio_win"]
LOG.info("Checking required virtio-win version: %s" % required_virtio_win)
cdrom_virtio = params["cdrom_virtio"]
cdrom_virtio_path = os.path.join(data_dir.get_data_dir(), cdrom_virtio)
cdrom_virtio_path = os.path.realpath(cdrom_virtio_path)
if re.search('prewhql', cdrom_virtio_path):
match = re.search("\d+.\d+-\d+", cdrom_virtio_path)
else:
match = re.search("\d+.\d+\d+-\d+", cdrom_virtio_path)
if match is None:
test.error("Can not get virtio-win version from \"cdrom_virtio\": %s" % cdrom_virtio)
cdrom_virtio_version = re.sub('-', '.', match.group(0))
if cdrom_virtio_version not in VersionInterval(required_virtio_win):
test.cancel("Got virtio-win version:%s, which is not in %s" %
(cdrom_virtio_version, required_virtio_win))
else:
LOG.warning("required_virtio_win can not take effect without cdrom_virtio")

# Get the Libvirt version
if vm_type == "libvirt":
libvirt_ver_cmd = params.get("libvirt_ver_cmd", "libvirtd -V|awk -F' ' '{print $3}'")
Expand Down
3 changes: 3 additions & 0 deletions virttest/shared/cfg/virtio-win.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#
# So you have to map the paths of your cd containing the drivers on the config
# variables. More details below.
#
# The parameter required_virtio_win is used to specify a range of virtio-win iso.
# required_virtio_win = [0.1.180, 0.1.280]

unattended_install.cdrom, whql.support_vm_install:
Windows..virtio_blk, Windows..virtio_scsi, Windows..virtio_net:
Expand Down

0 comments on commit 0b2da7f

Please sign in to comment.