Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2139723

Summary: Can't connect vmware target by virsh if hierarchy contains some specical character, such as '\', '/', '%'
Product: Red Hat Enterprise Linux 9 Reporter: mxie <mxie>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
libvirt sub component: General QA Contact: Virtualization Bugs <virt-bugs>
Status: CLOSED DUPLICATE Docs Contact:
Severity: medium    
Priority: medium CC: chhu, hongzliu, jsuchane, juzhou, kkiwi, lersek, mzhan, rjones, tyan, tzheng, virt-maint, vwu, xiaodwan, xuzhang
Version: 9.2Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-03 13:36:36 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:
Embargoed:
Attachments:
Description Flags
vsphere-hierarchy-contains-specical-character-\.png none

Description mxie@redhat.com 2022-11-03 10:10:06 UTC
Created attachment 1921955 [details]
vsphere-hierarchy-contains-specical-character-\.png

Description of problem:
Can't connect vmware target by virsh if hierarchy contains some specical character, such as '\', '/', '%'

Version-Release number of selected component (if applicable):
libvirt-libs-8.9.0-1.el9.x86_64
qemu-img-7.1.0-4.el9.x86_64


How reproducible:
100%

Steps to Reproduce:

Scenario1:
1.1 Add specical characters '\' to hierarchy 'datacenter' on vsphere client, pls refer to screenshot 

1.2 Connect vmware target by virsh when hierarchy contains some specical characters, use characters '\', , as examples
# virsh -c  vpx://root.73.141/data%5cdata/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
error: failed to connect to the hypervisor
error: internal error: Could not find datacenter specified in '/data\data/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/'

Scenario2:
2.1 Add specical characters '/' to hierarchy 'datacenter' on vsphere client, pls refer to screenshot 

2.2 Connect vmware target by virsh
#  virsh -c  vpx://root.73.141/data%2fdata/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
error: failed to connect to the hypervisor
error: internal error: Could not find compute resource specified in '/data/data/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/'


Scenario3:
3.1 Add specical characters '%' to hierarchy 'datacenter' on vsphere client, pls refer to screenshot 

3.2 Connect vmware target by virsh 
#  virsh -c  vpx://root.73.141/data%25data/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
error: failed to connect to the hypervisor
error: internal error: Could not find datacenter specified in '/data%data/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/'


Actual results:
As above description

Expected results:
Can connect vmware target by virsh if hierarchy contains specical characters


Additional info:
Can connect vmware target by virsh if hierarchy contains specical characters, such as 'space', '@', '-', ':'

1.When specical characters is space 
# virsh -c  vpx://root.73.141/data%20data/cluster%20cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # 

2.When specical characters is '@'
#  virsh -c  vpx://root.73.141/data%40data/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # 

3.When specical characters is '-'
#  virsh -c  vpx://root.73.141/data%2ddata/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # 

4.When specical characters is ':'
#  virsh -c  vpx://root.73.141/data%3adata/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh #

Comment 1 Jaroslav Suchanek 2022-11-03 13:36:36 UTC
This has been reported in bug 1373863, which was later closed as wontfix.

*** This bug has been marked as a duplicate of bug 1373863 ***

Comment 2 Laszlo Ersek 2022-11-03 14:42:52 UTC
Furthermore, at the virt-v2v level, we have documentation that *seems* related:

https://bugzilla.redhat.com/show_bug.cgi?id=1938954
https://github.com/libguestfs/virt-v2v/commit/f8c564333057

Comment 3 mxie@redhat.com 2022-11-07 02:36:50 UTC
(In reply to Laszlo Ersek from comment #2)
> Furthermore, at the virt-v2v level, we have documentation that *seems*
> related:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1938954
> https://github.com/libguestfs/virt-v2v/commit/f8c564333057

Yes, can connect vmware target by virsh if apercent sign (%) is encoded as %25,

1.#  virsh -c  vpx://root.73.141/data%255cdata/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # 


2.#  virsh -c  vpx://root.73.141/data%2525data/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # 


3.# virsh -c  vpx://root.73.141/data%252fdata/cluster/hp-dl360eg8-01.lab.eng.pek2.redhat.com/?no_verify=1
Enter root's password for 10.73.73.141: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh #