Skip to content

changeOfferingForVolume does not reject the same custom offering and size (GiB/bytes mix-up) #14749

Open

Description

@bhouse-nexthop

problem

changeOfferingForVolume to the volume's current custom-size offering, with the same size, is not rejected.

step value
validateVolumeResizeWithNewDiskOfferingAndLoad converts the custom size from GiB to bytes
checkIfVolumeCanResizeWithNewDiskOffering compares volume.getSize() with newSize << 30, so bytes are shifted a second time
result the "Volume ... is already having disk offering ..." guard never matches for custom offerings; the request runs the full change path

versions

4.22 (the same code is on main).

The steps to reproduce the bug

  1. Create a data volume on a custom-size disk offering, 10 GiB.
  2. changeOfferingForVolume id=<vol> diskofferingid=<same offering> size=10.
  3. The call is accepted instead of being rejected as unchanged.

What to do about it?

Compare bytes with bytes. Only reject when min/max IOPS are also unchanged, so IOPS-only changes keep working, and leave compute-only offerings alone (their size is taken from the volume, and scale VM to the same custom service offering goes through this path).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions