Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-51962

'Error encountered while creating DataVolumes: DataVolume sourceRef not supported' is thrown when datasources doesn't get populated

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • CNV v4.18.1
    • CNV v4.16.4
    • Storage Platform
    • 0.42
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • ---
    • ---
    • None

      Description of problem:

      There is a datasource that exist but No source PVC set, we get a wrong error about it. SourceRef is a right field to set 
      Yeah so the issue is that in order to support sourceRefs in vm templates we need to get the datasource during VM creation to ensure it won't change later after validation. Since the datasource is empty, we can't proceed for security reasons and trigger an error instead  Attaching detailed yaml in additional info

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

      4.16.4 and all versions are affected by it

      How reproducible:

      always

      Steps to Reproduce:

      1.
      2.
      3.
      

      Actual results:

       

      Expected results:

       

      Additional info:

      $ oc get datasource sap-test  -n sap -o yaml
      apiVersion: cdi.kubevirt.io/v1beta1
      kind: DataSource
      metadata:
        creationTimestamp: "2024-11-21T12:37:58Z"
        generation: 2
        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.16.4
          cdi.kubevirt.io/dataImportCron: sap-test-import-cron-mbx4o7
          instancetype.kubevirt.io/default-instancetype: u1.large
          instancetype.kubevirt.io/default-preference: rhel.8
        name: sap-test
        namespace: sap
        resourceVersion: "1038679"
        uid: a50d0e69-2b04-4aa4-bcbb-a9e0ce2e3ea6
      spec:
        source: {}
      status:
        conditions:
        - lastHeartbeatTime: "2024-11-21T12:37:58Z"
          lastTransitionTime: "2024-11-21T12:37:58Z"
          message: No source PVC set
          reason: NoSource
          status: "False"
          type: Ready
        source: {}
      
      
      VM Yaml 
      
      apiVersion: kubevirt.io/v1
      kind: VirtualMachine
      metadata:
        annotations:
          kubemacpool.io/transaction-timestamp: '2024-11-21T12:38:16.69786808Z'
          kubevirt.io/latest-observed-api-version: v1
          kubevirt.io/storage-observed-api-version: v1
        resourceVersion: '1038964'
        name: rhel-8-copper-haddock-30
        uid: 61ec501d-acda-45be-956c-e01aec07e82f
        creationTimestamp: '2024-11-21T12:38:15Z'
        generation: 2
        managedFields:
          - apiVersion: kubevirt.io/v1
            fieldsType: FieldsV1
            fieldsV1:
              'f:spec':
                .: {}
                'f:dataVolumeTemplates': {}
                'f:instancetype':
                  .: {}
                  'f:name': {}
                'f:preference':
                  .: {}
                  'f:name': {}
                'f:running': {}
                'f:template':
                  .: {}
                  'f:metadata':
                    .: {}
                    'f:labels':
                      .: {}
                      'f:network.kubevirt.io/headlessService': {}
                  'f:spec':
                    .: {}
                    'f:domain':
                      .: {}
                      'f:devices':
                        .: {}
                        'f:interfaces': {}
                    'f:networks': {}
                    'f:subdomain': {}
                    'f:volumes': {}
            manager: Mozilla
            operation: Update
            time: '2024-11-21T12:38:15Z'
          - apiVersion: kubevirt.io/v1
            fieldsType: FieldsV1
            fieldsV1:
              'f:metadata':
                'f:annotations':
                  'f:kubevirt.io/latest-observed-api-version': {}
                  'f:kubevirt.io/storage-observed-api-version': {}
                'f:finalizers':
                  .: {}
                  'v:"kubevirt.io/virtualMachineControllerFinalize"': {}
              'f:spec':
                'f:instancetype':
                  'f:revisionName': {}
                'f:preference':
                  'f:revisionName': {}
            manager: virt-controller
            operation: Update
            time: '2024-11-21T12:38:16Z'
          - apiVersion: kubevirt.io/v1
            fieldsType: FieldsV1
            fieldsV1:
              'f:status':
                .: {}
                'f:conditions': {}
                'f:printableStatus': {}
                'f:volumeSnapshotStatuses': {}
            manager: virt-controller
            operation: Update
            subresource: status
            time: '2024-11-21T12:38:17Z'
        namespace: sap
        finalizers:
          - kubevirt.io/virtualMachineControllerFinalize
      spec:
        dataVolumeTemplates:
          - metadata:
              creationTimestamp: null
              name: rhel-8-copper-haddock-30-volume
            spec:
              sourceRef:
                kind: DataSource
                name: sap-test
                namespace: sap
              storage:
                resources: {}
        instancetype:
          kind: virtualmachineclusterinstancetype
          name: u1.large
          revisionName: rhel-8-copper-haddock-30-u1.large-cdda4480-974e-4c10-b74c-94485e2f2fb3-1
        preference:
          kind: virtualmachineclusterpreference
          name: rhel.8
          revisionName: rhel-8-copper-haddock-30-rhel.8-b101dbd5-c93b-491b-aece-6e2ba15a1d1d-1
        running: true
        template:
          metadata:
            creationTimestamp: null
            labels:
              network.kubevirt.io/headlessService: headless
          spec:
            architecture: amd64
            domain:
              devices:
                interfaces:
                  - macAddress: '02:df:21:00:00:05'
                    masquerade: {}
                    name: default
              machine:
                type: pc-q35-rhel9.4.0
              resources: {}
            networks:
              - name: default
                pod: {}
            subdomain: headless
            volumes:
              - dataVolume:
                  name: rhel-8-copper-haddock-30-volume
                name: rootdisk
              - cloudInitNoCloud:
                  userData: |
                    #cloud-config
                    chpasswd:
                      expire: false
                    password: ue2c-crpa-oxp5
                    user: cloud-user
                name: cloudinitdisk
      status:
        conditions:
          - lastProbeTime: '2024-11-21T12:38:17Z'
            lastTransitionTime: '2024-11-21T12:38:17Z'
            message: VMI does not exist
            reason: VMINotExists
            status: 'False'
            type: Ready
          - lastProbeTime: null
            lastTransitionTime: '2024-11-21T12:38:17Z'
            message: 'Error encountered while creating DataVolumes: DataVolume sourceRef not supported'
            reason: FailedCreate
            status: 'True'
            type: Failure
        printableStatus: Stopped
        volumeSnapshotStatuses:
          - enabled: false
            name: rootdisk
            reason: PVC not found
          - enabled: false
            name: cloudinitdisk
            reason: 'Snapshot is not supported for this volumeSource type [cloudinitdisk]'
      
      

              akalenyu Alex Kalenyuk
              gkapoor@redhat.com Geetika Kapoor
              Yan Du Yan Du
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: