Skip to content

Commit abc2129

Browse files
umagnusk8s-infra-cherrypick-robot
authored andcommitted
fix volume cloning and add e2e
1 parent d55de63 commit abc2129

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
@@ -797,7 +797,7 @@ func (d *Driver) copyBlobContainer(authAzcopyEnv []string, srcPath string, srcAc
797797
case util.AzcopyJobNotFound:
798798
klog.V(2).Infof("copy blob container %s to %s", srcPath, dstContainerName)
799799
execFunc := func() error {
800-
cmd := exec.Command("azcopy", "copy", srcPath+srcAccountSASToken, dstPath+dstAccountSASToken, "--recursive", "--check-length=false")
800+
cmd := exec.Command("azcopy", "copy", srcPath+srcAccountSASToken, dstPath+dstAccountSASToken, "--recursive", "--check-length=false", "--s2s-preserve-access-tier=false")
801801
if len(authAzcopyEnv) > 0 {
802802
cmd.Env = append(os.Environ(), authAzcopyEnv...)
803803
}

test/e2e/dynamic_provisioning_test.go

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

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)