Bug 1868045

Summary: [v2v]kubevirt-vmware objects are not cleaned
Product: Container Native Virtualization (CNV) Reporter: Filip Krepinsky <fkrepins>
Component: V2VAssignee: Piotr Kliczewski <pkliczew>
Status: CLOSED ERRATA QA Contact: Ilanit Stein <istein>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.5.0CC: aos-bugs, cnv-qe-bugs, dagur, istein, ncredi, pkliczew, yzamir
Target Milestone: ---   
Target Release: 2.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v2.5.0-6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-17 13:24:21 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 Filip Krepinsky 2020-08-11 13:42:57 UTC
Description of problem:
V2VVMWare or OvirtProvider objects are not cleaned up

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. visit VM Import Wizard
2. select instance
3. kill browser window
4. mentioned objects live forever

Expected results:
Objects are deleted after some time 1-several hours

Comment 1 Filip Krepinsky 2020-08-11 13:55:24 UTC
kubevirt.io/temporary label was changed in recent versions to cnv.io/temporary. This label is not acted upon by OvirtProvider. 
@Piotr can we add a support for this to OvirtProvider or should we compute TTL and patch it once OvirtProvider object was created?

Comment 2 Piotr Kliczewski 2020-08-11 14:05:52 UTC
Ovirt provider was based on vmware provider and it uses the same mechanism based on ttl -> https://github.com/ManageIQ/manageiq-v2v-conversion_host/blob/5cc55e51bf7cc641e9b650c5e6bfae2159f022a3/kubevirt-vmware/pkg/apis/v2v/v1alpha1/ovirtprovider_types.go#L29. The cleanup logic is here https://github.com/ManageIQ/manageiq-v2v-conversion_host/blob/5cc55e51bf7cc641e9b650c5e6bfae2159f022a3/kubevirt-vmware/pkg/controller/gcovirtprovider/ovirtprovider_garbagecollector.go#L114 and should work exactly the same as for vmware.

@Filip have you tried to use TimeToLive attribute?

Comment 3 Filip Krepinsky 2020-08-11 14:18:54 UTC
there were two options for vmware provider TTL and temporary label. 
For ovirt there is only TTL which needs a special handling in the UI. First you have to create the resource and then patch it with TTL (not atomic).

We can implement this in the UI, but there will have to be additional logic for this. 
Wouldn't it be easier to support temporary label in the backend?

Comment 4 Piotr Kliczewski 2020-08-11 14:24:24 UTC
The label is not available in ovirt. I will add label support to be consistent with how vmware works.

Comment 5 Filip Krepinsky 2020-08-11 15:02:35 UTC
Thanks

Comment 6 Yaacov Zamir 2020-08-12 06:58:22 UTC
I see that this will be fixed in the operator, updating component to v2v

@Piotr hi, feel free to change back / create a UI bug if you think this should also be addressed in the UI too.

Comment 7 Piotr Kliczewski 2020-08-12 07:17:12 UTC
My understanding it that when we add changes to vm provider there is work needed on the UI to use it.

Comment 8 Yaacov Zamir 2020-08-12 09:36:25 UTC
> My understanding it that when we add changes to vm provider there is work needed on the UI to use it.

IFAIU: the ui currently adds the label
kubevirt.io/temporary: "true"

but it needs to add the label:
cnv.io/temporary: "true"


@Filip, is this a correct UI bug ?

Comment 9 Yaacov Zamir 2020-08-12 11:34:59 UTC
Ref to UI BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1868353

Comment 10 Filip Krepinsky 2020-08-12 11:48:37 UTC
yes, the UI bug will fix the use case for both providers. We just had a wrong label and we were already passing the label to both providers.

Comment 12 Filip Krepinsky 2020-09-01 11:26:03 UTC
with 

oc get ovirtproviders.v2v.kubevirt.io

you should see a new object (few seconds old) when you select RHV instance in the wizard. This object should disappear when you replicate steps to reproduce

Comment 13 Filip Krepinsky 2020-09-01 11:27:28 UTC
it might take some time before it disappears though (approx 1h)

Comment 14 Ilanit Stein 2020-10-01 17:31:16 UTC
Verified on CNV-2.5 deployed on Sep 30 2020.

Entered the VM import wizard, picked VM from VMware/RHV providers, and closed the browser window.

$ oc get ovirtproviders.v2v.kubevirt.io
$ oc get V2VVMWare.v2v.kubevirt.io

showed that after 1 hours both object were indeed removed.

Comment 17 errata-xmlrpc 2020-11-17 13:24:21 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 (OpenShift Virtualization 2.5.0 Images), 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/RHEA-2020:5127