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) {