Skip to content

Commit ffd54dc

Browse files
committed
Add 3 v2v new cases for customer bugs
1. Add case about ubuntu guest with usr partition 2. Add case about windows guest with specific services 3. Add case about connect vmware source with custom cert path Signed-off-by: Ming Xie <[email protected]>
1 parent 4f934ff commit ffd54dc

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

v2v/tests/cfg/function_test_esx.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,14 @@
903903
certs_src_dir = 'CERTS_DIR_V2V_EXAMPLE'
904904
certs_dest_dir = '/etc/pki/ca-trust/source/anchors'
905905
vcenter_fdqn = VCENTER_FDQN_V2V_EXAMPLE
906+
- verify_custom_path_cert:
907+
only esx_80
908+
version_required = "[libvirt-10.10.0-7.6,)"
909+
boottype = 3
910+
main_vm = VM_NAME_NON_ADMIN_V2V_EXAMPLE
911+
checkpoint = 'verify_custom_path_cert'
912+
certs_src_dir = 'CERTS_DIR_V2V_EXAMPLE'
913+
vcenter_fdqn = VCENTER_FDQN_V2V_EXAMPLE
906914
- luks_mapper:
907915
only esx_70
908916
version_required = "[virt-v2v-2.3.4-3,)"

v2v/tests/cfg/specific_kvm.cfg

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,19 +306,31 @@
306306
- vmtools_spausedd:
307307
only esx_70
308308
main_vm = VM_NAME_OPEM_VM_TOOLS_DEPEND_SPAUSEDD_V2V_EXAMPLE
309+
- check_pnp_service:
310+
only esx_80
311+
version_required = "[virt-v2v-2.7.1-10,)"
312+
skip_vm_check = yes
313+
skip_reason = "it's a customer guest and we don't know login info"
314+
boottype = 2
315+
main_vm = VM_NAME_WIN_GUEST_WITH_GPO_SPECIFIC_SERVICES_V2V_EXAMPLE
316+
checkpoint = check_pnp_service
317+
- ubuntu_usr_partition:
318+
only esx_80
319+
boottype = 2
320+
main_vm = VM_NAME_UBUNTU_WITH_USR_PARTITION_V2V_EXAMPLE
309321
variants:
310322
- positive_test:
311323
status_error = 'no'
312324
# Convert specific VM to rhev
313325
variants:
314326
- linux:
315327
no default
316-
no multi_disks.windows
317328
no network.e1000
318329
no fstab.invalid
319330
no display.mix
320331
no win_rootonlinux
321332
no non_exist_network
333+
no check_pnp_service
322334
- windows:
323335
os_type = 'windows'
324336
shutdown_command = 'shutdown /s /f /t 0'
@@ -339,8 +351,8 @@
339351
vm_user = 'Administrator'
340352
vm_pwd = DEFAULT_WIN_VM_PASSWORD
341353
variants:
342-
- multi_disks:
343-
only multi_disks.windows
354+
- default:
355+
only check_pnp_service
344356
- network:
345357
only network.e1000,non_exist_network
346358
- to_libvirt:

v2v/tests/src/function_test_esx.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ def vm_check(status_error):
942942
auto_clean = False
943943
if checkpoint[0] in [
944944
'verify_certificate',
945+
'verify_custom_path_cert',
945946
'mismatched_uuid',
946947
'no_uuid',
947948
'invalid_source',
@@ -992,9 +993,15 @@ def vm_check(status_error):
992993
vcenter_fdqn = params.get('vcenter_fdqn')
993994
verify_certificate(certs_src_dir, certs_dest_dir, vcenter_fdqn, vpx_hostname)
994995
new_cmd = v2v_result.replace('/?no_verify=1', '').replace(vpx_hostname, vcenter_fdqn)
995-
996+
if 'verify_custom_path_cert' in checkpoint:
997+
certs_src_dir = params.get('certs_src_dir')
998+
certs_dest_dir = os.path.join(data_dir.get_tmp_dir(), 'vmarecert')
999+
vcenter_fdqn = params.get('vcenter_fdqn')
1000+
verify_certificate(certs_src_dir, certs_dest_dir, vcenter_fdqn, vpx_hostname)
1001+
new_cmd = v2v_result.replace('/?no_verify=1', '/?cacert=%s/faea32cd.0' % certs_dest_dir).replace(vpx_hostname, vcenter_fdqn)
9961002
if checkpoint[0] in [
9971003
'verify_certificate',
1004+
'verify_custom_path_cert',
9981005
'mismatched_uuid',
9991006
'no_uuid',
10001007
'invalid_source',

v2v/tests/src/specific_kvm.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,34 @@ def check_result(result, status_error):
586586
test.fail('check local output failed')
587587
if output_mode in ['null', 'json', 'local']:
588588
return
589+
if checkpoint == 'check_pnp_service':
590+
log_path = data_dir.get_tmp_dir()
591+
process.run("virsh start %s" % vm_name, shell=True, ignore_status=True)
592+
LOG.info("Waiting 25 minutes to wait for guest finishing reboot")
593+
time.sleep(25 * 60)
594+
595+
# Now check for the log file in the next 5 minutes
596+
LOG.info("Checking for log file in 5 minutes")
597+
found = False
598+
end_time = time.time() + 5 * 60
599+
while time.time() < end_time:
600+
process.run("virsh start %s" % vm_name, shell=True, ignore_status=True)
601+
time.sleep(60) # check every 1 minute
602+
process.run("virsh destroy %s" % vm_name, shell=True, ignore_status=True)
603+
process.run("virt-copy-out -d %s '/Program Files/Guestfs/Firstboot' %s" % (vm_name, log_path),
604+
shell=True)
605+
log_file = '%s/Firstboot/log.txt' % log_path
606+
if not log_file:
607+
continue
608+
# guest will finish all reboots if info uninstalling firstboot service shows in the log
609+
if re.search(r'uninstalling firstboot service.*', process.run('cat %s' % log_file, shell=True).stdout_text):
610+
found = True
611+
break
612+
log_output = process.run('cat %s/Firstboot/log.txt' % log_path, shell=True).stdout_text
613+
if len(re.findall(r'The Plug and Play service is not available.*', log_output)) >= 2:
614+
log_fail('Found drivers are not installed due to pnp services are not available')
615+
if not found:
616+
log_fail("firstboot log is not generated")
589617

590618
vmchecker = VMChecker(test, params, env)
591619
params['vmchecker'] = vmchecker

0 commit comments

Comments
 (0)