From 454fb36092a54611b7124dd718ee9bf183b75a0c Mon Sep 17 00:00:00 2001 From: Raunak Pradip Shah Date: Thu, 7 Apr 2022 19:24:41 +0530 Subject: [PATCH] Update code with new type logic --- pkg/common-controller/snapshot_controller.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pkg/common-controller/snapshot_controller.go b/pkg/common-controller/snapshot_controller.go index 9e07e505..2315c130 100644 --- a/pkg/common-controller/snapshot_controller.go +++ b/pkg/common-controller/snapshot_controller.go @@ -685,17 +685,10 @@ func (ctrl *csiSnapshotCommonController) createSnapshotContent(snapshot *crdv1.V } if ctrl.preventVolumeModeConversion { - volumeMode := volume.Spec.VolumeMode - if volumeMode != nil { - snapshotContent.Spec.SourceVolumeMode = new(crdv1.SourceVolumeMode) - switch *volumeMode { - case v1.PersistentVolumeBlock: - *snapshotContent.Spec.SourceVolumeMode = crdv1.SourceVolumeModeBlock - case v1.PersistentVolumeFilesystem: - *snapshotContent.Spec.SourceVolumeMode = crdv1.SourceVolumeModeFilesystem - } + if volume.Spec.VolumeMode != nil { + snapshotContent.Spec.SourceVolumeMode = volume.Spec.VolumeMode + klog.V(5).Infof("snapcontent %s has volume mode %s", snapshotContent.Name, *snapshotContent.Spec.SourceVolumeMode) } - klog.V(5).Infof("snapcontent %s has volume mode %s", snapshotContent.Name, *snapshotContent.Spec.SourceVolumeMode) } // Set AnnDeletionSecretRefName and AnnDeletionSecretRefNamespace