From 331d6c208a5ccc747c1eb1031fe86c6513b98875 Mon Sep 17 00:00:00 2001 From: llDrLove Date: Wed, 17 May 2023 14:56:39 -0400 Subject: [PATCH] CON-9337 fix resize logic from snapshot (#504) --- CHANGELOG.md | 2 ++ driver/controller.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0928167e..946de23a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## v4.6.1 - 2023.05.17 * Update CSI sidecars to latest [[GH-502]](https://github.com/digitalocean/csi-digitalocean/pull/502) +* Fix snapshot resizing + [[GH-504]](https://github.com/digitalocean/csi-digitalocean/pull/504) ## v4.6.0 - 2023.05.02 diff --git a/driver/controller.go b/driver/controller.go index dcb1a09a..35c93fd2 100644 --- a/driver/controller.go +++ b/driver/controller.go @@ -200,7 +200,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) return nil, status.Error(codes.Internal, err.Error()) } - if snapshot != nil && volumeReq.SizeGigaBytes > int64(snapshot.SizeGigaBytes) && volumeReq.SizeGigaBytes > 1 { + if vol.SizeGigaBytes < volumeReq.SizeGigaBytes { log.Info("resizing volume because its requested size is larger than the size of the backing snapshot") action, _, err := d.storageActions.Resize(ctx, vol.ID, int(volumeReq.SizeGigaBytes), volumeReq.Region) if err != nil {