diff --git a/v2v/tests/cfg/function_test_esx.cfg b/v2v/tests/cfg/function_test_esx.cfg index 27589048f7..887b890d56 100644 --- a/v2v/tests/cfg/function_test_esx.cfg +++ b/v2v/tests/cfg/function_test_esx.cfg @@ -219,6 +219,24 @@ main_vm = VM_NAME_WIN2019_EFI_V2V_EXAMPLE os_version = "win2019" boottype = 3 + - multiple_online_disks: + only esx_80 + checkpoint = 'check_online_disks' + variants: + - win2022: + os_version = "win2022" + main_vm = VM_NAME_WIN2022_ONLINE_DISKS_V2V_EXAMPLE + - win2025: + os_version = "win2025" + main_vm = VM_NAME_WIN2025_ONLINE_DISKS_V2V_EXAMPLE + boottype = 3 + - win11: + os_version = "win11" + main_vm = VM_NAME_WIN11_ONLINE_DISKS_V2V_EXAMPLE + - win2019: + main_vm = VM_NAME_WIN2019_ONLINE_DISKS_V2V_EXAMPLE + os_version = "win2019" + boottype = 3 - rhsrvany_md5: only esx_70 checkpoint = 'rhsrvany_checksum' @@ -286,9 +304,6 @@ - local_storage: only esx_70 main_vm = "VM_NAME_ESX_LOCALSTORAGE_V2V_EXAMPLE" - - multiple_disks: - only esx_70 - main_vm = 'VM_NAME_ESX_MULDISKS_V2V_EXAMPLE' - multiple_cpus: only esx_70 main_vm = 'VM_NAME_ESX_MULCPUS_V2V_EXAMPLE' diff --git a/v2v/tests/src/function_test_esx.py b/v2v/tests/src/function_test_esx.py index 8ecaa71955..f0f386981e 100644 --- a/v2v/tests/src/function_test_esx.py +++ b/v2v/tests/src/function_test_esx.py @@ -4,6 +4,7 @@ import uuid import shutil import tempfile +import time import xml.etree.ElementTree as ET from virttest import data_dir @@ -522,6 +523,40 @@ def verify_certificate(certs_src_dir, certs_dest_dir, vcenter_fdqn, vcenter_ip): with open('/etc/hosts', "w") as f: f.write('%s %s' % (vcenter_ip, vcenter_fdqn)) + def check_online_disks(vmcheck): + """ + Check if status of disks are online in VM + + :param vmcheck: VMCheck object for vm checking + """ + def _get_disk_status(cmd): + + for i in range(9): + _, res = vmcheck.run_cmd(cmd) + if re.search('Offline', res): + time.sleep(100) + else: + return res + return res + + cmd = r'cmd /c echo list disk^> "%temp%\answer.tmp" ^& (diskpart ^< "%temp%\answer.tmp") ^& ' \ + r'del "%temp%\answer.tmp"' + try: + res = utils_misc.wait_for(lambda: _get_disk_status(cmd), 900) + except (ShellProcessTerminatedError, ShellStatusError): + # Windows guest may reboot after installing qemu-ga service + LOG.debug('Windows guest is rebooting') + if vmcheck.session: + vmcheck.session.close() + vmcheck.session = None + # VM boots up is extremely slow when all testing in running on + # rhv server simultaneously, so set timeout to 1200. + vmcheck.create_session(timeout=1200) + res = utils_misc.wait_for(lambda: _get_disk_status(cmd), 900) + LOG.info('disk status is %s', res) + if re.search('Offline', res): + test.fail("there is offline additional disk") + def check_result(result, status_error): """ Check virt-v2v command result @@ -603,6 +638,8 @@ def vm_check(status_error): check_ubuntools(vmchecker.checker) if 'vmware_tools' in checkpoint: check_windows_vmware_tools(vmchecker.checker) + if 'check_online_disks' in checkpoint: + check_online_disks(vmchecker.checker) if 'without_default_net' in checkpoint: if virsh.net_state_dict()[net_name]['active']: log_fail("Bridge virbr0 already started during conversion")