From eb5a68319e811191a3fd16ca97e675c6be1ba76c Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Fri, 3 Jun 2016 14:16:17 +0200 Subject: [PATCH] Fix GCE attacher/detacher to ignore return value of failed calls. The plugin should ignore any return value if err is set. --- pkg/volume/gce_pd/attacher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/volume/gce_pd/attacher.go b/pkg/volume/gce_pd/attacher.go index 060ace5528a..287aced41a8 100644 --- a/pkg/volume/gce_pd/attacher.go +++ b/pkg/volume/gce_pd/attacher.go @@ -76,7 +76,7 @@ func (attacher *gcePersistentDiskAttacher) Attach(spec *volume.Spec, hostName st pdName, hostName, err) } - if attached { + if err == nil && attached { // Volume is already attached to node. glog.Infof("Attach operation is successful. PD %q is already attached to node %q.", pdName, hostName) return nil @@ -198,7 +198,7 @@ func (detacher *gcePersistentDiskDetacher) Detach(deviceMountPath string, hostNa pdName, hostName, err) } - if !attached { + if err == nil && !attached { // Volume is not attached to node. Success! glog.Infof("Detach operation is successful. PD %q was not attached to node %q.", pdName, hostName) return nil