From e0e600d715df4361d5a5c61842894e0ddb33e70c Mon Sep 17 00:00:00 2001 From: Lyndon-Li Date: Wed, 9 Sep 2026 16:09:08 +0800 Subject: [PATCH] save source size for PVB Signed-off-by: Lyndon-Li --- internal/volume/volumes_information.go | 4 ++++ pkg/apis/velero/v1/pod_volume_backup_types.go | 4 ++++ pkg/controller/pod_volume_backup_controller.go | 1 + 3 files changed, 9 insertions(+) diff --git a/internal/volume/volumes_information.go b/internal/volume/volumes_information.go index cada725e2..c5af900cb 100644 --- a/internal/volume/volumes_information.go +++ b/internal/volume/volumes_information.go @@ -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, diff --git a/pkg/apis/velero/v1/pod_volume_backup_types.go b/pkg/apis/velero/v1/pod_volume_backup_types.go index c4b7f879c..559d784f5 100644 --- a/pkg/apis/velero/v1/pod_volume_backup_types.go +++ b/pkg/apis/velero/v1/pod_volume_backup_types.go @@ -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 diff --git a/pkg/controller/pod_volume_backup_controller.go b/pkg/controller/pod_volume_backup_controller.go index c4e68ce33..80d0f2fff 100644 --- a/pkg/controller/pod_volume_backup_controller.go +++ b/pkg/controller/pod_volume_backup_controller.go @@ -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" }