Skip to content

Commit

Permalink
Merge pull request libopenstorage#2433 from libopenstorage/PWX-36749_…
Browse files Browse the repository at this point in the history
…fbda_nfs_endpoints

[PWX-36749] Added pure_nfs_endpoint to PureFileSpec volume spec
  • Loading branch information
vinayakshnd authored Apr 16, 2024
2 parents e80fd7f + 96aaf79 commit ea7b5ba
Show file tree
Hide file tree
Showing 7 changed files with 5,630 additions and 5,573 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
1 change: 1 addition & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const (
SpecBackendPureBlock = "pure_block"
SpecBackendPureFile = "pure_file"
SpecPureFileExportRules = "pure_export_rules"
SpecPureNFSEnpoint = "pure_nfs_endpoint"
SpecIoThrottleRdIOPS = "io_throttle_rd_iops"
SpecIoThrottleWrIOPS = "io_throttle_wr_iops"
SpecIoThrottleRdBW = "io_throttle_rd_bw"
Expand Down
11,152 changes: 5,581 additions & 5,571 deletions api/api.pb.go

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ message PureBlockSpec {
message PureFileSpec {
string export_rules = 1;
string full_vol_name = 2;
string nfs_endpoint = 3;
}

// ProxySpec defines how this volume will reflect an external data source.
Expand Down Expand Up @@ -5849,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
5 changes: 4 additions & 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.

12 changes: 12 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 @@ -648,6 +649,17 @@ func (d *specHandler) UpdateSpecFromOpts(opts map[string]string, spec *api.Volum
spec.ProxySpec.PureFileSpec = &api.PureFileSpec{}
}
spec.ProxySpec.PureFileSpec.ExportRules = v
case api.SpecPureNFSEnpoint:
if spec.ProxySpec == nil {
spec.ProxySpec = &api.ProxySpec{}
}
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 {
spec.IoThrottle = &api.IoThrottle{}
Expand Down
26 changes: 26 additions & 0 deletions api/spec/spec_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,32 @@ func TestPureBackendSpec(t *testing.T) {
require.Error(t, err, "Failed to parse backend parameter")
}

func TestPureNFSEndpoint(t *testing.T) {
nfsEndpoint := "10.68.101.80"
s := NewSpecHandler()
spec, _, _, err := s.SpecFromOpts(map[string]string{
api.SpecPureNFSEnpoint: nfsEndpoint,
})
require.NoError(t, err)
proxySpec := spec.GetProxySpec()
require.NotNil(t, proxySpec)
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) {
testSpecOptString(t, api.SpecCowOnDemand, "true")

Expand Down

0 comments on commit ea7b5ba

Please sign in to comment.