Skip to content

Commit

Permalink
feat(backup): extends backup manifest with snapshot_tag and task_id.
Browse files Browse the repository at this point in the history
This extends backup manist with snapshot_tag and task_id + small
refactoring.
  • Loading branch information
VAveryanov8 committed Dec 19, 2024
1 parent acf312c commit 164ff2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions pkg/service/backup/backupspec/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ type ManifestContent struct {
ClusterName string `json:"cluster_name"`
NodeID string `json:"node_id"`
DC string `json:"dc"`
TaskID uuid.UUID `json:"task_id"`
SnapshotTag string `json:"snapshot_tag"`
IP string `json:"ip"`
Size int64 `json:"size"`
Tokens []int64 `json:"tokens"`
Expand Down
11 changes: 6 additions & 5 deletions pkg/service/backup/worker_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ func (w *worker) createTemporaryManifest(ctx context.Context, h hostInfo, tokens
ManifestContent: ManifestContent{
Version: "v2",
ClusterName: w.ClusterName,
ClusterID: w.ClusterID,
NodeID: h.ID,
DC: h.DC,
SnapshotTag: w.SnapshotTag,
TaskID: w.TaskID,
IP: h.IP,
Tokens: tokens,
},
Expand All @@ -92,10 +97,6 @@ func (w *worker) createTemporaryManifest(ctx context.Context, h hostInfo, tokens
c.Size += d.Progress.Size
}

c.ClusterID = w.ClusterID
c.NodeID = h.ID
c.DC = h.DC

rack, err := w.Client.HostRack(ctx, h.IP)
if err != nil {
return ManifestInfoWithContent{}, errors.Wrap(err, "client.HostRack")
Expand Down Expand Up @@ -139,7 +140,7 @@ func (w *worker) manifestInstanceDetails(ctx context.Context, host hostInfo) (In
if err != nil {
// Metadata may not be available for several reasons:
// 1. running on-premise 2. disabled 3. smth went wrong with metadata server.
// As we cannot distiguish between this cases we can only log err and continue with backup.
// As we cannot distinguish between these cases, we can only log err and continue with the backup.
w.Logger.Error(ctx, "Get instance metadata", "err", err)
}
result.CloudProvider = string(instanceMeta.CloudProvider)
Expand Down

0 comments on commit 164ff2c

Please sign in to comment.