waterWang opened a new pull request, #13932:
URL: https://github.com/apache/cloudstack/pull/13932

   Fixes #13920
   
   ## Summary
   
   `LibvirtConvertInstanceCommandWrapper` builds vpx:// and vi:// connection 
URIs for virt-v2v by concatenating vCenter datacenter/cluster/host names 
without percent-encoding them. A datacenter (or cluster/host) name containing a 
space — valid in vSphere — produces an invalid URI, and VM import from VMware 
fails.
   
   ## Changes
   
   - **`encodePathSegment`** — percent-encodes a single URI path segment using 
`%20` for spaces (not `+`)
   - **`encodePathSegments`** — splits on `/` and encodes each sub-segment 
individually, preserving literal `/` separators for folder-nested names (e.g. 
`MyFolder/MyDC`)
   - **`buildVpxUrl`** — now calls `encodePathSegments` on datacenter and 
cluster, `encodePathSegment` on host
   - **`getExportOVAUrlFromRemoteInstance`** — now calls `encodePathSegments` 
on datacenter and path, `encodePathSegment` on vm
   - **`encodeUsername`** — fixed to use explicit `UTF-8` charset and `%20` 
instead of `+` for spaces (libvirt only decodes `%20` in URI authority segments)
   
   ## Testing
   
   Manual test: with a datacenter named `QA Lab`, the vpx:// URL now correctly 
becomes:
   ```
   
vpx://Administrator%[email protected]/QA%20Lab/cluster-a/203.0.113.20?no_verify=1
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to