mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-29 03:22:43 +00:00
add totalSize to repo snapshot
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Add totalSize to repo snapshot operation; and pin unified repo snapshots to Kopia repository and so pin them with Velero backup lifecycle
|
||||
@@ -626,6 +626,9 @@ func (kr *kopiaRepository) SaveSnapshot(ctx context.Context, snap udmrepo.Snapsh
|
||||
Description: snap.Description,
|
||||
StartTime: fs.UTCTimestampFromTime(snap.StartTime),
|
||||
EndTime: fs.UTCTimestampFromTime(snap.EndTime),
|
||||
Stats: snapshot.Stats{
|
||||
TotalFileSize: snap.TotalSize,
|
||||
},
|
||||
RootEntry: &snapshot.DirEntry{
|
||||
Type: snapshot.EntryTypeDirectory,
|
||||
ObjectID: rootObj,
|
||||
@@ -634,9 +637,12 @@ func (kr *kopiaRepository) SaveSnapshot(ctx context.Context, snap udmrepo.Snapsh
|
||||
FileSize: snap.RootObject.Size,
|
||||
UserID: snap.RootObject.UserID,
|
||||
GroupID: snap.RootObject.GroupID,
|
||||
DirSummary: &fs.DirectorySummary{
|
||||
TotalFileSize: snap.TotalSize,
|
||||
},
|
||||
},
|
||||
Tags: snap.Tags,
|
||||
Pins: []string{"velero-pin"},
|
||||
Pins: []string{"velero-pin"}, // pins are meant to prevent snapshot from automatic expiration/deletion.
|
||||
}
|
||||
|
||||
id, err := snapshot.SaveSnapshot(ctx, kr.rawWriter, &manifest)
|
||||
@@ -663,6 +669,7 @@ func (kr *kopiaRepository) GetSnapshot(ctx context.Context, id udmrepo.ID) (udmr
|
||||
StartTime: snap.StartTime.ToTime(),
|
||||
EndTime: snap.EndTime.ToTime(),
|
||||
Tags: snap.Tags,
|
||||
TotalSize: snap.Stats.TotalFileSize,
|
||||
RootObject: udmrepo.ObjectMetadata{
|
||||
ID: udmrepo.ID(snap.RootEntry.ObjectID.String()),
|
||||
Type: udmrepo.ObjectDataTypeMetadata,
|
||||
|
||||
@@ -98,6 +98,7 @@ type Snapshot struct {
|
||||
StartTime time.Time
|
||||
EndTime time.Time
|
||||
Tags map[string]string
|
||||
TotalSize int64
|
||||
RootObject ObjectMetadata
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user