Skip to content
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

cephfs: add clone progress report in clone status #1036

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 10 additions & 2 deletions cephfs/admin/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,18 @@ type CloneSource struct {
Snapshot string `json:"snapshot"`
}

// CloneProgressReport contains the progress report of a subvolume clone.
type CloneProgressReport struct {
PercentageCloned string `json:"percentage cloned"`
AmountCloned string `json:"amount cloned"`
FilesCloned string `json:"files cloned"`
}

// CloneStatus reports on the status of a subvolume clone.
type CloneStatus struct {
State CloneState `json:"state"`
Source CloneSource `json:"source"`
State CloneState `json:"state"`
Source CloneSource `json:"source"`
ProgressReport CloneProgressReport `json:"progress_report"`

// failure can be obtained through .GetFailure()
failure *CloneFailure
Expand Down
8 changes: 8 additions & 0 deletions cephfs/admin/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ var sampleCloneStatusInProg = []byte(`{
"volume": "cephfs",
"subvolume": "subvol1",
"snapshot": "snap1"
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please correct the formatting/indention

"progress_report": {
"percentage cloned": "25%",
"amount cloned": "55/202",
"files cloned": "1/3"
}
}
}`)
Expand Down Expand Up @@ -66,6 +71,9 @@ func TestParseCloneStatus(t *testing.T) {
assert.EqualValues(t, "subvol1", status.Source.SubVolume)
assert.EqualValues(t, "snap1", status.Source.Snapshot)
assert.EqualValues(t, "", status.Source.Group)
assert.EqualValues(t, "25%", status.ProgressReport.PercentageCloned)
assert.EqualValues(t, "55/202", status.ProgressReport.AmountCloned)
assert.EqualValues(t, "1/3", status.ProgressReport.FilesCloned)
}
})
}
Expand Down