Skip to content

Commit

Permalink
fix: allow cancellation of volume expansion when e.Status.CurrentSize…
Browse files Browse the repository at this point in the history
… 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 <derek.su@suse.com>
  • Loading branch information
derekbit committed Sep 16, 2024
1 parent b393140 commit ade76d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controller/volume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit ade76d6

Please sign in to comment.