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 22, 2024
1 parent fb0bc42 commit 53aa939
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions virttest/env_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,25 @@ 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") or params.get("required_virtio_win_prewhql"):
if params.get("cdrom_virtio"):
cdrom_virtio = params["cdrom_virtio"]
virtio_win_range = params.get("required_virtio_win_prewhql") if re.search(
'prewhql', cdrom_virtio) and params.get("required_virtio_win")
if virtio_win_range:
LOG.info("Checking required virtio-win version: %s" % virtio_win_range)
cdrom_virtio_path = os.path.basename(utils_misc.get_path(data_dir.get_data_dir(), cdrom_virtio))
match = re.search("virtio-win-(?:prewhql-)?(\d+\.\d+(?:\.\d+)?-\d+)", cdrom_virtio_path)
if match.group(1) is None:
test.error("Can not get virtio-win version from \"cdrom_virtio\": %s" % cdrom_virtio)
cdrom_virtio_version = re.sub('-', '.', match.group(1))
if cdrom_virtio_version not in VersionInterval(virtio_win_range):
test.cancel("Got virtio-win version:%s, which is not in %s" %
(cdrom_virtio_version, virtio_win_range))
else:
LOG.warning("required_virtio_win(prewhql) 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
4 changes: 4 additions & 0 deletions virttest/shared/cfg/virtio-win.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#
# 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_prewhql = [0.1.180, 0.1.280]
# required_virtio_win = [1.9.22.3, 1.9.36.0)

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

0 comments on commit 53aa939

Please sign in to comment.