Bug 1841325

Summary: [CNV][V2V] VM migration fails if VMWare host isn't under Cluster but directly under Datacenter
Product: Container Native Virtualization (CNV) Reporter: Rafal Szmigiel <rszmigie>
Component: V2VAssignee: Brett Thurber <bthurber>
Status: CLOSED ERRATA QA Contact: Ilanit Stein <istein>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.3.0CC: cnv-qe-bugs, fkrepins, istein, mlibra, pkliczew, pvauter, tgolembi
Target Milestone: ---   
Target Release: 2.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v2.4.0-18 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-28 19:10:09 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:

Description Rafal Szmigiel 2020-05-28 20:38:26 UTC
Description of problem:
While performing V2V migration I've noticed that it fails if VMWare hypervisor isn't configured as cluster member but it is located directly under datacenter.


When hypervisor is located in Datacenter -> Hypervisor
(I don't have the exact error now, sadly I can't replicate it now, but it was something like this:)

libvirt: ESX Driver error : invalid argument: Path '/Datacenter/host/1.2.3.5/1.2.3.5?no_verify=1' ends with an excess item

When hypervisor is located in Datacenter -> Cluster -> Hypervisor
# oc logs kubevirt-v2v-conversion-rhel8test-64kj4 | grep "Opening the source"
2020-05-28 20:14:03,350 - root - DEBUG - b'[   0.0] Opening the source -i libvirt -ic vpx://administrator%40rafal.vmware.3.4/Datacenter/host/Cluster/1.2.3.5?no_verify=1 rhel8test -it vddk  -io vddk-libdir=/opt/vmware-vix-disklib-distrib -io vddk-thumbprint=39:06:99:13:33:BF:F5:4F:99:EF:85:64:FF:BB:65:DD:B2:93:A7:85\n'

Version-Release number of selected component (if applicable):
OCP 4.4.4
CNV 2.3

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Tomáš Golembiovský 2020-05-29 14:00:19 UTC
(In reply to Rafal Szmigiel from comment #0)

> When hypervisor is located in Datacenter -> Hypervisor
> (I don't have the exact error now, sadly I can't replicate it now, but it
> was something like this:)
> 
> libvirt: ESX Driver error : invalid argument: Path
> '/Datacenter/host/1.2.3.5/1.2.3.5?no_verify=1' ends with an excess item

If this is the path passed to the tooling then it is wrong. Marek, what are the rules for constructing the URI for VMware connection?

From the tooling POV it should not matter whether the host is in cluser or not. Whether it is required by the UI I cannot tell. But judging from the fact that it got to the conversion POD it is not a hard requirement (or a bug).

Comment 4 Marek Libra 2020-06-10 14:50:57 UTC
It follows these rules: https://libvirt.org/drvesx.html
The actual value is composed via:
   vmware_uri: `vpx://${username}@${hostname}${vm?.detail?.hostPath}?no_verify=1`

Unfortunately the code has been multiple times refactored since I last touched it months ago which make me difficult to track down actual setting of the hostPath value now.

Filip, do you have an environment to try it? Can you please verify how the hostPath is set?

Comment 5 Filip Krepinsky 2020-06-10 16:02:58 UTC
the UI doesn't touches that; it takes the hostPath straight from V2VVmware CR

for example: spec.vms[5].detail.hostPath

Comment 6 Brett Thurber 2020-06-11 03:40:33 UTC
@Filip, not sure I understand where "cluster" is a dependency if we are only connecting to the host.  Can you verify?

Comment 7 Filip Krepinsky 2020-06-11 08:47:31 UTC
The hostPath variable contains for example already mentioned `/Datacenter/host/Cluster/1.2.3.5` or `/Datacenter/host/1.2.3.5/1.2.3.5` and this is entirely resolved by kubevirt-vmware controller which I do not have an insight into.

Comment 8 Tomáš Golembiovský 2020-06-11 10:46:53 UTC
Piotr, can you please investigate how is the `hostPath` constructed when the host is not assigned to Cluster?

Comment 9 Piotr Kliczewski 2020-06-15 07:07:10 UTC
Tomas, It is a matter of checking how we can build hostPath. We use vmware api to get it -> https://github.com/ManageIQ/manageiq-v2v-conversion_host/blob/master/kubevirt-vmware/pkg/controller/v2vvmware/client.go#L94
It seems that this call do not provide correct information (a bug in vmware api?). We could explore whether there is any other way to get this information but unfortunately I do not have an access to vcenter.

Comment 10 Piotr Kliczewski 2020-06-18 13:12:16 UTC
Apparently vmware uses host name as cluster name in this situation. I pushed a PR with a fix which removes duplication from hostPath.

@Tomas please verify that it works correctly.

Comment 11 Tomáš Golembiovský 2020-06-30 15:59:50 UTC
It works properly now, thanks.

Comment 12 Ilanit Stein 2020-07-06 16:45:04 UTC
Verified on latest CNV-2.4 (June 28 2020).
RHEL7 VM import from VMware - VM placed under Datacenter, and not under cluster, was successful.

Comment 15 errata-xmlrpc 2020-07-28 19:10:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:3194