Skip to content

Commit

Permalink
Merge pull request #38 from digitalocean/small-improvements
Browse files Browse the repository at this point in the history
controller: add logs to catch some weird issues
  • Loading branch information
fatih authored Jun 8, 2018
2 parents 362ace8 + 2132edb commit 76b8455
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.Controlle
if err != nil {
// don't do anything if attached
if (resp != nil && resp.StatusCode == http.StatusUnprocessableEntity) || strings.Contains(err.Error(), "This volume is already attached") {
ll.WithFields(logrus.Fields{
"error": err,
"resp": resp,
}).Warn("assuming volume is attached already")
return &csi.ControllerPublishVolumeResponse{}, nil
}
return nil, err
Expand Down Expand Up @@ -229,6 +233,10 @@ func (d *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.Control
action, resp, err := d.doClient.StorageActions.DetachByDropletID(ctx, req.VolumeId, dropletID)
if err != nil {
if (resp != nil && resp.StatusCode == http.StatusUnprocessableEntity) || strings.Contains(err.Error(), "Attachment not found") {
ll.WithFields(logrus.Fields{
"error": err,
"resp": resp,
}).Warn("assuming volume is detached already")
return &csi.ControllerUnpublishVolumeResponse{}, nil
}
return nil, err
Expand Down

0 comments on commit 76b8455

Please sign in to comment.