Bug 1885226

Summary: [v2v] [api] VM import RHV/VMware to CNV Import deploying a 2nd vmimport with the same targetVmName should not be allowed.
Product: Container Native Virtualization (CNV) Reporter: Amos Mastbaum <amastbau>
Component: V2VAssignee: Sam Lucidi <slucidi>
Status: CLOSED ERRATA QA Contact: Amos Mastbaum <amastbau>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.5.0CC: cnv-qe-bugs, fdupont, istein, mguetta, oramraz, slucidi, yzamir
Target Milestone: ---   
Target Release: 2.5.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-15 19:29:40 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 Amos Mastbaum 2020-10-05 13:25:26 UTC
Description of problem:

The API allows you to create vmimport CRs with duplicated targetVmName.
 
Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.Deploy 2 identical vmimport that has different CR name  


Actual results:
The 2nd vmimport is created successfully
The 2nd vmimport CR may receive vm status message that belongs to the 1st vmimport. 

Expected results:
no 2 vmimports with the same namespace and targetVmName should NOT  be allowed to be created.



Additional info:

Comment 1 Yaacov Zamir 2020-10-06 19:01:58 UTC
Note:
It will also be nice if the operator can rejects "targetVmName" if we already have a vm with that name ?

Comment 2 Piotr Kliczewski 2020-10-07 07:40:43 UTC
That is the intention to check target vm name conflicts.

Comment 3 Maayan Hadasi 2020-10-15 15:03:15 UTC
This issue is relevant for both sources RHV/VMware

Tested with CNV 2.5.0

Comment 5 Yaacov Zamir 2020-12-16 13:10:33 UTC
*** Bug 1885124 has been marked as a duplicate of this bug. ***

Comment 6 Ilanit Stein 2020-12-30 11:36:14 UTC
Verified on Tested om OCP-4.6/CNV hco-v2.5.3-64
by running twice same vm import create. On the 2nd run got:
"Error from server (AlreadyExists): error when creating "STDIN": virtualmachineimports.v2v.kubevirt.io "vmware-import-1" already exists"

Comment 7 Ilanit Stein 2021-01-05 10:43:39 UTC
The verification in comment #6 was wrong, because it tested using same vm import CR name,
while bug fixes using same targetVmName.

Verified on OCP-4.6/CNV hco-v2.5.3-64 
using same VM import CR twice, with different CR name. The 2nd VM import did not get the first VM import "successful" status.
It failed as expected on:

status:
  conditions:
  - lastHeartbeatTime: "2021-01-05T10:37:36Z"
    lastTransitionTime: "2021-01-05T10:36:24Z"
    message: Virtual machine already exists in target namespace
    reason: DuplicateTargetVMName
    status: "False"
    type: Valid
  targetVmName: ""
  warmImport:
    consecutiveFailures: 0
    failures: 0
    successes: 0

@Sam,
This bug still exists on CNV-2.6.0 - Is this expected please?

Comment 8 Fabien Dupont 2021-01-05 17:31:08 UTC
The CNV 2.6.0-452 build should have the fix.

Comment 9 Ilanit Stein 2021-01-10 08:47:48 UTC
Moving bug to Verified since it moved to Assigned in comment #7 by mistake.