Bug 2061723

Summary: Prevent new DataImportCron to manage DataSource if multiple DataImportCron pointing to same DataSource
Product: Container Native Virtualization (CNV) Reporter: Yan Du <yadu>
Component: StorageAssignee: Arnon Gilboa <agilboa>
Status: CLOSED ERRATA QA Contact: Yan Du <yadu>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.10.0CC: alitke, cnv-qe-bugs, mrashish
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: CNV v4.11.0-444 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-14 19:29:09 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 Yan Du 2022-03-08 12:11:08 UTC
Description of problem:
Prevent DataSource being managed by other DataImportCron if multiple DataImportCron pointing to same DataSource

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

How reproducible:
Always

Steps to Reproduce:
1. Create two dataimportcrons pointing to same datasource
$ oc get dic
NAME                       AGE
rhel8-image-import-cron    35m
rhel8-image-import-cron2   29m


Actual results:
The datasource is managed by the second dic
$ oc get das -o yaml
apiVersion: v1
items:
- apiVersion: cdi.kubevirt.io/v1beta1
  kind: DataSource
  metadata:
    creationTimestamp: "2022-03-08T11:33:27Z"
    generation: 4
    labels:
      app.kubernetes.io/component: storage
      app.kubernetes.io/managed-by: cdi-controller
      app.kubernetes.io/part-of: hyperconverged-cluster
      app.kubernetes.io/version: 4.10.0
      cdi.kubevirt.io/dataImportCron: rhel8-image-import-cron2  <====
    name: rhel8
    namespace: default
    resourceVersion: "8762731"
    uid: a7ae4b44-4357-4a9b-8f08-d1bb5221bf76
  spec:
    source:
      pvc:
        name: rhel8-67f0ea617157
        namespace: default
  status:
    conditions:
    - lastHeartbeatTime: "2022-03-08T11:34:56Z"
      lastTransitionTime: "2022-03-08T11:34:56Z"
      message: DataSource is ready to be consumed
      reason: Ready
      status: "True"
      type: Ready
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""


Expected results:
Got some warning message that prevent two dic point to same datasource

Additional info:

Comment 1 Maya Rashish 2022-06-07 00:24:16 UTC
Picked version of wrong thing, now corrected.

Comment 2 Yan Du 2022-06-10 05:25:19 UTC
Test on CNV-v4.11.0-456

DataSource is only managed by the first DataImportCron when creating multiple DataImportCrons point to the same datasource.
$ oc get dic
NAME                       AGE
rhel8-image-import-cron    4m12s
rhel8-image-import-cron2   3m34s
rhel8-image-import-cron3   2m9s

$ oc get das -o yaml
apiVersion: v1
items:
- apiVersion: cdi.kubevirt.io/v1beta1
  kind: DataSource
  metadata:
    creationTimestamp: "2022-06-10T05:20:32Z"
    generation: 4
    labels:
      app.kubernetes.io/component: storage
      app.kubernetes.io/managed-by: cdi-controller
      app.kubernetes.io/part-of: hyperconverged-cluster
      app.kubernetes.io/version: 4.11.0
      cdi.kubevirt.io/dataImportCron: rhel8-image-import-cron

Comment 5 errata-xmlrpc 2022-09-14 19:29: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 (Important: OpenShift Virtualization 4.11.0 Images 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-2022:6526