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" }'
Created attachment 1718944 [details] vm import resource
Created attachment 1718945 [details] vm import controller log
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.
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.
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
Adding PR with fix for multiple/duplicate network source mapping https://github.com/kubevirt/vm-import-operator/pull/453
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