Skip to content

Commit 9449337

Browse files
committed
fix volume cloning and add e2e
1 parent c1641a6 commit 9449337

File tree

3 files changed

+87
-7
lines changed

3 files changed

+87
-7
lines changed

pkg/blob/controllerserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ func (d *Driver) copyBlobContainer(authAzcopyEnv []string, srcPath string, srcAc
780780
case util.AzcopyJobNotFound:
781781
klog.V(2).Infof("copy blob container %s to %s", srcPath, dstContainerName)
782782
execFunc := func() error {
783-
cmd := exec.Command("azcopy", "copy", srcPath+srcAccountSASToken, dstPath+dstAccountSASToken, "--recursive", "--check-length=false")
783+
cmd := exec.Command("azcopy", "copy", srcPath+srcAccountSASToken, dstPath+dstAccountSASToken, "--recursive", "--check-length=false", "--s2s-preserve-access-tier=false")
784784
if len(authAzcopyEnv) > 0 {
785785
cmd.Env = append(os.Environ(), authAzcopyEnv...)
786786
}

test/e2e/dynamic_provisioning_test.go

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,4 +1001,79 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
10011001
}
10021002
test.Run(ctx, cs, ns)
10031003
})
1004+
1005+
ginkgo.It("should clone a volume from an existing NFSv3 volume to another storage class [nfs]", func(ctx ginkgo.SpecContext) {
1006+
pod := testsuites.PodDetails{
1007+
Cmd: "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data",
1008+
Volumes: []testsuites.VolumeDetails{
1009+
{
1010+
ClaimSize: "10Gi",
1011+
MountOptions: []string{
1012+
"nconnect=8",
1013+
},
1014+
VolumeMount: testsuites.VolumeMountDetails{
1015+
NameGenerate: "test-volume-",
1016+
MountPathGenerate: "/mnt/test-",
1017+
},
1018+
},
1019+
},
1020+
}
1021+
podWithClonedVolume := testsuites.PodDetails{
1022+
Cmd: "grep 'hello world' /mnt/test-1/data",
1023+
}
1024+
test := testsuites.DynamicallyProvisionedVolumeCloningTest{
1025+
CSIDriver: testDriver,
1026+
Pod: pod,
1027+
PodWithClonedVolume: podWithClonedVolume,
1028+
StorageClassParameters: map[string]string{
1029+
"skuName": "Premium_LRS",
1030+
"protocol": "nfs",
1031+
"mountPermissions": "0755",
1032+
"allowsharedkeyaccess": "true",
1033+
},
1034+
ClonedStorageClassParameters: map[string]string{
1035+
"skuName": "Standard_LRS",
1036+
"protocol": "nfs",
1037+
"mountPermissions": "0755",
1038+
"allowsharedkeyaccess": "true",
1039+
},
1040+
}
1041+
test.Run(ctx, cs, ns)
1042+
})
1043+
1044+
ginkgo.It("should clone a volume from an existing blobfuse2 volume to another storage class [fuse2]", func(ctx ginkgo.SpecContext) {
1045+
pod := testsuites.PodDetails{
1046+
Cmd: "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data",
1047+
Volumes: []testsuites.VolumeDetails{
1048+
{
1049+
ClaimSize: "10Gi",
1050+
MountOptions: []string{
1051+
"-o allow_other",
1052+
"--virtual-directory=true", // blobfuse2 mount options
1053+
},
1054+
VolumeMount: testsuites.VolumeMountDetails{
1055+
NameGenerate: "test-volume-",
1056+
MountPathGenerate: "/mnt/test-",
1057+
},
1058+
},
1059+
},
1060+
}
1061+
podWithClonedVolume := testsuites.PodDetails{
1062+
Cmd: "grep 'hello world' /mnt/test-1/data",
1063+
}
1064+
test := testsuites.DynamicallyProvisionedVolumeCloningTest{
1065+
CSIDriver: testDriver,
1066+
Pod: pod,
1067+
PodWithClonedVolume: podWithClonedVolume,
1068+
StorageClassParameters: map[string]string{
1069+
"skuName": "Standard_LRS",
1070+
"protocol": "fuse2",
1071+
},
1072+
ClonedStorageClassParameters: map[string]string{
1073+
"skuName": "Premium_LRS",
1074+
"protocol": "fuse2",
1075+
},
1076+
}
1077+
test.Run(ctx, cs, ns)
1078+
})
10041079
})

test/e2e/testsuites/dynamically_provisioned_volume_cloning_tester.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ import (
2929
// DynamicallyProvisionedVolumeCloningTest will provision required StorageClass(es), PVC(s) and Pod(s)
3030
// ClonedVolumeSize optional for when testing for cloned volume with different size to the original volume
3131
type DynamicallyProvisionedVolumeCloningTest struct {
32-
CSIDriver driver.DynamicPVTestDriver
33-
Pod PodDetails
34-
PodWithClonedVolume PodDetails
35-
ClonedVolumeSize string
36-
StorageClassParameters map[string]string
32+
CSIDriver driver.DynamicPVTestDriver
33+
Pod PodDetails
34+
PodWithClonedVolume PodDetails
35+
ClonedVolumeSize string
36+
StorageClassParameters map[string]string
37+
ClonedStorageClassParameters map[string]string
3738
}
3839

3940
func (t *DynamicallyProvisionedVolumeCloningTest) Run(ctx context.Context, client clientset.Interface, namespace *v1.Namespace) {
@@ -69,7 +70,11 @@ func (t *DynamicallyProvisionedVolumeCloningTest) Run(ctx context.Context, clien
6970
}
7071

7172
t.PodWithClonedVolume.Volumes = []VolumeDetails{clonedVolume}
72-
tpod, cleanups = t.PodWithClonedVolume.SetupWithDynamicVolumes(ctx, client, namespace, t.CSIDriver, t.StorageClassParameters)
73+
clonedStorageClassParameters := t.StorageClassParameters
74+
if t.ClonedStorageClassParameters != nil {
75+
clonedStorageClassParameters = t.ClonedStorageClassParameters
76+
}
77+
tpod, cleanups = t.PodWithClonedVolume.SetupWithDynamicVolumes(ctx, client, namespace, t.CSIDriver, clonedStorageClassParameters)
7378
for i := range cleanups {
7479
defer cleanups[i](ctx)
7580
}

0 commit comments

Comments
 (0)