Skip to content

Commit d8c53c8

Browse files
committed
improve logs
1 parent 2454d9e commit d8c53c8

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

pkg/azurefile/azurefile.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -931,21 +931,18 @@ func (d *Driver) copyFileShare(ctx context.Context, req *csi.CreateVolumeRequest
931931
dstPath := fmt.Sprintf("https://%s.file.%s/%s%s", accountName, storageEndpointSuffix, dstFileShareName, accountSasToken)
932932

933933
jobState, percent, err := getAzcopyJob(dstFileShareName)
934-
switch jobState {
935-
case AzcopyJobError, AzcopyJobCompleted:
934+
klog.V(2).Infof("azcopy job status: %s, copy percent: %s%, error: %v", jobState, percent, err)
935+
if jobState == AzcopyJobError || jobState == AzcopyJobCompleted {
936936
return err
937-
case AzcopyJobRunning:
938-
klog.V(2).Infof("azcopy job is in progress, copy percent: %s%", percent)
939937
}
940938
for {
941939
select {
942940
case <-timeTick:
943941
jobState, percent, err := getAzcopyJob(dstFileShareName)
942+
klog.V(2).Infof("azcopy job status: %s, copy percent: %s%, error: %v", jobState, percent, err)
944943
switch jobState {
945944
case AzcopyJobError, AzcopyJobCompleted:
946945
return err
947-
case AzcopyJobRunning:
948-
klog.V(2).Infof("azcopy job is in progress, copy percent: %s%", percent)
949946
case AzcopyJobNotFound:
950947
klog.V(2).Infof("copy fileshare %s to %s", srcFileShareName, dstFileShareName)
951948
out, copyErr := exec.Command("azcopy", "copy", srcPath, dstPath, "--recursive", "--check-length=false").CombinedOutput()

pkg/azurefile/utils.go

-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ func getAzcopyJob(dstFileshare string) (AzcopyJobState, string, error) {
319319
klog.Warningf("failed to get azcopy job with error: %v, jobState: %v", err, jobState)
320320
return AzcopyJobError, "", fmt.Errorf("couldn't parse azcopy job show in azcopy %v", err)
321321
}
322-
klog.V(2).Infof("azcopy job is in progress, copy percent: %s%", percent)
323322
return jobState, percent, nil
324323
}
325324

@@ -344,7 +343,6 @@ func parseAzcopyJobList(joblist string, dstFileShareName string) (string, Azcopy
344343
case "InProgress":
345344
jobid = segments[0]
346345
case "Completed":
347-
klog.V(2).Infof("azcopy job is completed, copied fileshare to %s successfully", dstFileShareName)
348346
return jobid, AzcopyJobCompleted, nil
349347
}
350348
}

0 commit comments

Comments
 (0)