Skip to content

Commit

Permalink
feat: support v2 backing image
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 6341

Signed-off-by: Jack Lin <[email protected]>
  • Loading branch information
ChanYiLin committed Nov 29, 2024
1 parent 612db95 commit 3a7756a
Show file tree
Hide file tree
Showing 143 changed files with 5,503 additions and 14,141 deletions.
2 changes: 1 addition & 1 deletion api/backingimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s *Server) BackingImageCreate(rw http.ResponseWriter, req *http.Request) e
return err
}

bi, err := s.m.CreateBackingImage(input.Name, input.ExpectedChecksum, input.SourceType, input.Parameters, input.MinNumberOfCopies, input.NodeSelector, input.DiskSelector, input.Secret, input.SecretNamespace)
bi, err := s.m.CreateBackingImage(input.Name, input.ExpectedChecksum, input.SourceType, input.Parameters, input.MinNumberOfCopies, input.NodeSelector, input.DiskSelector, input.Secret, input.SecretNamespace, input.DataEngine)
if err != nil {
return errors.Wrapf(err, "failed to create backing image %v from source type %v with parameters %+v", input.Name, input.SourceType, input.Parameters)
}
Expand Down
2 changes: 2 additions & 0 deletions api/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ type BackingImage struct {
NodeSelector []string `json:"nodeSelector"`
MinNumberOfCopies int `json:"minNumberOfCopies"`
ExpectedChecksum string `json:"expectedChecksum"`
DataEngine string `json:"dataEngine"`

DiskFileStatusMap map[string]longhorn.BackingImageDiskFileStatus `json:"diskFileStatusMap"`
Size int64 `json:"size"`
Expand Down Expand Up @@ -2011,6 +2012,7 @@ func toBackingImageResource(bi *longhorn.BackingImage, apiContext *api.ApiContex
MinNumberOfCopies: bi.Spec.MinNumberOfCopies,
NodeSelector: bi.Spec.NodeSelector,
DiskSelector: bi.Spec.DiskSelector,
DataEngine: string(bi.Spec.DataEngine),

DiskFileStatusMap: diskFileStatusMap,
Size: bi.Status.Size,
Expand Down
4 changes: 3 additions & 1 deletion client/generated_backing_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ type BackingImage struct {

CurrentChecksum string `json:"currentChecksum,omitempty" yaml:"current_checksum,omitempty"`

DataEngine string `json:"dataEngine,omitempty" yaml:"data_engine,omitempty"`

DeletionTimestamp string `json:"deletionTimestamp,omitempty" yaml:"deletion_timestamp,omitempty"`

DiskFileStatusMap map[string]BackingImageDiskFileStatus `json:"diskFileStatusMap,omitempty" yaml:"disk_file_status_map,omitempty"`
Expand All @@ -27,7 +29,7 @@ type BackingImage struct {

Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`

SecretNamespace string `json:"secretNamespace,omitempty" yaml:"secretNamespace,omitempty"`
SecretNamespace string `json:"secretNamespace,omitempty" yaml:"secret_namespace,omitempty"`

Size int64 `json:"size,omitempty" yaml:"size,omitempty"`

Expand Down
2 changes: 2 additions & 0 deletions client/generated_backing_image_disk_file_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const (
type BackingImageDiskFileStatus struct {
Resource `yaml:"-"`

DataEngine string `json:"dataEngine,omitempty" yaml:"data_engine,omitempty"`

LastStateTransitionTime string `json:"lastStateTransitionTime,omitempty" yaml:"last_state_transition_time,omitempty"`

Message string `json:"message,omitempty" yaml:"message,omitempty"`
Expand Down
Loading

0 comments on commit 3a7756a

Please sign in to comment.