Skip to content

Commit da516a5

Browse files
committed
Update code with new type logic
1 parent bbcabf0 commit da516a5

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

pkg/common-controller/snapshot_controller.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -685,17 +685,10 @@ func (ctrl *csiSnapshotCommonController) createSnapshotContent(snapshot *crdv1.V
685685
}
686686

687687
if ctrl.preventVolumeModeConversion {
688-
volumeMode := volume.Spec.VolumeMode
689-
if volumeMode != nil {
690-
snapshotContent.Spec.SourceVolumeMode = new(crdv1.SourceVolumeMode)
691-
switch *volumeMode {
692-
case v1.PersistentVolumeBlock:
693-
*snapshotContent.Spec.SourceVolumeMode = crdv1.SourceVolumeModeBlock
694-
case v1.PersistentVolumeFilesystem:
695-
*snapshotContent.Spec.SourceVolumeMode = crdv1.SourceVolumeModeFilesystem
696-
}
688+
if volume.Spec.VolumeMode != nil {
689+
snapshotContent.Spec.SourceVolumeMode = volume.Spec.VolumeMode
690+
klog.V(5).Infof("snapcontent %s has volume mode %s", snapshotContent.Name, *snapshotContent.Spec.SourceVolumeMode)
697691
}
698-
klog.V(5).Infof("snapcontent %s has volume mode %s", snapshotContent.Name, *snapshotContent.Spec.SourceVolumeMode)
699692
}
700693

701694
// Set AnnDeletionSecretRefName and AnnDeletionSecretRefNamespace

0 commit comments

Comments
 (0)