Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use godo action status for handling resize operation #522

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ const (
// maxVolumesPerDropletErrorMessage is the error message returned by the DO
// API when the per-droplet volume limit would be exceeded.
maxVolumesPerDropletErrorMessage = "cannot attach more than 7 volumes to a single Droplet"

// doneActionStatus is used to determine if a Digital Ocean resize action is completed.
doneActionStatus = "done"
)

var (
Expand Down Expand Up @@ -210,7 +207,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
"resized_from": int(snapshot.SizeGigaBytes),
"resized_to": int(volumeReq.SizeGigaBytes),
})
if action != nil && action.Status != doneActionStatus {
if action != nil && action.Status != godo.ActionCompleted {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timoreimann , is this action != nil necessary since we didn't get an error from the .Resize() call ?

Also, here we check for action != nil when we don't do the same check on line 1052.

It's not really related to your PR but if we could make it consistent it would be better IMO.

log = logWithAction(log, action)
log.Info("waiting until volume is resized")
if err := d.waitAction(ctx, log, vol.ID, action.ID); err != nil {
Expand Down Expand Up @@ -1052,7 +1049,7 @@ func (d *Driver) waitAction(ctx context.Context, log *logrus.Entry, volumeID str
}
log = log.WithField("action_status", action.Status)

if action.Status == godo.ActionCompleted || action.Status == doneActionStatus {
if action.Status == godo.ActionCompleted {
log.Info("action completed")
return true, nil
}
Expand Down