Skip to content

Commit

Permalink
virtio_win_installer: update the installer script
Browse files Browse the repository at this point in the history
Since virtio-win 1.9.41 version, there is no restart
requirement when install and uninstall the installer.
while repair still has.

Signed-off-by: Xiaoling Gao <[email protected]>
  • Loading branch information
xiagao committed Aug 28, 2024
1 parent 9a15537 commit eb1c43b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions provider/win_driver_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ def run_installer(vm, session, test, params, run_installer_cmd):
"""
Install/uninstall/repair virtio-win drivers and qxl,spice and
qemu-ga-win by installer.
If installer(virtio-win) version is bigger than 1.9.37,
then installer itself will restart vm,
otherwise it's needed to reboot vm to make sure all are
installed successfully.
If installer(virtio-win) version is in [1.9.37, 1.9.41]
then installer itself will restart vm for installation and
uninstallation function; otherwise there is no need to reboot guest.
While for repair function, installer itself always restart vm by
itself;
:param vm: vm object.
:param session: The guest session object.
Expand All @@ -196,7 +197,7 @@ def run_installer(vm, session, test, params, run_installer_cmd):
"""
cdrom_virtio = params["cdrom_virtio"]
installer_restart_version = params.get("installer_restart_version",
"[1.9.37.0,)")
"[1.9.37.0, 1.9.40.0]")
cdrom_virtio_path = os.path.basename(utils_misc.get_path(
data_dir.get_data_dir(), cdrom_virtio))
match = re.search(r"virtio-win-(\d+\.\d+(?:\.\d+)?-\d+)",
Expand All @@ -211,14 +212,18 @@ def run_installer(vm, session, test, params, run_installer_cmd):
params, session), 240, 2, 2):
test.fail("Autoit exe stop there for 240s,"
" please have a check.")

if cdrom_virtio_version in VersionInterval(installer_restart_version):
restart_con_ver = cdrom_virtio_version in VersionInterval(
installer_restart_version)
restart_con_repair = "repair" in run_installer_cmd
if restart_con_ver or restart_con_repair:
# Wait for vm re-start by installer itself
if not utils_misc.wait_for(lambda: not session.is_responsive(),
120, 5, 5):
test.fail("The previous session still exists,"
"seems that the vm doesn't restart.")
session = vm.wait_for_login(timeout=360)
else:
# for the early virtio-win instller, rebooting is needed.
if cdrom_virtio_version in VersionInterval("(,1.9.37.0)"):
session = vm.reboot(session)
return session

Expand Down
2 changes: 1 addition & 1 deletion qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
run_uninstall_cmd = 'WIN_UTILS:\AutoIt3_%PROCESSOR_ARCHITECTURE%.exe C:\uninstall.au3'
signed_check_cmd = 'wmic product where name="Virtio-win-driver-installer" | findstr "Red Hat, Inc."'
# set virtio_win version range to determine the diff behavior of installer
installer_restart_version = [1.9.37.0,)
installer_restart_version = [1.9.37.0, 1.9.40.0]
monitor_type = qmp
monitors = qmp1
mem_stat_check_list = 'stat-free-memory'
Expand Down

0 comments on commit eb1c43b

Please sign in to comment.