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 committed Jul 17, 2024
1 parent e42c3c8 commit 08094c6
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 105 deletions.
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ go 1.22.0

toolchain go1.22.5

replace github.com/longhorn/types v0.0.0-20240706151541-33cb010c3544 => github.com/chanyilin/types v0.0.0-20240716081512-9303475fbf48

replace github.com/longhorn/go-common-libs v0.0.0-20240707062002-b9354601827e => github.com/chanyilin/go-common-libs v0.0.0-20240716074450-cdf55483e4fc

replace github.com/longhorn/backupstore v0.0.0-20240709004445-1cadf9073de3 => github.com/chanyilin/backupstore v0.0.0-20240716083705-c30b8fd2d973

require (
github.com/RoaringBitmap/roaring v1.9.4
github.com/golang/protobuf v1.5.4
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8 h1:SjZ2GvvOononHOpK
github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8/go.mod h1:uEyr4WpAH4hio6LFriaPkL938XnrvLpNPmQHBdrmbIE=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chanyilin/backupstore v0.0.0-20240716083705-c30b8fd2d973 h1:xhIQYJINAZgcVpclvnPBLxMCUWRs1kZ18NVwPg58Wu0=
github.com/chanyilin/backupstore v0.0.0-20240716083705-c30b8fd2d973/go.mod h1:n7cpM9QLOl1KxaTFA1t3WEtiCo3vM7KNHCWXkzmTwkE=
github.com/chanyilin/go-common-libs v0.0.0-20240716074450-cdf55483e4fc h1:t2Sumlm9ZEw6QvH1k4LF1NAjFQIT3skTp3kRXsBMBQI=
github.com/chanyilin/go-common-libs v0.0.0-20240716074450-cdf55483e4fc/go.mod h1:vX53A9KF4RHC1UTbEGouZHsZO6bwT3zk63l1hvwF5T8=
github.com/chanyilin/types v0.0.0-20240716081512-9303475fbf48 h1:9jzwp7CVYzxHy4HOp6SEUgJOiHS40KUwUZxDzbSJALU=
github.com/chanyilin/types v0.0.0-20240716081512-9303475fbf48/go.mod h1:KlJuZB8NfHchWshYxYgV9pPIxBKC04Vq05G2TfgMf7w=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down Expand Up @@ -59,16 +65,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/longhorn/backupstore v0.0.0-20240709004445-1cadf9073de3 h1:DCNyiGtXlYKMdXBm7p3l86pXEaP0klFpes+BtLYleQc=
github.com/longhorn/backupstore v0.0.0-20240709004445-1cadf9073de3/go.mod h1:IJ7rVDB0l5J8YBFgvbYRM0dCF9pLhnIToia+4PDzNqY=
github.com/longhorn/go-common-libs v0.0.0-20240707062002-b9354601827e h1:0SiyvTuovYc9kLJbjagTSxv3sOfCCU9FQJasRo7bgzU=
github.com/longhorn/go-common-libs v0.0.0-20240707062002-b9354601827e/go.mod h1:vX53A9KF4RHC1UTbEGouZHsZO6bwT3zk63l1hvwF5T8=
github.com/longhorn/longhorn-engine v1.6.0-dev-20231217.0.20240418025706-519598108463 h1:KxddgUYC9InOhe8MxfbxzOL5v9q7f5DyThxQGGKvqVw=
github.com/longhorn/longhorn-engine v1.6.0-dev-20231217.0.20240418025706-519598108463/go.mod h1:WNiZl2l51I36/c8dewxkyWd0yBA5Anznzki0knKO88U=
github.com/longhorn/sparse-tools v0.0.0-20240703010727-92451e38077a h1:+o63c0oh7ZNKeQdc0Hawfzz5vRa4LiDvLOtJYjegtnk=
github.com/longhorn/sparse-tools v0.0.0-20240703010727-92451e38077a/go.mod h1:iUJCZtOKG/9xv2rfrUAYZntFTzP5dZtvy4Kwe6dMcUc=
github.com/longhorn/types v0.0.0-20240706151541-33cb010c3544 h1:U08l+0SbxCsododsraBHB5PdXrQme3TEh9iaREhRLQs=
github.com/longhorn/types v0.0.0-20240706151541-33cb010c3544/go.mod h1:KlJuZB8NfHchWshYxYgV9pPIxBKC04Vq05G2TfgMf7w=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
Expand Down
2 changes: 2 additions & 0 deletions pkg/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type CreateBackupParameters struct {
CompressionMethod string
ConcurrentLimit int32
Labels []string
Parameters map[string]string
}

func DoBackupInit(params *CreateBackupParameters) (*backupbackingimage.BackupBackingImage, *backingimage.BackupStatus, *backupbackingimage.BackupConfig, error) {
Expand Down Expand Up @@ -71,6 +72,7 @@ func DoBackupInit(params *CreateBackupParameters) (*backupbackingimage.BackupBac
Name: params.Name,
ConcurrentLimit: params.ConcurrentLimit,
DestURL: params.DestURL,
Parameters: params.Parameters,
}
return backupBackingImage, backupStatus, backupConfig, nil
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/client/manager_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (cli *BackingImageManagerClient) Watch() (*api.BackingImageStream, error) {
return api.NewBackingImageStream(conn, cancel, stream), nil
}

func (cli *BackingImageManagerClient) BackupCreate(name, uuid, checksum, backupTargetURL string, labels, credential map[string]string, compressionMethod string, concurrentLimit int) error {
func (cli *BackingImageManagerClient) BackupCreate(name, uuid, checksum, backupTargetURL string, labels, credential map[string]string, compressionMethod string, concurrentLimit int, parameters map[string]string) error {
if name == "" || uuid == "" || checksum == "" {
return fmt.Errorf("failed to create backup backing image: missing required parameter")
}
Expand Down Expand Up @@ -269,6 +269,7 @@ func (cli *BackingImageManagerClient) BackupCreate(name, uuid, checksum, backupT
Credential: credential,
CompressionMethod: compressionMethod,
ConcurrentLimit: int32(concurrentLimit),
Parameters: parameters,
})
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/manager/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ func (m *Manager) BackupCreate(ctx context.Context, req *rpc.BackupCreateRequest
CompressionMethod: req.CompressionMethod,
ConcurrentLimit: req.ConcurrentLimit,
Labels: req.Labels,
Parameters: req.Parameters,
})
if err != nil {
return nil, errors.Wrapf(err, "failed to initialize backup %v", req.Name)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/github.com/longhorn/go-common-libs/backup/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 08094c6

Please sign in to comment.