From 9727cd0636562a01b92f9a4d05a96da5bf2de114 Mon Sep 17 00:00:00 2001 From: tanshanshan Date: Thu, 23 Nov 2017 11:50:04 +0800 Subject: [PATCH] declare in front --- plugin/pkg/scheduler/algorithm/predicates/predicates.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/pkg/scheduler/algorithm/predicates/predicates.go b/plugin/pkg/scheduler/algorithm/predicates/predicates.go index 917b35acf51..8931814bdcd 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/predicates.go +++ b/plugin/pkg/scheduler/algorithm/predicates/predicates.go @@ -308,7 +308,8 @@ func (c *MaxPDVolumeCountChecker) filterVolumes(volumes []v1.Volume, namespace s continue } - if pvc.Spec.VolumeName == "" { + pvName := pvc.Spec.VolumeName + if pvName == "" { // PVC is not bound. It was either deleted and created again or // it was forcefuly unbound by admin. The pod can still use the // original PV where it was bound to -> log the error and count @@ -318,7 +319,6 @@ func (c *MaxPDVolumeCountChecker) filterVolumes(volumes []v1.Volume, namespace s continue } - pvName := pvc.Spec.VolumeName pv, err := c.pvInfo.GetPersistentVolumeInfo(pvName) if err != nil || pv == nil { // if the PV is not found, log the error