Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2v: add cpu topology case for -i vmx scenario #5265

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion v2v/tests/cfg/convert_from_file.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@
enable_legacy_policy = yes
only esx_67
main_vm = 'VM_NAME_RHEL6_V2V_EXAMPLE'

- cpu_topology:
only esx_67
vmx_nfs_src = NFS_ESX67_VMX_V2V_EXAMPLE
main_vm = 'VM_NAME_CPU_TOPOLOGY_V2V_EXAMPLE'
v2v_debug = force_on
checkpoint = 'cpu_topology'
msg_content_yes = ''
variants:
- negative_test:
status_error = 'yes'
Expand Down
17 changes: 17 additions & 0 deletions v2v/tests/src/convert_from_file.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import glob
import os
import pwd
import logging
Expand Down Expand Up @@ -233,6 +234,22 @@ def vm_check():
'skip_virsh_pre_conn': skip_virsh_pre_conn})
if checkpoint == 'regular_user_sudo':
v2v_params.update({'pub_key': pub_key})
if checkpoint == 'cpu_topology':
mount_point = utils_v2v.v2v_mount(vmx_nfs_src, 'v2v_tmp_mp')
vmxfile = glob.glob(os.path.join(mount_point, vm_name, '*.vmx'))[0]
with open(vmxfile) as fd:
buf = fd.read()
res = re.search('numvcpus = "(\d+)"', buf)
if not res:
test.error('Not found numvcpus in vmx file')
numvcpus = int(res.group(1))
res = re.search('cpuid.coresPerSocket = "(\d+)"', buf)
if not res:
test.error('Not found cpuid.coresPerSocket in vmx file')
corespersocket = int(res.group(1))
params['msg_content_yes'] += '<rasd:num_of_sockets>' + str(numvcpus//corespersocket) + '%'
params['msg_content_yes'] += '<rasd:cpu_per_socket>' + str(corespersocket) + '%'
params['msg_content_yes'] += '<rasd:threads_per_cpu>' + '1'
# copy ova from nfs storage before v2v conversion
if input_mode == 'ova':
src_dir = params.get('ova_dir')
Expand Down