From 8c5d55c60a7367eca8ead3aaf71c97b6722737ad Mon Sep 17 00:00:00 2001 From: Vinayak Shinde Date: Tue, 23 Apr 2024 12:09:02 +0000 Subject: [PATCH] [PWX-36750] Removed IP format validation for Pure NFS endpoint for FBDA Signed-off-by: Vinayak Shinde --- api/spec/spec_handler.go | 4 ---- api/spec/spec_handler_test.go | 16 ++++++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/spec/spec_handler.go b/api/spec/spec_handler.go index 70cc95bd5..cc390151e 100644 --- a/api/spec/spec_handler.go +++ b/api/spec/spec_handler.go @@ -2,7 +2,6 @@ package spec import ( "fmt" - "net" "regexp" "strconv" "strings" @@ -608,9 +607,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 { diff --git a/api/spec/spec_handler_test.go b/api/spec/spec_handler_test.go index e24a06ebd..9bd6d9e1e 100644 --- a/api/spec/spec_handler_test.go +++ b/api/spec/spec_handler_test.go @@ -526,18 +526,22 @@ 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.Contains(t, err.Error(), "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.Contains(t, err.Error(), "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) {