Skip to content

Commit

Permalink
Fix spec handler and change internal name for fs format options
Browse files Browse the repository at this point in the history
Signed-off-by: Prince <[email protected]>
  • Loading branch information
ppadalia committed Dec 14, 2023
1 parent 14c3328 commit 945a3ea
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
4 changes: 4 additions & 0 deletions SDK_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Releases

### v0.174.0 - (12/12/2023)

* Fix spec handler and internal naming for fs format options

### v0.173.0 - (11/13/2023)

* Add DefragJob data structure
Expand Down
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const (
SpecExportOptionsEmpty = "empty_export_options"
SpecMountOptions = "mount_options"
// spec key cannot change due to parity with existing PSO storageclasses
SpecFaCreateOptions = "createoptions"
SpecFsFormatOptions = "createoptions"
SpecCSIMountOptions = "csi_mount_options"
SpecSharedv4MountOptions = "sharedv4_mount_options"
SpecProxyProtocolS3 = "s3"
Expand Down
8 changes: 4 additions & 4 deletions api/api.pb.go

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

2 changes: 1 addition & 1 deletion api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5628,7 +5628,7 @@ message SdkVersion {
// SDK version major value of this specification
Major = 0;
// SDK version minor value of this specification
Minor = 173;
Minor = 174;
// SDK version patch value of this specification
Patch = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion api/server/sdk/api/api.swagger.json

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

14 changes: 9 additions & 5 deletions api/spec/spec_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ var (
SpecIoThrottleRdBWRegex = regexp.MustCompile(api.SpecIoThrottleRdBW + "=([0-9]+),?")
SpecIoThrottleWrBWRegex = regexp.MustCompile(api.SpecIoThrottleWrBW + "=([0-9]+),?")
ReadaheadRegex = regexp.MustCompile(api.SpecReadahead + "=([A-Za-z]+),?")
SpecFsFormatOptionsRegex = regexp.MustCompile(api.SpecFsFormatOptions + "=([0-9A-Za-z_@:./#&+-=]+),?")
)

type specHandler struct {
Expand Down Expand Up @@ -201,10 +202,10 @@ func (d *specHandler) getVal(r *regexp.Regexp, str string) (bool, string) {

func (d *specHandler) DefaultSpec() *api.VolumeSpec {
return &api.VolumeSpec{
Format: api.FSType_FS_TYPE_EXT4,
HaLevel: 1,
IoProfile: api.IoProfile_IO_PROFILE_AUTO,
Xattr: api.Xattr_COW_ON_DEMAND,
Format: api.FSType_FS_TYPE_EXT4,
HaLevel: 1,
IoProfile: api.IoProfile_IO_PROFILE_AUTO,
Xattr: api.Xattr_COW_ON_DEMAND,
FpPreference: true,
}
}
Expand Down Expand Up @@ -545,7 +546,7 @@ func (d *specHandler) UpdateSpecFromOpts(opts map[string]string, spec *api.Volum
return nil, nil, nil, fmt.Errorf("invalid mount options format %v", v)
}
spec.MountOptions.Options = options
case api.SpecFaCreateOptions:
case api.SpecFsFormatOptions:
spec.FaCreateOptions = v
case api.SpecSharedv4MountOptions:
if spec.Sharedv4MountOptions == nil {
Expand Down Expand Up @@ -931,6 +932,9 @@ func (d *specHandler) SpecOptsFromString(
if ok, ioThrottleBW := d.getVal(SpecIoThrottleWrBWRegex, str); ok {
opts[api.SpecIoThrottleWrBW] = ioThrottleBW
}
if ok, fsFormatOptions := d.getVal(SpecFsFormatOptionsRegex, str); ok {
opts[api.SpecFsFormatOptions] = fsFormatOptions
}
return true, opts, name
}

Expand Down

0 comments on commit 945a3ea

Please sign in to comment.