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 28, 2024
1 parent d4f90ad commit e0449cb
Show file tree
Hide file tree
Showing 40 changed files with 12,432 additions and 7,317 deletions.
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ require (
github.com/gorilla/mux v1.8.1
github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e
github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f
github.com/longhorn/longhorn-engine v1.5.5
github.com/longhorn/longhorn-engine v1.8.0-dev-20240825
github.com/longhorn/sparse-tools v0.0.0-20240729132735-18b207e459ff
github.com/longhorn/types v0.0.0-20240725040629-473d671316c4
github.com/longhorn/types v0.0.0-20240827042720-af8f10eb57cd
github.com/pkg/errors v0.9.1
github.com/rancher/go-fibmap v0.0.0-20160418233256-5fc9f8c1ed47
github.com/sirupsen/logrus v1.9.3
Expand Down Expand Up @@ -45,6 +45,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/longhorn/go-iscsi-helper v0.0.0-20240811043302-df8de353dd58 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/go-ps v1.0.0 // indirect
github.com/moby/sys/mountinfo v0.7.1 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e h1:Kvt/BqiHKa
github.com/longhorn/backupstore v0.0.0-20240823072635-7afd6aa10d3e/go.mod h1:N4cqNhSs4VUw9aGbO2OfyiIvJL7/L53hUrNiT73UN+U=
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/longhorn/longhorn-engine v1.5.5 h1:44p9Iyp4boKSHgMAl8iD4nY/EQRnF/e7hPSmqqIqvIk=
github.com/longhorn/longhorn-engine v1.5.5/go.mod h1:/QEAmYu1ZNsKR22d8wdqssbz1ja7Yyj/GyPu8BYkTEk=
github.com/longhorn/go-iscsi-helper v0.0.0-20240811043302-df8de353dd58 h1:fzLAnCLCecoUnsSYyyo7li5GD17xckyBl/zietxz168=
github.com/longhorn/go-iscsi-helper v0.0.0-20240811043302-df8de353dd58/go.mod h1:TobRDCXmF0Ni+jz6+nLJamw3uVu+gNDZoZre1JczGwc=
github.com/longhorn/longhorn-engine v1.8.0-dev-20240825 h1:O0A7ebPjvVXXLN3r3oXYUV8D1v4qVC+6Cp/ATQstNQU=
github.com/longhorn/longhorn-engine v1.8.0-dev-20240825/go.mod h1:E1ec7ub7SNGvASDtiFHL1dXX4bhEQiroBixD2GGeRbQ=
github.com/longhorn/sparse-tools v0.0.0-20240729132735-18b207e459ff h1:gmdQDbnaGJ/zmrK+QJzSys8mH679os6i7vW/pOpRn1U=
github.com/longhorn/sparse-tools v0.0.0-20240729132735-18b207e459ff/go.mod h1:iUJCZtOKG/9xv2rfrUAYZntFTzP5dZtvy4Kwe6dMcUc=
github.com/longhorn/types v0.0.0-20240725040629-473d671316c4 h1:L2g0sIJ2fXt4BSFRYNnF6ObtKryCUFm9qLcCXHWssCk=
github.com/longhorn/types v0.0.0-20240725040629-473d671316c4/go.mod h1:KlJuZB8NfHchWshYxYgV9pPIxBKC04Vq05G2TfgMf7w=
github.com/longhorn/types v0.0.0-20240827042720-af8f10eb57cd h1:AwVxaFaxLPmyl++SyigaZZw8u+Ggun7HlcmNgNqyhjs=
github.com/longhorn/types v0.0.0-20240827042720-af8f10eb57cd/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 @@ -623,6 +623,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
201 changes: 201 additions & 0 deletions vendor/github.com/longhorn/go-iscsi-helper/LICENSE

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

Loading

0 comments on commit e0449cb

Please sign in to comment.