Bug 1841325 - [CNV][V2V] VM migration fails if VMWare host isn't under Cluster but directly under Datacenter
Summary: [CNV][V2V] VM migration fails if VMWare host isn't under Cluster but directly...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: V2V
Version: 2.3.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 2.4.0
Assignee: Brett Thurber
QA Contact: Ilanit Stein
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-28 20:38 UTC by Rafal Szmigiel
Modified: 2020-07-28 19:10 UTC (History)
7 users (show)

Fixed In Version: v2.4.0-18
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-28 19:10:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ManageIQ manageiq-v2v-conversion_host pull 72 0 None closed Fix hostPath 2020-07-28 20:33:09 UTC
Red Hat Product Errata RHSA-2020:3194 0 None None None 2020-07-28 19:10:26 UTC

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


Note You need to log in before you can comment on or make changes to this bug.