Bug 1885153 - [v2v][RHV to CNv VM import] Wrong Network mapping do not show a relevant error message
Summary: [v2v][RHV to CNv VM import] Wrong Network mapping do not show a relevant erro...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: V2V
Version: 2.5.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 2.6.0
Assignee: Marek Aufart
QA Contact: Amos Mastbaum
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-05 09:31 UTC by Ilanit Stein
Modified: 2021-03-10 11:19 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-03-10 11:18:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
vm import resource (3.03 KB, text/plain)
2020-10-05 09:31 UTC, Ilanit Stein
no flags Details
vm import controller log (393.46 KB, text/plain)
2020-10-05 09:32 UTC, Ilanit Stein
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2021:0799 0 None None None 2021-03-10 11:19:54 UTC

Description Ilanit Stein 2020-10-05 09:31:02 UTC
Description of problem:
Cirros VM on RHV with 2 nics of ovirtmgmt/ovirtmgmt.
These 2 negative test cases end up with this error:
"cirros-import could not be imported.
DataVolumeCreationFailed: Error while importing disk image: . VirtualMachine.kubevirt.io "" not found "

Case 1: Map networks to: 
          1. Pod network
          2. ovn-kubernetes1 
Resource mapping -
spec:
  ovirt:
    networkMappings:
    - source:
        name: ovirtmgmt/ovirtmgmt
      target:
        name: pod
      type: pod
    - source:
        name: ovirtmgmt/ovirtmgmt
      target:
        name: ovn-kubernetes1
      type: multus

Case 2: Map 2 networks to pod. Resource mapping -
spec:
  ovirt:
    networkMappings:
    - source:
        name: ovirtmgmt/ovirtmgmt
      target:
        name: pod
      type: pod
    - source:
        name: ovirtmgmt/ovirtmgmt
      target:
        name: pod
      type: pod
Version-Release number of selected component (if applicable):
CNV-2.5

Expected results:
There should be an error indicating that there is a mistake in the network mapping, 
Case 1. should fail on not be possible to map the same vnic profile to 2 different networks.
Case 2 should fail on more than one network interface mapped to a pod network is not allowed (either because that was specified explicitly or the nics share the same vnic profile).

Additional info:
How the 2nd network was added to CNV:
$ oc apply -f second_network.yaml

second_network.yaml:
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: ovn-kubernetes1
spec:
  config: '{
      "cniVersion": "0.3.1",
      "type": "cnv-bridge",
      "bridge": "br1"
    }'

Comment 1 Ilanit Stein 2020-10-05 09:31:52 UTC
Created attachment 1718944 [details]
vm import resource

Comment 2 Ilanit Stein 2020-10-05 09:32:26 UTC
Created attachment 1718945 [details]
vm import controller log

Comment 3 Fabien Dupont 2020-11-17 10:50:58 UTC
Marek, the validation must happen for both oVirt and VMware:

1. A source network can only be mapped one time. Otherwise, we can't decide which target to choose.

2. If a source virtual machine has 2 NICs connected to 2 networks, only one of the networks can be mapped to the "pod" (type: pod) network.

Comment 4 Fabien Dupont 2020-11-17 10:51:20 UTC
Ilanit, in the description, case 2 will fail because the source network is mapped 2 times. So, in your tests the source VM must be connected to 2 networks.

Comment 5 Marek Aufart 2020-12-10 08:14:29 UTC
There is a parser of mapping which uses Map structure which has keys by ID or Name, if there is mapping of the same network present more than once, other entries than the firts one are ignored - https://github.com/kubevirt/vm-import-operator/blob/master/pkg/utils/utils.go#L71-L84

If such validation would be needed, I'd update validation of parsing the mapping, similar to WIP PR https://github.com/aufi/vm-import-operator/commit/6a139978269f1d70fd825a66eba8da93a6ace413

Comment 6 Marek Aufart 2020-12-15 10:29:42 UTC
Adding PR with fix for multiple/duplicate network source mapping https://github.com/kubevirt/vm-import-operator/pull/453

Comment 9 errata-xmlrpc 2021-03-10 11:18:56 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 (Moderate: OpenShift Virtualization 2.6.0 security and bug fix update), 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-2021:0799


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