Merge pull request #8688 from markturansky/nfs_missing_pv

Fixed NFS CanSupport func for PVs
pull/6/head
Saad Ali 2015-05-26 18:48:31 -07:00
commit 8e25670c07
2 changed files with 4 additions and 1 deletions

View File

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

View File

@ -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")
}