du support source size

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2026-09-04 19:49:12 +08:00
parent d0884e7ce7
commit 6c86921876
4 changed files with 16 additions and 2 deletions
@@ -177,6 +177,10 @@ type DataUploadStatus struct {
// +optional
IncrementalBytes *int64 `json:"incrementalBytes,omitempty"`
// SourceSize holds the total size of the source volume.
// +optional
SourceSize int64 `json:"sourceSize,omitempty"`
// Node is name of the node where the DataUpload is processed.
// +optional
Node string `json:"node,omitempty"`
+2
View File
@@ -514,6 +514,8 @@ func (r *DataUploadReconciler) OnDataUploadCompleted(ctx context.Context, namesp
du.Status.Phase = velerov2alpha1api.DataUploadPhaseCompleted
du.Status.SnapshotID = result.Backup.SnapshotID
du.Status.IncrementalBytes = result.Backup.IncrementalBytes
du.Status.SourceSize = result.Backup.SourceSize
du.Status.CompletionTimestamp = &metav1.Time{Time: r.Clock.Now()}
if result.Backup.EmptySnapshot {
du.Status.Message = "volume was empty so no data was upload"
+9 -2
View File
@@ -197,7 +197,7 @@ func (dp *generalDataPath) StartBackup(source AccessPoint, uploaderConfig map[st
dp.wgDataPath.Done()
}()
snapshotID, emptySnapshot, totalBytes, incrementalBytes, err := dp.uploaderProv.RunBackup(
snapshotID, emptySnapshot, totalBytes, incrementalBytes, sourceSize, err := dp.uploaderProv.RunBackup(
dp.ctx,
source.ByPath,
backupParam.RealSource,
@@ -226,7 +226,14 @@ func (dp *generalDataPath) StartBackup(source AccessPoint, uploaderConfig map[st
}
dp.callbacks.OnFailed(context.Background(), dp.namespace, dp.jobName, dataPathErr)
} else {
dp.callbacks.OnCompleted(context.Background(), dp.namespace, dp.jobName, Result{Backup: BackupResult{snapshotID, emptySnapshot, source, totalBytes, ptr.To(incrementalBytes)}})
dp.callbacks.OnCompleted(context.Background(), dp.namespace, dp.jobName, Result{Backup: BackupResult{
SnapshotID: snapshotID,
EmptySnapshot: emptySnapshot,
Source: source,
TotalBytes: totalBytes,
IncrementalBytes: ptr.To(incrementalBytes),
SourceSize: sourceSize,
}})
}
}()
+1
View File
@@ -39,6 +39,7 @@ type BackupResult struct {
// while a current mover reporting a genuine zero still serializes the key and
// unmarshals to a non-nil zero, distinguishing "measured zero" from "not measured".
IncrementalBytes *int64 `json:"incrementalBytes,omitempty"`
SourceSize int64 `json:"sourceSize,omitempty"`
}
// RestoreResult represents the result of a restore