Skip to content

Commit

Permalink
[PWX-36749] Bumped up SDK version and added NFS
Browse files Browse the repository at this point in the history
endpoint IP format validation

Signed-off-by: Vinayak Shinde <[email protected]>
  • Loading branch information
vinayakshnd committed Apr 16, 2024
1 parent e006f0e commit 96aaf79
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 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.182.0 - (04/16/2024)

* Added NFS Endpoint in volume spec

### v0.181.0 - (03/20/2024)

* Add servers and APIs for defrag and schedule services
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 @@ -5850,7 +5850,7 @@ message SdkVersion {
// SDK version major value of this specification
Major = 0;
// SDK version minor value of this specification
Minor = 181;
Minor = 182;
// 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.

4 changes: 4 additions & 0 deletions api/spec/spec_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package spec

import (
"fmt"
"net"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -655,6 +656,9 @@ func (d *specHandler) UpdateSpecFromOpts(opts map[string]string, spec *api.Volum
if spec.ProxySpec.PureFileSpec == nil {
spec.ProxySpec.PureFileSpec = &api.PureFileSpec{}
}
if net.ParseIP(v) == nil {
return nil, nil, nil, fmt.Errorf("invalid Pure NFS endpoint: %v", v)
}
spec.ProxySpec.PureFileSpec.NfsEndpoint = v
case api.SpecIoThrottleRdIOPS:
if spec.IoThrottle == nil {
Expand Down
16 changes: 15 additions & 1 deletion api/spec/spec_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,21 @@ func TestPureNFSEndpoint(t *testing.T) {
require.NoError(t, err)
proxySpec := spec.GetProxySpec()
require.NotNil(t, proxySpec)
require.Equal(t, proxySpec.GetPureFileSpec().GetNFSEndpoint(), nfsEndpoint)
require.Equal(t, proxySpec.GetPureFileSpec().GetNfsEndpoint(), nfsEndpoint)

nfsEndpoint = ""
_, _, _, err = s.SpecFromOpts(map[string]string{
api.SpecPureNFSEnpoint: nfsEndpoint,
})
require.Error(t, err, "Failed to parse nfs endpoint parameter")
require.ErrorContains(t, err, "invalid Pure NFS endpoint")

nfsEndpoint = "abc"
_, _, _, err = s.SpecFromOpts(map[string]string{
api.SpecPureNFSEnpoint: nfsEndpoint,
})
require.Error(t, err, "Failed to parse nfs endpoint parameter")
require.ErrorContains(t, err, "invalid Pure NFS endpoint")
}

func TestXattr(t *testing.T) {
Expand Down

0 comments on commit 96aaf79

Please sign in to comment.