Bug 1373863

Summary: Few special characters in VMware cluster and data center are not handled well by libvirt/virt-v2v
Product: Red Hat Enterprise Linux 7 Reporter: Sharon Gratch <sgratch>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED WONTFIX QA Contact: Yanqiu Zhang <yanqzhan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: cww, dornelas, dyuan, michal.skrivanek, mxie, rbalakri, rjones, tjelinek, xuzhang, zpeng
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-27 21:24:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1356767, 1420851, 1437480    

Description Sharon Gratch 2016-09-07 10:10:53 UTC
Description of problem:
oVirt fails to load the list of VMs when querying a VMware vCenter that includes few special chars within the VMware-datacenter or VMware-cluster.
The same reproduced when running virsh ot virt-v2v.

Details:
The ovirt engine sends the already encoded uri to VDSM (a fix for Bug 1356767), 
But it fails on libvirt or virtv2v with two kind of errors:
1. For any one of the following chars exists in datacenter/cluster: %, /, \ 
the following error appears in libvirt:
"Could not find datacenter specified in <uri>"

2. For any one of the following chars exists in datacenter/cluster: &, +, =, ?
the following error appears in virt-v2v:
virt-v2v: error: internal error: invalid argument: cannot fetch XML
description of guest '111': internal error: HTTP response code 404 for
download from
'https://vcenter:443/folder/111%2f111%2evmx?dcPath=Folder1%2fFolder2%2fCompute%2b3&dsName=global'

or from vdsm log:
jsonrpc.Executor/6::ERROR::2016-08-31 14:20:10,003::v2v::168::root::(get_external_vms) error getting domain xml for vm 'RHEL7_thick_eager_zeroed': internal error: HTTP response code 404 for download from 'https://vcenter:443/folder/RHEL7%5fthick%5feager%5fzeroed%2fRHEL7%5fthick%5feager%5fzeroed%2evmx?dcPath=Folder1%2fFolder2%2fCompute%2b1&dsName=nsimsolo%5fiSCSI%5f3'


Version-Release number of selected component (if applicable):
libvirt Version     : 1.2.18.4
ovirt 4.0.4

How reproducible:
100%

Steps to Reproduce:
1. Declare a VMware data center or cluster with one of the chars described above.
2. a. Try to run virsh -c "vpx://administrator@vcenter/encoded-datacenter/encoded-cluster/esxi?no_verify=1" with the datacenter,cluster declared in 1.

b. or if (a) passes, try to run:
virt-v2v -v -x -o null -ic "vpx://administrator@vcenter/encoded-data-center/encoded-cluster/esxi?no_verify=1"  vm-to-import

Actual results:
a. the following error appears:
error: failed to connect to the hypervisor
error: internal error: Could not find datacenter specified in '/datacenter/cluster/esxi'

b. The following error appears:
virt-v2v: error: internal error: invalid argument: cannot fetch XML
description of guest 'vm-to-import': internal error: HTTP response code 404 for
download from
'https://vcenter:443/encoded-datacenter/encoded-cluster&dsName=global'

Expected results:
it should work without errors as done with other special chars.

Additional info:

Comment 8 Jaroslav Suchanek 2022-11-03 13:36:36 UTC
*** Bug 2139723 has been marked as a duplicate of this bug. ***