Skip to content

Commit

Permalink
[PWX-36750] Removed IP format validation for Pure NFS endpoint for FBDA
Browse files Browse the repository at this point in the history
Signed-off-by: Vinayak Shinde <[email protected]>
  • Loading branch information
vinayakshnd committed May 9, 2024
1 parent 57f2ab1 commit eb09873
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 40 deletions.
1 change: 0 additions & 1 deletion SDK_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
### v0.184.0 - (04/30/2024)

* Added new `pure_nfs_endpoint_opt` field to VolumeSpecUpdate message in proto.
*

### v0.183.0 - (04/30/2024)

Expand Down
29 changes: 0 additions & 29 deletions api/server/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -1845,35 +1845,6 @@ func (vd *volAPI) VolService(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(*vsresp)
}

func (vd *volAPI) volumeBytesUsedByNode(w http.ResponseWriter, r *http.Request) {
var err error

method := "volumeBytesUsedByNode"
var req api.SdkVolumeBytesUsedRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
vd.sendError(vd.name, method, w, err.Error(), http.StatusBadRequest)
return
}
d, err := vd.getVolDriver(r)
if err != nil {
notFound(w, r)
return
}

volUtilInfo, err := d.VolumeBytesUsedByNode(req.NodeId, req.Ids)
if err != nil {
var e error
if err != nil {
e = fmt.Errorf("Failed to get volumeBytesUsedByNode: %s", err.Error())
}
vd.sendError(vd.name, method, w, e.Error(), http.StatusInternalServerError)
return
}
var result api.SdkVolumeBytesUsedResponse
result.VolUtilInfo = volUtilInfo
json.NewEncoder(w).Encode(&result)
}

func volVersion(route, version string) string {
if version == "" {
return "/" + route
Expand Down
4 changes: 0 additions & 4 deletions api/spec/spec_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package spec

import (
"fmt"
"net"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -656,9 +655,6 @@ 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
17 changes: 11 additions & 6 deletions api/spec/spec_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,18 +526,23 @@ func TestPureNFSEndpoint(t *testing.T) {
require.Equal(t, proxySpec.GetPureFileSpec().GetNfsEndpoint(), nfsEndpoint)

nfsEndpoint = ""
_, _, _, err = s.SpecFromOpts(map[string]string{
spec, _, _, 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")
require.NoError(t, err)
proxySpec = spec.GetProxySpec()
require.NotNil(t, proxySpec)
require.Equal(t, proxySpec.GetPureFileSpec().GetNfsEndpoint(), nfsEndpoint)

nfsEndpoint = "abc"
_, _, _, err = s.SpecFromOpts(map[string]string{
spec, _, _, 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")

require.NoError(t, err)
proxySpec = spec.GetProxySpec()
require.NotNil(t, proxySpec)
require.Equal(t, proxySpec.GetPureFileSpec().GetNfsEndpoint(), nfsEndpoint)
}

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

0 comments on commit eb09873

Please sign in to comment.