Skip to content

Commit

Permalink
v2v: add new case for converting wrong vmx file
Browse files Browse the repository at this point in the history
Signed-off-by: vwu-vera <[email protected]>
  • Loading branch information
vwu-vera committed Dec 19, 2024
1 parent caac457 commit 496e846
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions v2v/tests/cfg/convert_from_file.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@
checkpoint = 'special_character'
expect_msg = 'yes'
msg_content = 'nbd_connect_uri.*No such file or directory.*'
- wrong_vmx:
only esx_80
boottype = 3
version_required = "[virt-v2v-2.4.0-2.el9,)"
main_vm = VM_NAME_RHEL9_V2V_EXAMPLE
checkpoint = 'wrong_vmx'
msg_content_yes = "virt-v2v: error: input file is a VMDK \(disk image\), but we are expecting a VMX \(VMware metadata\)"
- no_ssh_agent:
only esx_80
version_required = "[virt-v2v-2.4.0-2.el9,)"
Expand Down Expand Up @@ -321,13 +328,13 @@
variants:
- negative_test:
status_error = 'yes'
only parse.SHA1,parse.SHA256,special_character
only parse.SHA1,parse.SHA256,special_character,wrong_vmx
- positive_test:
status_error = 'no'
variants:
- linux:
only ova,vmx,disk
no win2008r2_ostk,aws.win2019,special_character
no win2008r2_ostk,aws.win2019,special_character,wrong_vmx
- windows:
os_type = 'windows'
shutdown_command = 'shutdown /s /f /t 0'
Expand Down
6 changes: 6 additions & 0 deletions v2v/tests/src/convert_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ def vm_check():
if checkpoint == 'special_character':
v2v_result = utils_v2v.cmd_run(str(utils_v2v.v2v_cmd(v2v_params, cmd_only=True)).replace('.vmx', '.vm*'),
params.get('v2v_dirty_resources'))
elif checkpoint == 'wrong_vmx':
esxi_passwd_file = "/tmp/v2v_esxi_passwd"
with open(esxi_passwd_file, 'w') as f:
f.write(esxi_password)
v2v_cmd = str(utils_v2v.v2v_cmd(v2v_params, cmd_only=True) + ' -ip %s' % esxi_passwd_file)
v2v_result = utils_v2v.cmd_run(v2v_cmd.replace('.vmx', '.vmdk'), params.get('v2v_dirty_resources'))
elif checkpoint == 'no_ssh_agent':
esxi_passwd_file = "/tmp/v2v_esxi_passwd"
with open(esxi_passwd_file, 'w') as f:
Expand Down

0 comments on commit 496e846

Please sign in to comment.