From 565c88de14ab35be16bbb51315e3b9a955bb73df Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Mon, 29 Apr 2019 14:05:06 -0700 Subject: [PATCH 1/2] Return early when node expansion is determined --- pkg/volume/csi/csi_client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/volume/csi/csi_client.go b/pkg/volume/csi/csi_client.go index 272c5eee78e..8b8fb1a6a99 100644 --- a/pkg/volume/csi/csi_client.go +++ b/pkg/volume/csi/csi_client.go @@ -688,6 +688,7 @@ func (c *csiDriverClient) NodeSupportsNodeExpand(ctx context.Context) (bool, err for _, capability := range capabilities { if capability.GetRpc().GetType() == csipbv1.NodeServiceCapability_RPC_EXPAND_VOLUME { nodeExpandSet = true + return true, nil } } return nodeExpandSet, nil From ebe499ec807d0855fe18bd06680d68789816826f Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Tue, 30 Apr 2019 06:44:27 -0700 Subject: [PATCH 2/2] Remove variable nodeExpandSet --- pkg/volume/csi/csi_client.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/volume/csi/csi_client.go b/pkg/volume/csi/csi_client.go index 8b8fb1a6a99..bc4314834e8 100644 --- a/pkg/volume/csi/csi_client.go +++ b/pkg/volume/csi/csi_client.go @@ -681,17 +681,15 @@ func (c *csiDriverClient) NodeSupportsNodeExpand(ctx context.Context) (bool, err capabilities := resp.GetCapabilities() - nodeExpandSet := false if capabilities == nil { return false, nil } for _, capability := range capabilities { if capability.GetRpc().GetType() == csipbv1.NodeServiceCapability_RPC_EXPAND_VOLUME { - nodeExpandSet = true return true, nil } } - return nodeExpandSet, nil + return false, nil } else if c.nodeV0ClientCreator != nil { return false, nil }