From 0b1d61db00c61a5bb685db112238b1bd15310348 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Fri, 21 Jul 2017 18:42:11 -0400 Subject: [PATCH] Fix controller crash because of nil volume spec For volumes that don't support bulk volume verifiction, a nil volume spec can cause crash of controller. --- pkg/volume/util/operationexecutor/operation_generator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index cd108dbd89d..cceabde48cf 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -115,6 +115,10 @@ func (og *operationGenerator) GenerateVolumesAreAttachedFunc( volumeSpecMap := make(map[*volume.Spec]v1.UniqueVolumeName) // Iterate each volume spec and put them into a map index by the pluginName for _, volumeAttached := range attachedVolumes { + if volumeAttached.VolumeSpec == nil { + glog.Errorf("VerifyVolumesAreAttached.GenerateVolumesAreAttachedFunc: nil spec for volume %s", volumeAttached.VolumeName) + continue + } volumePlugin, err := og.volumePluginMgr.FindPluginBySpec(volumeAttached.VolumeSpec) if err != nil || volumePlugin == nil {