From ef7dce7fa17b9ac7649a7f20e76cd5e488618e9b Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 25 Oct 2024 09:59:19 +0000 Subject: [PATCH] fix: reduce get file share throttling when CreateSnapshot fix filter test: skip one snapshot test --- pkg/azurefile/controllerserver.go | 4 +++- test/sanity/run-test.sh | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/azurefile/controllerserver.go b/pkg/azurefile/controllerserver.go index 42646912a2..064abf7004 100644 --- a/pkg/azurefile/controllerserver.go +++ b/pkg/azurefile/controllerserver.go @@ -1272,10 +1272,12 @@ func (d *Driver) snapshotExists(ctx context.Context, sourceVolumeID, snapshotNam } // List share snapshots. - listSnapshot, err := d.cloud.FileClient.WithSubscriptionID(subsID).ListFileShare(ctx, rgName, accountName, "", snapshotsExpand) + filter := fmt.Sprintf("startswith(name, %s)", fileShareName) + listSnapshot, err := d.cloud.FileClient.WithSubscriptionID(subsID).ListFileShare(ctx, rgName, accountName, filter, snapshotsExpand) if err != nil || listSnapshot == nil { return false, "", time.Time{}, 0, err } + klog.V(2).Infof("list snapshot of share(%s) under account(%s) rg(%s) subsID(%s) with total number(%d)", fileShareName, accountName, rgName, subsID, len(listSnapshot)) for _, share := range listSnapshot { if share.SnapshotTime == nil { //the fileshare is not a snapshot continue diff --git a/test/sanity/run-test.sh b/test/sanity/run-test.sh index 213883c037..df069c7982 100755 --- a/test/sanity/run-test.sh +++ b/test/sanity/run-test.sh @@ -54,7 +54,7 @@ sleep 1 echo 'Begin to run sanity test...' readonly CSI_SANITY_BIN='csi-sanity' -"$CSI_SANITY_BIN" --ginkgo.v --ginkgo.noColor --csi.endpoint="$endpoint" --ginkgo.skip='should fail when the volume source snapshot is not found|should work|should fail when the volume does not exist|should fail when the node does not exist|Node Service NodeGetCapabilities|should remove target path' +"$CSI_SANITY_BIN" --ginkgo.v --ginkgo.noColor --csi.endpoint="$endpoint" --ginkgo.skip='should fail when the volume source snapshot is not found|should work|should fail when the volume does not exist|should fail when the node does not exist|Node Service NodeGetCapabilities|should remove target path|should fail when requesting to create a snapshot with already existing name and different source volume ID' testvolumeparameters='/tmp/vhd.yaml' cat > $testvolumeparameters << EOF @@ -62,4 +62,4 @@ fstype: ext4 EOF echo 'Begin to run sanity test for vhd disk feature...' -"$CSI_SANITY_BIN" --ginkgo.v --ginkgo.noColor --csi.endpoint="$endpoint" --csi.testvolumeparameters="$testvolumeparameters" --ginkgo.skip='should fail when the volume source snapshot is not found|should work|should fail when volume does not exist on the specified path|should fail when the volume does not exist|should fail when the node does not exist|should be idempotent|Node Service NodeGetCapabilities|should remove target path' +"$CSI_SANITY_BIN" --ginkgo.v --ginkgo.noColor --csi.endpoint="$endpoint" --csi.testvolumeparameters="$testvolumeparameters" --ginkgo.skip='should fail when the volume source snapshot is not found|should work|should fail when volume does not exist on the specified path|should fail when the volume does not exist|should fail when the node does not exist|should be idempotent|Node Service NodeGetCapabilities|should remove target path|should fail when requesting to create a snapshot with already existing name and different source volume ID'