Bug 2180279

Summary: VM cannot be started while creating from a template which has 2nd disk added
Product: Container Native Virtualization (CNV) Reporter: Guohua Ouyang <gouyang>
Component: User ExperienceAssignee: Aviv Turgeman <aturgema>
Status: CLOSED ERRATA QA Contact: Guohua Ouyang <gouyang>
Severity: high Docs Contact:
Priority: high    
Version: 4.13.0CC: gouyang
Target Milestone: ---   
Target Release: 4.13.0   
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: 2023-05-18 02:58:23 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 Guohua Ouyang 2023-03-21 05:56:49 UTC
Description of problem:
VM cannot be started while creating from a template which has 2nd disk added.
1. If the storage class is HPP, below annotation is missing in the VM PVC: "cdi.kubevirt.io/storage.bind.immediate.requested: 'true'" 
2. If the storage class is OCS, the error for the VM is: Failed to create DataVolume: the namespace of the provided object does not match the namespace sent on the request

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


How reproducible:


Steps to Reproduce:
1. clone a template from centos7
2. add 2nd disk to the template
3. create vm from the template

Actual results:
VM is not able to be started

Expected results:
VM is started

Additional info:

Comment 1 Guohua Ouyang 2023-03-21 08:02:06 UTC
It's a regression from 4.12.

And this problem only happens while creating VM not from 'openshift' namespace.

Comment 2 Guohua Ouyang 2023-03-21 08:38:21 UTC
Another scenario is:
1. clone a template, create vm from it in 'default' ns is fine
2. clone a template, edit the rootdisk, save it without actually change anything, create vm from it in 'default' ns, vm is not in stopped status because of error: Failed to create DataVolume: the namespace of the provided object does not match the namespace sent on the request

The difference between the two templates are "storageClassName: hostpath-csi-basic"m one template has it and one doesn't.
      dataVolumeTemplates:
        - metadata:
            namespace: openshift
            name: '${NAME}'
          spec:
            storage:
              resources:
                requests:
                  storage: 30Gi
              storageClassName: hostpath-csi-basic
            preallocation: false
            sourceRef:
              kind: DataSource
              name: '${DATA_SOURCE_NAME}'
              namespace: '${DATA_SOURCE_NAMESPACE}'

Comment 3 Guohua Ouyang 2023-03-22 00:34:39 UTC
(In reply to Guohua Ouyang from comment #2)
> Another scenario is:
> 1. clone a template, create vm from it in 'default' ns is fine
> 2. clone a template, edit the rootdisk, save it without actually change
> anything, create vm from it in 'default' ns, vm is not in stopped status
> because of error: Failed to create DataVolume: the namespace of the provided
> object does not match the namespace sent on the request
> 
> The difference between the two templates are "storageClassName:
> hostpath-csi-basic"m one template has it and one doesn't.
>       dataVolumeTemplates:
>         - metadata:
>             namespace: openshift


It looks the 'namespace: openshift' is the problem, edit the disk will add this line to the template which prevent disk clone.

Comment 5 errata-xmlrpc 2023-05-18 02:58:23 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 (Moderate: OpenShift Virtualization 4.13.0 Images security, bug fix, and enhancement 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-2023:3205