Skip to content

[release-1.25] fix: incomplete azcopy job state during volume clone #1859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (ac *Azcopy) GetAzcopyJob(dstBlobContainer string, authAzcopyEnv []string)
klog.Warningf("failed to get azcopy job with error: %v, jobState: %v", err, jobState)
return AzcopyJobError, "", fmt.Errorf("couldn't parse azcopy job list in azcopy %v", err)
}
if jobState == AzcopyJobCompleted {
if jobState == AzcopyJobCompleted || jobState == AzcopyJobCompletedWithErrors || jobState == AzcopyJobCompletedWithSkipped || jobState == AzcopyJobCompletedWithErrorsAndSkipped {
return jobState, "100.0", err
}
if jobid == "" {
Expand Down Expand Up @@ -306,6 +306,12 @@ func parseAzcopyJobList(joblist string) (string, AzcopyJobState, error) {
jobid = segments[0]
case "Completed":
return jobid, AzcopyJobCompleted, nil
case "CompletedWithErrors":
return jobid, AzcopyJobCompletedWithErrors, nil
case "CompletedWithSkipped":
return jobid, AzcopyJobCompletedWithSkipped, nil
case "CompletedWithErrorsAndSkipped":
return jobid, AzcopyJobCompletedWithErrorsAndSkipped, nil
}
}
if jobid == "" {
Expand Down
54 changes: 54 additions & 0 deletions pkg/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,39 @@ func TestGetAzcopyJob(t *testing.T) {
expectedPercent: "100.0",
expectedErr: nil,
},
{
desc: "run exec parse azcopy job CompletedWithErrors",
listStr: "JobId: ed1c3833-eaff-fe42-71d7-513fb065a9d9\nStart Time: Monday, 07-Aug-23 03:29:54 UTC\nStatus: CompletedWithErrors\nCommand: copy https://{accountName}.file.core.windows.net/{srcFileshare}{SAStoken} https://{accountName}.file.core.windows.net/{dstFileshare}{SAStoken} --recursive --check-length=false",
listErr: nil,
enableShow: false,
showStr: "",
showErr: nil,
expectedJobState: AzcopyJobCompletedWithErrors,
expectedPercent: "100.0",
expectedErr: nil,
},
{
desc: "run exec parse azcopy job CompletedWithSkipped",
listStr: "JobId: ed1c3833-eaff-fe42-71d7-513fb065a9d9\nStart Time: Monday, 07-Aug-23 03:29:54 UTC\nStatus: CompletedWithSkipped\nCommand: copy https://{accountName}.file.core.windows.net/{srcFileshare}{SAStoken} https://{accountName}.file.core.windows.net/{dstFileshare}{SAStoken} --recursive --check-length=false",
listErr: nil,
enableShow: false,
showStr: "",
showErr: nil,
expectedJobState: AzcopyJobCompletedWithSkipped,
expectedPercent: "100.0",
expectedErr: nil,
},
{
desc: "run exec parse azcopy job CompletedWithErrorsAndSkipped",
listStr: "JobId: ed1c3833-eaff-fe42-71d7-513fb065a9d9\nStart Time: Monday, 07-Aug-23 03:29:54 UTC\nStatus: CompletedWithErrorsAndSkipped\nCommand: copy https://{accountName}.file.core.windows.net/{srcFileshare}{SAStoken} https://{accountName}.file.core.windows.net/{dstFileshare}{SAStoken} --recursive --check-length=false",
listErr: nil,
enableShow: false,
showStr: "",
showErr: nil,
expectedJobState: AzcopyJobCompletedWithErrorsAndSkipped,
expectedPercent: "100.0",
expectedErr: nil,
},
{
desc: "run exec get error in azcopy jobs show",
listStr: "JobId: ed1c3833-eaff-fe42-71d7-513fb065a9d9\nStart Time: Monday, 07-Aug-23 03:29:54 UTC\nStatus: InProgress\nCommand: copy https://{accountName}.file.core.windows.net/{srcFileshare}{SAStoken} https://{accountName}.file.core.windows.net/{dstFileshare}{SAStoken} --recursive --check-length=false",
Expand Down Expand Up @@ -535,6 +568,27 @@ func TestParseAzcopyJobList(t *testing.T) {
expectedJobState: AzcopyJobCompleted,
expectedErr: nil,
},
{
desc: "parse azcopy job CompletedWithErrors",
str: "JobId: ed1c3833-eaff-fe42-71d7-513fb065a9d9\nStart Time: Monday, 07-Aug-23 03:29:54 UTC\nStatus: CompletedWithErrors\nCommand: copy https://{accountName}.file.core.windows.net/{srcFileshare}{SAStoken} https://{accountName}.file.core.windows.net/{dstFileshare}{SAStoken} --recursive --check-length=false",
expectedJobid: "",
expectedJobState: AzcopyJobCompletedWithErrors,
expectedErr: nil,
},
{
desc: "parse azcopy job CompletedWithSkipped",
str: "JobId: ed1c3833-eaff-fe42-71d7-513fb065a9d9\nStart Time: Monday, 07-Aug-23 03:29:54 UTC\nStatus: CompletedWithSkipped\nCommand: copy https://{accountName}.file.core.windows.net/{srcFileshare}{SAStoken} https://{accountName}.file.core.windows.net/{dstFileshare}{SAStoken} --recursive --check-length=false",
expectedJobid: "",
expectedJobState: AzcopyJobCompletedWithSkipped,
expectedErr: nil,
},
{
desc: "parse azcopy job CompletedWithErrorsAndSkipped",
str: "JobId: ed1c3833-eaff-fe42-71d7-513fb065a9d9\nStart Time: Monday, 07-Aug-23 03:29:54 UTC\nStatus: CompletedWithErrorsAndSkipped\nCommand: copy https://{accountName}.file.core.windows.net/{srcFileshare}{SAStoken} https://{accountName}.file.core.windows.net/{dstFileshare}{SAStoken} --recursive --check-length=false",
expectedJobid: "",
expectedJobState: AzcopyJobCompletedWithErrorsAndSkipped,
expectedErr: nil,
},
{
desc: "parse azcopy job InProgress",
str: "JobId: ed1c3833-eaff-fe42-71d7-513fb065a9d9\nStart Time: Monday, 07-Aug-23 03:29:54 UTC\nStatus: InProgress\nCommand: copy https://{accountName}.file.core.windows.net/{srcFileshare}{SAStoken} https://{accountName}.file.core.windows.net/{dstFileshare}{SAStoken} --recursive --check-length=false",
Expand Down
Loading