Commit 14f27637 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #26777 from jsafrane/fix-attach-errors

Automatic merge from submit-queue Fix GCE attacher/detacher to ignore return value of failed calls. The plugin should ignore any return value if err is set. Found when writing unit tests in #26615 - my dummy `DiskIsAttached` returned `false, errors.New('fake error')` and the volume was **not** detached although the log message `"Error checking if PD (%q) is already attached to current node (%q). Will continue and try detach anyway."` suggested otherwise @saad-ali, PTAL @kubernetes/sig-storage
parents 15b382be eb5a6831
...@@ -76,7 +76,7 @@ func (attacher *gcePersistentDiskAttacher) Attach(spec *volume.Spec, hostName st ...@@ -76,7 +76,7 @@ func (attacher *gcePersistentDiskAttacher) Attach(spec *volume.Spec, hostName st
pdName, hostName, err) pdName, hostName, err)
} }
if attached { if err == nil && attached {
// Volume is already attached to node. // Volume is already attached to node.
glog.Infof("Attach operation is successful. PD %q is already attached to node %q.", pdName, hostName) glog.Infof("Attach operation is successful. PD %q is already attached to node %q.", pdName, hostName)
return nil return nil
...@@ -198,7 +198,7 @@ func (detacher *gcePersistentDiskDetacher) Detach(deviceMountPath string, hostNa ...@@ -198,7 +198,7 @@ func (detacher *gcePersistentDiskDetacher) Detach(deviceMountPath string, hostNa
pdName, hostName, err) pdName, hostName, err)
} }
if !attached { if err == nil && !attached {
// Volume is not attached to node. Success! // Volume is not attached to node. Success!
glog.Infof("Detach operation is successful. PD %q was not attached to node %q.", pdName, hostName) glog.Infof("Detach operation is successful. PD %q was not attached to node %q.", pdName, hostName)
return nil return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment