From 4f88d418c80eb6a395dd99e606e5f545404a17c6 Mon Sep 17 00:00:00 2001 From: markturansky Date: Fri, 22 May 2015 15:10:40 -0400 Subject: [PATCH] Added missing PV support to NFS --- pkg/volume/nfs/nfs.go | 2 +- pkg/volume/nfs/nfs_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/volume/nfs/nfs.go b/pkg/volume/nfs/nfs.go index 0c19e963b03..073518fd573 100644 --- a/pkg/volume/nfs/nfs.go +++ b/pkg/volume/nfs/nfs.go @@ -52,7 +52,7 @@ func (plugin *nfsPlugin) Name() string { } func (plugin *nfsPlugin) CanSupport(spec *volume.Spec) bool { - return spec.VolumeSource.NFS != nil + return spec.VolumeSource.NFS != nil || spec.PersistentVolumeSource.NFS != nil } func (plugin *nfsPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { diff --git a/pkg/volume/nfs/nfs_test.go b/pkg/volume/nfs/nfs_test.go index 1c66455eb28..137a9857824 100644 --- a/pkg/volume/nfs/nfs_test.go +++ b/pkg/volume/nfs/nfs_test.go @@ -39,6 +39,9 @@ func TestCanSupport(t *testing.T) { if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{NFS: &api.NFSVolumeSource{}}}) { t.Errorf("Expected true") } + if !plug.CanSupport(&volume.Spec{Name: "foo", PersistentVolumeSource: api.PersistentVolumeSource{NFS: &api.NFSVolumeSource{}}}) { + t.Errorf("Expected true") + } if plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{}}) { t.Errorf("Expected false") }