save source size for PVB

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2026-09-09 16:09:08 +08:00
parent 6b549f35b3
commit e0e600d715
3 changed files with 9 additions and 0 deletions
+4
View File
@@ -280,6 +280,9 @@ type PodVolumeBackupInfo struct {
// the uploader reported no figure; a pointer to 0 means it transferred nothing.
IncrementalSize *int64 `json:"incrementalSize,omitempty"`
// The size of source volume, for backup only
SourceSize int64 `json:"sourceSize,omitempty"`
// The type of the uploader that uploads the data. The valid values are `kopia` and `restic`.
UploaderType string `json:"uploaderType"`
@@ -342,6 +345,7 @@ func newPodVolumeInfoFromPVB(pvb *velerov1api.PodVolumeBackup) *PodVolumeBackupI
SnapshotHandle: pvb.Status.SnapshotID,
Size: pvb.Status.Progress.TotalBytes,
IncrementalSize: pvb.Status.IncrementalBytes,
SourceSize: pvb.Status.SourceSize,
UploaderType: pvb.Spec.UploaderType,
VolumeName: pvb.Spec.Volume,
PodName: pvb.Spec.Pod.Name,
@@ -132,6 +132,10 @@ type PodVolumeBackupStatus struct {
// +optional
IncrementalBytes *int64 `json:"incrementalBytes,omitempty"`
// SourceSize holds the total size of the source volume.
// +optional
SourceSize int64 `json:"sourceSize,omitempty"`
// AcceptedTimestamp records the time the pod volume backup is to be prepared.
// The server's time is used for AcceptedTimestamp
// +optional
@@ -551,6 +551,7 @@ func (r *PodVolumeBackupReconciler) OnDataPathCompleted(ctx context.Context, nam
pvb.Status.SnapshotID = result.Backup.SnapshotID
pvb.Status.CompletionTimestamp = &completionTime
pvb.Status.IncrementalBytes = result.Backup.IncrementalBytes
pvb.Status.SourceSize = result.Backup.SourceSize
if result.Backup.EmptySnapshot {
pvb.Status.Message = "volume was empty so no snapshot was taken"
}