From c21b5aeac1a4127ec3c88b7204344ee728392f1c Mon Sep 17 00:00:00 2001 From: Menghuan Li Date: Sat, 1 Jul 2023 21:32:27 +0800 Subject: [PATCH] block_iscsi_format_large_size_disk: install NetFx3 feature For win10(22H2) x86_86, install the NetFx3 feature to keep the right test env. Signed-off-by: Menghuan Li menli@redhat.com --- .../block_iscsi_format_large_size_disk.py | 35 +++++++++++++++++++ .../block_iscsi_format_large_size_disk.cfg | 9 +++++ 2 files changed, 44 insertions(+) diff --git a/qemu/tests/block_iscsi_format_large_size_disk.py b/qemu/tests/block_iscsi_format_large_size_disk.py index c13607f2ce6..869289506ed 100644 --- a/qemu/tests/block_iscsi_format_large_size_disk.py +++ b/qemu/tests/block_iscsi_format_large_size_disk.py @@ -63,6 +63,27 @@ def _get_disk_serial(dev): test.error("Can not find serial of device") return out + def start_wuauserv_service(session): + """ + Start wuauserv service. + + :param session: The guest session object. + """ + wuauserv_status_cmd = params["wuauserv_status_cmd"] + status = session.cmd_status(wuauserv_status_cmd) + if status != 0: + wuauserv_service_cfg_cmd = params["wuauserv_service_cfg_cmd"] + status = session.cmd_status(wuauserv_service_cfg_cmd) + if status != 0: + test.error("Change wuauserv service config not success") + wuauserv_start_cmd = params["wuauserv_start_cmd"] + status = session.cmd_status(wuauserv_start_cmd) + if status != 0: + test.error("Fail to start wuauserv service") + if not utils_misc.wait_for(lambda: not session.cmd_status(wuauserv_status_cmd), + 60, 0, 2): + test.error("wuauserv service not running") + vm = None iscsi = None logger = test.log @@ -71,6 +92,7 @@ def _get_disk_serial(dev): clean_cmd = params["clean_cmd"] backend_image_name = params['image_name_stg1'] guest_cmd = params["guest_cmd"] + NetFx3_install_cmd = params.get("NetFx3_install_cmd") try: logger.info("Create iscsi disk.") base_dir = data_dir.get_data_dir() @@ -101,6 +123,19 @@ def _get_disk_serial(dev): os_type = params["os_type"] fstype = params.get("fstype") labeltype = params.get("labeltype", "msdos") + # workaround for win10(22h2) x86_64 to install + # Net Framework feature + if NetFx3_install_cmd: + NetFx3_install_cmd = utils_misc.set_winutils_letter( + session, + NetFx3_install_cmd) + logger.info("Start wuauserv service") + start_wuauserv_service(session) + logger.info("Install Net Framework feature") + status, output = session.cmd_status_output(NetFx3_install_cmd, + timeout=360) + if status: + test.error("Install NetFx3 feature hit error: %s" % output) guest_cmd = utils_misc.set_winutils_letter(session, guest_cmd) disk = _get_window_disk_index_by_wwn(serial) diff --git a/qemu/tests/cfg/block_iscsi_format_large_size_disk.cfg b/qemu/tests/cfg/block_iscsi_format_large_size_disk.cfg index c0eeca53765..422c8dcc1f4 100644 --- a/qemu/tests/cfg/block_iscsi_format_large_size_disk.cfg +++ b/qemu/tests/cfg/block_iscsi_format_large_size_disk.cfg @@ -2,6 +2,9 @@ virt_test_type = qemu type = block_iscsi_format_large_size_disk only Windows + clone_master = yes + master_images_clone = image1 + remove_image_image1 = yes start_vm = no data_images="stg1" images += " ${data_images}" @@ -23,6 +26,12 @@ guest_cmd = "WIN_UTILS:\coreutils\DummyCMD.exe {} ${file_size} 1" labeltype = msdos fstype = ntfs + Win10: + x86_64: + wuauserv_status_cmd = 'sc query wuauserv |findstr "RUNNING" ' + wuauserv_start_cmd = "sc start wuauserv" + wuauserv_service_cfg_cmd = 'sc config wuauserv start=auto' + NetFx3_install_cmd = 'Dism /online /enable-feature /norestart /featurename:NetFx3 /All /Source:WIN_UTILS:\sources\sxs' variants: - with_virtio: serial = large_disk