Skip to content

Commit fddc554

Browse files
committed
Use existing content name
If content name is already in snapshot object, just use it. This may be the case for static provisioning. Otherwise construct new name for content for dynamic provisioning.
1 parent 799fb95 commit fddc554

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/controller/util.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ func storeObjectUpdate(store cache.Store, obj interface{}, className string) (bo
106106
// GetSnapshotContentNameForSnapshot returns SnapshotContent.Name for the create VolumeSnapshotContent.
107107
// The name must be unique.
108108
func GetSnapshotContentNameForSnapshot(snapshot *crdv1.VolumeSnapshot) string {
109+
// If VolumeSnapshot object has SnapshotContentName, use it directly.
110+
// This might be the case for static provisioning.
111+
if len(snapshot.Spec.SnapshotContentName) > 0 {
112+
return snapshot.Spec.SnapshotContentName
113+
}
114+
// Construct SnapshotContentName for dynamic provisioning.
109115
return "snapcontent-" + string(snapshot.UID)
110116
}
111117

0 commit comments

Comments
 (0)