diff --git a/pkg/blob/blob.go b/pkg/blob/blob.go index 702d63e617..03260db75e 100644 --- a/pkg/blob/blob.go +++ b/pkg/blob/blob.go @@ -112,6 +112,7 @@ const ( Fuse2 = "fuse2" NFS = "nfs" AZNFS = "aznfs" + NFSv3 = "nfsv3" vnetResourceGroupField = "vnetresourcegroup" vnetNameField = "vnetname" subnetNameField = "subnetname" @@ -804,7 +805,7 @@ func isSupportedContainerNamePrefix(prefix string) bool { // isNFSProtocol checks if the protocol is NFS or AZNFS func isNFSProtocol(protocol string) bool { protocol = strings.ToLower(protocol) - return protocol == NFS || protocol == AZNFS + return protocol == NFS || protocol == AZNFS || protocol == NFSv3 } // get storage account from secrets map diff --git a/pkg/blob/blob_test.go b/pkg/blob/blob_test.go index 5c503e238c..b78727760d 100644 --- a/pkg/blob/blob_test.go +++ b/pkg/blob/blob_test.go @@ -1745,8 +1745,8 @@ func TestIsNFSProtocol(t *testing.T) { expectedResult: true, }, { - protocol: "NFSv3", - expectedResult: false, + protocol: "nfsv3", + expectedResult: true, }, { protocol: "aznfs", diff --git a/pkg/blob/nodeserver.go b/pkg/blob/nodeserver.go index 94a98bdf36..8fe9dadf64 100644 --- a/pkg/blob/nodeserver.go +++ b/pkg/blob/nodeserver.go @@ -346,7 +346,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe targetPath, protocol, volumeID, attrib, mountFlags, serverAddress) mountType := AZNFS - if !d.enableAznfsMount { + if !d.enableAznfsMount || protocol == NFSv3 { mountType = NFS } diff --git a/test/e2e/dynamic_provisioning_test.go b/test/e2e/dynamic_provisioning_test.go index 679edabd73..05a09a6593 100644 --- a/test/e2e/dynamic_provisioning_test.go +++ b/test/e2e/dynamic_provisioning_test.go @@ -529,6 +529,37 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() { test.Run(ctx, cs, ns) }) + ginkgo.It("enforce with nfs mount [nfs]", func(ctx ginkgo.SpecContext) { + if isAzureStackCloud { + ginkgo.Skip("test case is not available for Azure Stack") + } + pods := []testsuites.PodDetails{ + { + Cmd: "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data", + Volumes: []testsuites.VolumeDetails{ + { + ClaimSize: "10Gi", + MountOptions: []string{ + "nconnect=8", + }, + VolumeMount: testsuites.VolumeMountDetails{ + NameGenerate: "test-volume-", + MountPathGenerate: "/mnt/test-", + }, + }, + }, + }, + } + test := testsuites.DynamicallyProvisionedCmdVolumeTest{ + CSIDriver: testDriver, + Pods: pods, + StorageClassParameters: map[string]string{ + "protocol": "nfsv3", + }, + } + test.Run(ctx, cs, ns) + }) + ginkgo.It("should create a NFSv3 volume on demand with zero mountPermissions [nfs]", func(ctx ginkgo.SpecContext) { if isAzureStackCloud { ginkgo.Skip("test case is not available for Azure Stack")