Skip to content

Commit a296d5c

Browse files
Nikhil-Ladhaphlogistonjohn
authored andcommitted
cephfs: add clone progress report in clone status
add clone progress report in clone status output Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
1 parent da1e313 commit a296d5c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

cephfs/admin/clone.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,18 @@ type CloneSource struct {
8181
Snapshot string `json:"snapshot"`
8282
}
8383

84+
// CloneProgressReport contains the progress report of a subvolume clone.
85+
type CloneProgressReport struct {
86+
PercentageCloned string `json:"percentage cloned"`
87+
AmountCloned string `json:"amount cloned"`
88+
FilesCloned string `json:"files cloned"`
89+
}
90+
8491
// CloneStatus reports on the status of a subvolume clone.
8592
type CloneStatus struct {
86-
State CloneState `json:"state"`
87-
Source CloneSource `json:"source"`
93+
State CloneState `json:"state"`
94+
Source CloneSource `json:"source"`
95+
ProgressReport CloneProgressReport `json:"progress_report"`
8896

8997
// failure can be obtained through .GetFailure()
9098
failure *CloneFailure

cephfs/admin/clone_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ var sampleCloneStatusInProg = []byte(`{
2727
"volume": "cephfs",
2828
"subvolume": "subvol1",
2929
"snapshot": "snap1"
30+
},
31+
"progress_report": {
32+
"percentage cloned": "25%",
33+
"amount cloned": "55/202",
34+
"files cloned": "1/3"
3035
}
3136
}
3237
}`)
@@ -66,6 +71,9 @@ func TestParseCloneStatus(t *testing.T) {
6671
assert.EqualValues(t, "subvol1", status.Source.SubVolume)
6772
assert.EqualValues(t, "snap1", status.Source.Snapshot)
6873
assert.EqualValues(t, "", status.Source.Group)
74+
assert.EqualValues(t, "25%", status.ProgressReport.PercentageCloned)
75+
assert.EqualValues(t, "55/202", status.ProgressReport.AmountCloned)
76+
assert.EqualValues(t, "1/3", status.ProgressReport.FilesCloned)
6977
}
7078
})
7179
}

0 commit comments

Comments
 (0)