Skip to content

Commit

Permalink
Add lustre component count to NnfStorage/NnfNodeStorage API
Browse files Browse the repository at this point in the history
  • Loading branch information
bdevcich committed Dec 3, 2024
1 parent 822b70d commit 4b4df1f
Show file tree
Hide file tree
Showing 14 changed files with 506 additions and 168 deletions.
30 changes: 28 additions & 2 deletions api/v1alpha2/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"

nnfv1alpha4 "github.com/NearNodeFlash/nnf-sos/api/v1alpha4"
v1alpha4 "github.com/NearNodeFlash/nnf-sos/api/v1alpha4"
utilconversion "github.com/NearNodeFlash/nnf-sos/github/cluster-api/util/conversion"
)

Expand Down Expand Up @@ -343,12 +344,20 @@ func (src *NnfNodeStorage) ConvertTo(dstRaw conversion.Hub) error {

// Manually restore data.
restored := &nnfv1alpha4.NnfNodeStorage{}
if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {
hasAnno, err := utilconversion.UnmarshalData(src, restored)
if err != nil {
return err
}
// EDIT THIS FUNCTION! If the annotation is holding anything that is
// hub-specific then copy it into 'dst' from 'restored'.
// Otherwise, you may comment out UnmarshalData() until it's needed.
if hasAnno {
dst.Spec.LustreStorage.LustreComponents.MDTs = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.MDTs...)
dst.Spec.LustreStorage.LustreComponents.MGTs = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.MGTs...)
dst.Spec.LustreStorage.LustreComponents.MGTMDTs = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.MGTMDTs...)
dst.Spec.LustreStorage.LustreComponents.OSTs = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.OSTs...)
dst.Spec.LustreStorage.LustreComponents.NNFNodes = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.NNFNodes...)
}

return nil
}
Expand Down Expand Up @@ -407,12 +416,21 @@ func (src *NnfStorage) ConvertTo(dstRaw conversion.Hub) error {

// Manually restore data.
restored := &nnfv1alpha4.NnfStorage{}
if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {
hasAnno, err := utilconversion.UnmarshalData(src, restored)
if err != nil {
return err
}

// EDIT THIS FUNCTION! If the annotation is holding anything that is
// hub-specific then copy it into 'dst' from 'restored'.
// Otherwise, you may comment out UnmarshalData() until it's needed.
if hasAnno {
dst.Status.LustreComponents.MDTs = append([]string(nil), restored.Status.LustreComponents.MDTs...)
dst.Status.LustreComponents.MGTs = append([]string(nil), restored.Status.LustreComponents.MGTs...)
dst.Status.LustreComponents.MGTMDTs = append([]string(nil), restored.Status.LustreComponents.MGTMDTs...)
dst.Status.LustreComponents.OSTs = append([]string(nil), restored.Status.LustreComponents.OSTs...)
dst.Status.LustreComponents.NNFNodes = append([]string(nil), restored.Status.LustreComponents.NNFNodes...)
}

return nil
}
Expand Down Expand Up @@ -671,3 +689,11 @@ func Convert_v1alpha4_NnfAccessSpec_To_v1alpha2_NnfAccessSpec(in *nnfv1alpha4.Nn
func Convert_v1alpha4_NnfDataMovementProfileData_To_v1alpha2_NnfDataMovementProfileData(in *nnfv1alpha4.NnfDataMovementProfileData, out *NnfDataMovementProfileData, s apiconversion.Scope) error {
return autoConvert_v1alpha4_NnfDataMovementProfileData_To_v1alpha2_NnfDataMovementProfileData(in, out, s)
}

func Convert_v1alpha4_LustreStorageSpec_To_v1alpha2_LustreStorageSpec(in *v1alpha4.LustreStorageSpec, out *LustreStorageSpec, s apiconversion.Scope) error {
return autoConvert_v1alpha4_LustreStorageSpec_To_v1alpha2_LustreStorageSpec(in, out, s)
}

func Convert_v1alpha4_NnfStorageLustreStatus_To_v1alpha2_NnfStorageLustreStatus(in *v1alpha4.NnfStorageLustreStatus, out *NnfStorageLustreStatus, s apiconversion.Scope) error {
return autoConvert_v1alpha4_NnfStorageLustreStatus_To_v1alpha2_NnfStorageLustreStatus(in, out, s)
}
80 changes: 56 additions & 24 deletions api/v1alpha2/zz_generated.conversion.go

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

32 changes: 30 additions & 2 deletions api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"

nnfv1alpha4 "github.com/NearNodeFlash/nnf-sos/api/v1alpha4"
v1alpha4 "github.com/NearNodeFlash/nnf-sos/api/v1alpha4"
utilconversion "github.com/NearNodeFlash/nnf-sos/github/cluster-api/util/conversion"
)

Expand Down Expand Up @@ -342,12 +343,20 @@ func (src *NnfNodeStorage) ConvertTo(dstRaw conversion.Hub) error {

// Manually restore data.
restored := &nnfv1alpha4.NnfNodeStorage{}
if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {
hasAnno, err := utilconversion.UnmarshalData(src, restored)
if err != nil {
return err
}
// EDIT THIS FUNCTION! If the annotation is holding anything that is
// hub-specific then copy it into 'dst' from 'restored'.
// Otherwise, you may comment out UnmarshalData() until it's needed.
if hasAnno {
dst.Spec.LustreStorage.LustreComponents.MDTs = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.MDTs...)
dst.Spec.LustreStorage.LustreComponents.MGTs = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.MGTs...)
dst.Spec.LustreStorage.LustreComponents.MGTMDTs = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.MGTMDTs...)
dst.Spec.LustreStorage.LustreComponents.OSTs = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.OSTs...)
dst.Spec.LustreStorage.LustreComponents.NNFNodes = append([]string(nil), restored.Spec.LustreStorage.LustreComponents.NNFNodes...)
}

return nil
}
Expand Down Expand Up @@ -406,12 +415,21 @@ func (src *NnfStorage) ConvertTo(dstRaw conversion.Hub) error {

// Manually restore data.
restored := &nnfv1alpha4.NnfStorage{}
if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {
hasAnno, err := utilconversion.UnmarshalData(src, restored)
if err != nil {
return err
}

// EDIT THIS FUNCTION! If the annotation is holding anything that is
// hub-specific then copy it into 'dst' from 'restored'.
// Otherwise, you may comment out UnmarshalData() until it's needed.
if hasAnno {
dst.Status.LustreComponents.MDTs = append([]string(nil), restored.Status.LustreComponents.MDTs...)
dst.Status.LustreComponents.MGTs = append([]string(nil), restored.Status.LustreComponents.MGTs...)
dst.Status.LustreComponents.MGTMDTs = append([]string(nil), restored.Status.LustreComponents.MGTMDTs...)
dst.Status.LustreComponents.OSTs = append([]string(nil), restored.Status.LustreComponents.OSTs...)
dst.Status.LustreComponents.NNFNodes = append([]string(nil), restored.Status.LustreComponents.NNFNodes...)
}

return nil
}
Expand Down Expand Up @@ -684,3 +702,13 @@ func Convert_v1alpha4_NnfAccessSpec_To_v1alpha3_NnfAccessSpec(in *nnfv1alpha4.Nn
func Convert_v1alpha4_NnfDataMovementProfileData_To_v1alpha3_NnfDataMovementProfileData(in *nnfv1alpha4.NnfDataMovementProfileData, out *NnfDataMovementProfileData, s apiconversion.Scope) error {
return autoConvert_v1alpha4_NnfDataMovementProfileData_To_v1alpha3_NnfDataMovementProfileData(in, out, s)
}

// Convert_v1alpha4_LustreStorageSpec_To_v1alpha3_LustreStorageSpec is an autogenerated conversion function.
func Convert_v1alpha4_LustreStorageSpec_To_v1alpha3_LustreStorageSpec(in *v1alpha4.LustreStorageSpec, out *LustreStorageSpec, s apiconversion.Scope) error {
return autoConvert_v1alpha4_LustreStorageSpec_To_v1alpha3_LustreStorageSpec(in, out, s)
}

// Convert_v1alpha4_NnfStorageLustreStatus_To_v1alpha3_NnfStorageLustreStatus is an autogenerated conversion function.
func Convert_v1alpha4_NnfStorageLustreStatus_To_v1alpha3_NnfStorageLustreStatus(in *v1alpha4.NnfStorageLustreStatus, out *NnfStorageLustreStatus, s apiconversion.Scope) error {
return autoConvert_v1alpha4_NnfStorageLustreStatus_To_v1alpha3_NnfStorageLustreStatus(in, out, s)
}
Loading

0 comments on commit 4b4df1f

Please sign in to comment.