Skip to content

Commit

Permalink
feat(backupbackingimage): add parameters to backup backing image crea…
Browse files Browse the repository at this point in the history
…te proto

ref: longhorn/longhorn 8884

Signed-off-by: Jack Lin <jack.lin@suse.com>
  • Loading branch information
ChanYiLin authored and derekbit committed Aug 23, 2024
1 parent 436ca3a commit 7afd6aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions backupbackingimage/backupbackingimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

lhbackup "github.com/longhorn/go-common-libs/backup"

"github.com/longhorn/backupstore"
"github.com/longhorn/backupstore/common"
"github.com/longhorn/backupstore/types"
Expand All @@ -31,6 +33,8 @@ type BackupBackingImage struct {
CompressionMethod string
CreatedTime string
CompleteTime string
Secret string
SecretNamespace string

ProcessingBlocks *common.ProcessingBlocks

Expand All @@ -41,6 +45,7 @@ type BackupConfig struct {
Name string
DestURL string
ConcurrentLimit int32
Parameters map[string]string
}

type RestoreConfig struct {
Expand Down Expand Up @@ -180,6 +185,8 @@ func performBackup(bsDriver backupstore.BackupStoreDriver, config *BackupConfig,
backupBackingImage.Blocks = common.SortBackupBlocks(backupBackingImage.Blocks, backupBackingImage.Size, mappings.BlockSize)
backupBackingImage.CompleteTime = util.Now()
backupBackingImage.BlockCount = totalBlockCounts
backupBackingImage.Secret = config.Parameters[lhbackup.LonghornBackupBackingImageParameterSecret]
backupBackingImage.SecretNamespace = config.Parameters[lhbackup.LonghornBackupBackingImageParameterSecretNamespace]
if err := saveBackingImageConfig(bsDriver, backupBackingImage); err != nil {
return progress.Progress, "", err
}
Expand Down
4 changes: 4 additions & 0 deletions backupbackingimage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ type BackupInfo struct {
Checksum string
Labels map[string]string
CompressionMethod string `json:",omitempty"`
Secret string
SecretNamespace string
}

func InspectBackupBackingImage(backupURL string) (*BackupInfo, error) {
Expand Down Expand Up @@ -217,5 +219,7 @@ func fillFullBackupBackingImageInfo(backupBackingImage *BackupBackingImage, dest
Checksum: backupBackingImage.Checksum,
Labels: backupBackingImage.Labels,
CompressionMethod: backupBackingImage.CompressionMethod,
Secret: backupBackingImage.Secret,
SecretNamespace: backupBackingImage.SecretNamespace,
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/aws/aws-sdk-go v1.55.5
github.com/gammazero/workerpool v1.1.3
github.com/google/uuid v1.6.0
github.com/longhorn/go-common-libs v0.0.0-20240811024046-b6ddc3efb72e
github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f
github.com/pierrec/lz4/v4 v4.1.21
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/longhorn/go-common-libs v0.0.0-20240811024046-b6ddc3efb72e h1:cmns0zh6HMocqH7tnjFrgI8mf/h1i0bbnLznWfjQ63k=
github.com/longhorn/go-common-libs v0.0.0-20240811024046-b6ddc3efb72e/go.mod h1:Yrq49KPpchy++7Z15GrMKPkiwr5IduPboLTL99a1TGA=
github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f h1:hjqUs3WVodkzrWwlUMVsnKAlom3uohoNlhZBGLsRvQY=
github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f/go.mod h1:Qv34svr/msf6XoUwnrltNBTwMhQljbHEhb5ZKWiRdxo=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g=
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ github.com/kr/pretty
# github.com/kr/text v0.2.0
## explicit
github.com/kr/text
# github.com/longhorn/go-common-libs v0.0.0-20240811024046-b6ddc3efb72e
# github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f
## explicit; go 1.22.0
github.com/longhorn/go-common-libs/backup
# github.com/matttproud/golang_protobuf_extensions v1.0.1
Expand Down

0 comments on commit 7afd6aa

Please sign in to comment.