Skip to content

Commit

Permalink
Merge pull request #1782 from maaoBit/fix-delete-error
Browse files Browse the repository at this point in the history
Fix DeleteDisk error handling in volume creation failure
  • Loading branch information
k8s-ci-robot authored Oct 13, 2023
2 parents 4f44b36 + c7f064b commit 8096deb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func (c *cloud) CreateDisk(ctx context.Context, volumeName string, diskOptions *
if err := c.waitForVolume(ctx, volumeID); err != nil {
// To avoid leaking volume, we should delete the volume just created
// TODO: Need to figure out how to handle DeleteDisk failed scenario instead of just log the error
if _, error := c.DeleteDisk(ctx, volumeID); err != nil {
if _, error := c.DeleteDisk(ctx, volumeID); error != nil {
klog.ErrorS(error, "failed to be deleted, this may cause volume leak", "volumeID", volumeID)
} else {
klog.V(5).InfoS("[Debug] volume is deleted because it is not in desired state within retry limit", "volumeID", volumeID)
Expand Down

0 comments on commit 8096deb

Please sign in to comment.