From ade76d6f886b9500bb6e1bbcbee56b1b7e7d7cea Mon Sep 17 00:00:00 2001 From: Derek Su Date: Mon, 16 Sep 2024 05:59:37 +0000 Subject: [PATCH] fix: allow cancellation of volume expansion when e.Status.CurrentSize is not equal to v.Spec.Size and e.Spec.VolumeSize When the volume has already been successfully expanded, if the cancellation is issued after completing the volume expansion, and the spec.size and status.currentSize of the volume and engine are as follows: - v.spec.size: 21474836480 - e.spec.size: 21474836480 - e.status.currentSize: 22548578304 The check ``` if e.Spec.VolumeSize == v.Spec.Size { return nil } ``` prevents v.Status.ExpansionRequired from becoming true, which hinders the cancellation of the expansion. Longhorn 9466 Signed-off-by: Derek Su --- controller/volume_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/volume_controller.go b/controller/volume_controller.go index b1dbdc92a6..146f63ac90 100644 --- a/controller/volume_controller.go +++ b/controller/volume_controller.go @@ -2026,7 +2026,7 @@ func (c *VolumeController) reconcileVolumeSize(v *longhorn.Volume, e *longhorn.E if e == nil || rs == nil { return nil } - if e.Spec.VolumeSize == v.Spec.Size { + if e.Spec.VolumeSize == v.Spec.Size && e.Status.CurrentSize == v.Spec.Size { return nil }