Skip to content

Commit e132808

Browse files
committed
fix
1 parent e3b6c97 commit e132808

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pkg/azurefile/azurefile.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ func (d *Driver) CopyFileShare(ctx context.Context, req *csi.CreateVolumeRequest
914914
accountSasToken, err := getAccountSasToken(secrets, accountName)
915915
if err != nil || accountSasToken == "" {
916916
klog.V(2).Infof("get account sas token from secrets err: %s, generate sas token for account(%s)", err.Error(), accountName)
917-
accountSasToken, err = GenerateSASToken(accountName, accountKey, storageEndpointSuffix)
917+
accountSasToken, err = generateSASToken(accountName, accountKey, storageEndpointSuffix)
918918
if err != nil {
919919
return true, err
920920
}
@@ -929,6 +929,7 @@ func (d *Driver) CopyFileShare(ctx context.Context, req *csi.CreateVolumeRequest
929929
srcPath := fmt.Sprintf("https://%s.file.%s/%s%s", accountName, storageEndpointSuffix, srcFileShareName, accountSasToken)
930930
dstPath := fmt.Sprintf("https://%s.file.%s/%s%s", accountName, storageEndpointSuffix, dstFileShareName, accountSasToken)
931931

932+
time.Sleep(1 * time.Second)
932933
klog.V(2).Infof("copy fileshare %s to %s", srcFileShareName, dstFileShareName)
933934
out, copyErr = exec.Command("azcopy", "copy", srcPath, dstPath, "--recursive", "--check-length=false").CombinedOutput()
934935
if copyErr != nil {
@@ -942,7 +943,7 @@ func (d *Driver) CopyFileShare(ctx context.Context, req *csi.CreateVolumeRequest
942943
klog.V(2).Infof("copied fileshare %s to %s successfully", srcFileShareName, dstFileShareName)
943944
} else {
944945
klog.V(2).Infof("generate sas token for account(%s)", accountName)
945-
accountSasToken, genErr := GenerateSASToken(accountName, accountKey, storageEndpointSuffix)
946+
accountSasToken, genErr := generateSASToken(accountName, accountKey, storageEndpointSuffix)
946947
if genErr != nil {
947948
return true, genErr
948949
}
@@ -952,6 +953,7 @@ func (d *Driver) CopyFileShare(ctx context.Context, req *csi.CreateVolumeRequest
952953
srcPath := fmt.Sprintf("https://%s.file.%s/%s%s", accountName, storageEndpointSuffix, srcFileShareName, accountSasToken)
953954
dstPath := fmt.Sprintf("https://%s.file.%s/%s%s", accountName, storageEndpointSuffix, dstFileShareName, accountSasToken)
954955

956+
time.Sleep(1 * time.Second)
955957
klog.V(2).Infof("copy fileshare %s to %s", srcFileShareName, dstFileShareName)
956958
out, copyErr = exec.Command("azcopy", "copy", srcPath, dstPath, "--recursive", "--check-length=false").CombinedOutput()
957959
if copyErr != nil {

pkg/azurefile/controllerserver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ func isValidVolumeCapabilities(volCaps []*csi.VolumeCapability) error {
12211221
return nil
12221222
}
12231223

1224-
func GenerateSASToken(accountName, accountKey, storageEndpointSuffix string) (string, error) {
1224+
func generateSASToken(accountName, accountKey, storageEndpointSuffix string) (string, error) {
12251225
credential, err := service.NewSharedKeyCredential(accountName, accountKey)
12261226
if err != nil {
12271227
return "", status.Errorf(codes.Internal, fmt.Sprintf("failed to generate sas token in creating new shared key credential, accountName: %s, accountKey: %s, err: %s", accountName, accountKey, err.Error()))

0 commit comments

Comments
 (0)