diff --git a/vmdk_plugin/plugin.go b/vmdk_plugin/plugin.go index b0d1f0a64..84b984271 100644 --- a/vmdk_plugin/plugin.go +++ b/vmdk_plugin/plugin.go @@ -249,10 +249,10 @@ func (d *vmdkDriver) Create(r volume.Request) volume.Response { if err != nil { log.WithFields(log.Fields{"name": r.Name, "error": err}).Error("Attach volume failed, removing the volume ") - err = d.ops.Remove(r.Name, nil) - if err != nil { - log.WithFields(log.Fields{"name": r.Name, "error": err}).Error("Remove volume failed ") - return volume.Response{Err: err.Error()} + errRm := d.ops.Remove(r.Name, nil) + if errRm != nil { + log.WithFields(log.Fields{"name": r.Name, "error": errRm}).Error("Remove volume failed ") + return volume.Response{Err: errRm.Error()} } return volume.Response{Err: err.Error()} } @@ -261,15 +261,15 @@ func (d *vmdkDriver) Create(r volume.Request) volume.Response { if err != nil { log.WithFields(log.Fields{"name": r.Name, "error": err}).Error("Could not find attached device, removing the volume ") - err = d.ops.Detach(r.Name, nil) - if err != nil { - log.WithFields(log.Fields{"name": r.Name, "error": err}).Error("Detach volume failed ") - return volume.Response{Err: err.Error()} + errDetach := d.ops.Detach(r.Name, nil) + if errDetach != nil { + log.WithFields(log.Fields{"name": r.Name, "error": errDetach}).Error("Detach volume failed ") + return volume.Response{Err: errDetach.Error()} } - err = d.ops.Remove(r.Name, nil) - if err != nil { - log.WithFields(log.Fields{"name": r.Name, "error": err}).Error("Remove volume failed ") - return volume.Response{Err: err.Error()} + errRm := d.ops.Remove(r.Name, nil) + if errRm != nil { + log.WithFields(log.Fields{"name": r.Name, "error": errRm}).Error("Remove volume failed ") + return volume.Response{Err: errRm.Error()} } return volume.Response{Err: err.Error()} } @@ -278,15 +278,15 @@ func (d *vmdkDriver) Create(r volume.Request) volume.Response { if err != nil { log.WithFields(log.Fields{"name": r.Name, "error": err}).Error("Create filesystem failed, removing the volume ") - err = d.ops.Detach(r.Name, nil) - if err != nil { - log.WithFields(log.Fields{"name": r.Name, "error": err}).Error("Detach volume failed ") - return volume.Response{Err: err.Error()} + errDetach := d.ops.Detach(r.Name, nil) + if errDetach != nil { + log.WithFields(log.Fields{"name": r.Name, "error": errDetach}).Error("Detach volume failed ") + return volume.Response{Err: errDetach.Error()} } - err = d.ops.Remove(r.Name, nil) - if err != nil { - log.WithFields(log.Fields{"name": r.Name, "error": err}).Error("Remove volume failed ") - return volume.Response{Err: err.Error()} + errRm := d.ops.Remove(r.Name, nil) + if errRm != nil { + log.WithFields(log.Fields{"name": r.Name, "error": errRm}).Error("Remove volume failed ") + return volume.Response{Err: errRm.Error()} } return volume.Response{Err: err.Error()} }