Skip to content

Commit

Permalink
Merge pull request #5912 from mxie91/add-cases-about-guests-with-mult…
Browse files Browse the repository at this point in the history
…iple-online-disks

Add v2v cases about guests with extra online disks
  • Loading branch information
xiaodwan authored Sep 24, 2024
2 parents a645bda + 7fab98f commit ca60e7a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
21 changes: 18 additions & 3 deletions v2v/tests/cfg/function_test_esx.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
37 changes: 37 additions & 0 deletions v2v/tests/src/function_test_esx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import uuid
import shutil
import tempfile
import time
import xml.etree.ElementTree as ET

from virttest import data_dir
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit ca60e7a

Please sign in to comment.