This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
Bug 2219774 - The "snapshot" clone-strategy may not choose the correct VolumeSnapshotClass if there are multiple VolumeSnapshotClasses with the same driver
Summary: The "snapshot" clone-strategy may not choose the correct VolumeSnapshotClass ...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Storage
Version: 4.13.1
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
: 4.15.0
Assignee: Arnon Gilboa
QA Contact: Natalie Gavrielov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-05 10:14 UTC by nijin ashok
Modified: 2023-12-14 16:15 UTC (History)
0 users

Fixed In Version: v4.15.0.rhel9-1630
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-12-14 16:15:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt containerized-data-importer pull 2898 0 None Merged Allow StorageProfile to use a specific VolumeSnapshotClass 2023-11-12 16:08:13 UTC
Github kubevirt containerized-data-importer pull 2974 0 None Merged [release-v1.58] Allow StorageProfile to use a specific VolumeSnapshotClass 2023-11-12 16:09:22 UTC
Red Hat Issue Tracker   CNV-30679 0 None None None 2023-12-14 16:15:44 UTC
Red Hat Knowledge Base (Solution) 7036331 0 None None None 2023-09-29 10:21:03 UTC

Description nijin ashok 2023-07-05 10:14:23 UTC
Description of problem:

Hitachi storage can have multiple storage pools on the backend storage. Each storage pool corresponds to a StorageClass in OpenShift. Also, there is a corresponding VolumeSnapshotClass for each StorageClass. However, they will be having the same driver and provisioner.

~~~
# oc get volumesnapshotclasses.snapshot.storage.k8s.io snapshotclass-gold -o json | jq '.driver'
"hspc.csi.hitachi.com"
#  oc get volumesnapshotclasses.snapshot.storage.k8s.io snapshotclass-silver  -o json | jq '.driver'
"hspc.csi.hitachi.com"

# omg get sc sc-gold -o yaml |yq '.provisioner'
hspc.csi.hitachi.com

# omg get sc sc-silver -o yaml |yq '.provisioner'
hspc.csi.hitachi.com
~~~


The CDI finds the VolumeSnapshotClass by listing the VolumeSnapshotClass and by matching the driver with the provisioner of StorageClass.  

If there are multiple VolumeSnapshotClasses with the same driver, it can incorrectly pick the VolumeSnapshotClass of another SC.

~~~
 722 func (r *PvcCloneReconciler) getSnapshotClassForSmartClone(dataVolume *cdiv1.DataVolume, targetStorageSpec *corev1.PersistentVolumeClaimSpec) (stri     ng, error) {
...
...
 748         scs := &snapshotv1.VolumeSnapshotClassList{}
 749         if err := r.client.List(context.TODO(), scs); err != nil {
 750                 log.Info("Cannot list snapshot classes, falling back to host assisted clone")
 751                 return "", err
 752         }
 753         for _, snapshotClass := range scs.Items {        <<<
 754                 // Validate association between snapshot class and storage class
 755                 if snapshotClass.Driver == srcStorageClass.Provisioner {    <<<
 756                         log.Info("smart-clone is applicable for datavolume", "datavolume",
 757                                 dataVolume.Name, "snapshot class", snapshotClass.Name)
 758                         return snapshotClass.Name, nil
 759                 }
~~~
 
Since they will be having different parameters like poolID, the VolumeSnapshotClass of one SC doesn't work with the other and the snapshot will fail.


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

OpenShift Virtualization   4.13.1

How reproducible:

100% 

Steps to Reproduce:

The issue is always reproducible for the customer. It can be also reproducible in a lab environment by creating a dummy VolumeSnapshotClass for any existing storage class where it will pick one among them while creating the snapshot.

Actual results:

The "snapshot" clone-strategy may not choose the correct VolumeSnapshotClass if there are multiple VolumeSnapshotClasses with the same driver

Expected results:

Ability to detect the correct VolumeSnapshotClass if there are multiple VolumeSnapshotClasses with the same driver. Maybe allow the user to configure the VolumeSnapshotClasses in the StorageProfile?

Additional info:


Note You need to log in before you can comment on or make changes to this bug.