From 5758860b7aa00dbb1aba95baebecdfaecc46d33a Mon Sep 17 00:00:00 2001 From: Timo Reimann Date: Mon, 3 Jun 2024 22:45:51 +0200 Subject: [PATCH] Support new max-volumes-per-node error message A different message is going to be introduced soon. --- driver/controller.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/driver/controller.go b/driver/controller.go index 6cb2fda9..f44cefbb 100644 --- a/driver/controller.go +++ b/driver/controller.go @@ -64,9 +64,13 @@ const ( // Digital Ocean API. NOTE: some queries inherit the context timeout doAPITimeout = 10 * time.Second - // maxVolumesPerDropletErrorMessage is the error message returned by the DO + // maxVolumesPerDropletErrorLegacyMessage is the old error message returned by + // the DO API when the per-droplet volume limit would be exceeded. + maxVolumesPerDropletErrorLegacyMessage = "cannot attach more than 7 volumes to a single Droplet" + + // maxVolumesPerDropletErrorLegacyMessage 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" + maxVolumesPerDropletErrorMessage = "cannot attach more volumes to the Droplet" ) var ( @@ -384,7 +388,8 @@ func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.Controlle return nil, status.Errorf(codes.Aborted, "cannot attach because droplet %d has pending action for volume %q", dropletID, req.VolumeId) } - if strings.Contains(err.Error(), maxVolumesPerDropletErrorMessage) { + if strings.Contains(err.Error(), maxVolumesPerDropletErrorMessage) || + strings.Contains(err.Error(), maxVolumesPerDropletErrorLegacyMessage) { return nil, status.Errorf(codes.ResourceExhausted, err.Error()) } }