RequestSpec.flavor is not reverted on resize revert

Bug #1785339 reported by Matt Riedemann on 2018-08-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Medium
Matt Riedemann
Ocata
Medium
Matt Riedemann
Pike
Medium
Matt Riedemann
Queens
Medium
Matt Riedemann
Rocky
Medium
Matt Riedemann

Bug Description

When we resize a server, we update the RequestSpec.flavor because for later move operations of the server, the RequestSpec is what gets passed to the scheduler, so naturally we need the RequestSpec.flavor to match the instance.flavor after the instance is resized. That happens here:

https://github.com/openstack/nova/blob/4c37ff72e5446c835a48d569dd5a1416fcd36c71/nova/conductor/manager.py#L313

https://github.com/openstack/nova/blob/4c37ff72e5446c835a48d569dd5a1416fcd36c71/nova/conductor/manager.py#L352

However, if the resize is reverted, we don't actually rollback the RequestSpec.flavor to the previously flavor (instance.old_flavor):

https://github.com/openstack/nova/blob/4c37ff72e5446c835a48d569dd5a1416fcd36c71/nova/compute/api.py#L3322

So consider this scenario:

1. create server with flavor 1
2. resize to server 2 (VERIFY_RESIZE status); at this point the RequestSpec.flavor is 2
3. revert the resize
4. live migrate, shelve/unshelve, evacuate or cold migrate the server - the request spec passed to the scheduler will have flavor 2 rather than flavor 1 which could cause misleading scheduling failures, e.g. if flavor 2 is bigger than flavor 1 and there is no capacity for flavor 2 on any hosts, the scheduler would raise NoValidHost.

Matt Riedemann (mriedem) on 2018-08-03
Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
tags: added: starlingx

Fix proposed to branch: master
Review: https://review.openstack.org/588689

Changed in nova:
status: Triaged → In Progress

Reviewed: https://review.openstack.org/588689
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=ef3849e2da1c94df519debcb14ba15af9bd01a60
Submitter: Zuul
Branch: master

commit ef3849e2da1c94df519debcb14ba15af9bd01a60
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 3 19:11:37 2018 -0400

    Update RequestSpec.flavor on resize_revert

    Since I8abdf58a6537dd5e15a012ea37a7b48abd726579 in Newton
    we update the RequestSpec.flavor to the new flavor during
    a resize. However, if the resize is reverted, we didn't
    revert the RequestSpec.flavor to the previous flavor
    on the instance, which could cause issues later when
    moving the instance since the scheduler will get a
    RequestSpec with a flavor that doesn't match the actual
    flavor on the instance.

    This fixes the bug by updating the RequestSpec.flavor
    with instance.old_flavor on resize_revert in the API.
    Functional test wrinkles are added.

    This fix was ported from the starlingx-staging/stx-nova
    repo commit 71acfeae0.

    Change-Id: Ic6e74702f2a5b57b437f4ffdfbc86c1e34cdac7d
    Closes-Bug: #1785339

Changed in nova:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/602403
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9125fc7caf68fcecea47a3f0ac5068cf44a97821
Submitter: Zuul
Branch: stable/rocky

commit 9125fc7caf68fcecea47a3f0ac5068cf44a97821
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 3 19:11:37 2018 -0400

    Update RequestSpec.flavor on resize_revert

    Since I8abdf58a6537dd5e15a012ea37a7b48abd726579 in Newton
    we update the RequestSpec.flavor to the new flavor during
    a resize. However, if the resize is reverted, we didn't
    revert the RequestSpec.flavor to the previous flavor
    on the instance, which could cause issues later when
    moving the instance since the scheduler will get a
    RequestSpec with a flavor that doesn't match the actual
    flavor on the instance.

    This fixes the bug by updating the RequestSpec.flavor
    with instance.old_flavor on resize_revert in the API.
    Functional test wrinkles are added.

    This fix was ported from the starlingx-staging/stx-nova
    repo commit 71acfeae0.

    Change-Id: Ic6e74702f2a5b57b437f4ffdfbc86c1e34cdac7d
    Closes-Bug: #1785339
    (cherry picked from commit ef3849e2da1c94df519debcb14ba15af9bd01a60)

This issue was fixed in the openstack/nova 18.0.1 release.

Reviewed: https://review.openstack.org/602409
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f2d2a9a7c538f87775092c6cbf3b03b463cbdc2a
Submitter: Zuul
Branch: stable/queens

commit f2d2a9a7c538f87775092c6cbf3b03b463cbdc2a
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 3 19:11:37 2018 -0400

    Update RequestSpec.flavor on resize_revert

    Since I8abdf58a6537dd5e15a012ea37a7b48abd726579 in Newton
    we update the RequestSpec.flavor to the new flavor during
    a resize. However, if the resize is reverted, we didn't
    revert the RequestSpec.flavor to the previous flavor
    on the instance, which could cause issues later when
    moving the instance since the scheduler will get a
    RequestSpec with a flavor that doesn't match the actual
    flavor on the instance.

    This fixes the bug by updating the RequestSpec.flavor
    with instance.old_flavor on resize_revert in the API.
    Functional test wrinkles are added.

    This fix was ported from the starlingx-staging/stx-nova
    repo commit 71acfeae0.

    Change-Id: Ic6e74702f2a5b57b437f4ffdfbc86c1e34cdac7d
    Closes-Bug: #1785339
    (cherry picked from commit ef3849e2da1c94df519debcb14ba15af9bd01a60)
    (cherry picked from commit 9125fc7caf68fcecea47a3f0ac5068cf44a97821)

Reviewed: https://review.openstack.org/605879
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=556079a33997958d26fb7f03946998a6b06f488c
Submitter: Zuul
Branch: stable/pike

commit 556079a33997958d26fb7f03946998a6b06f488c
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 3 19:11:37 2018 -0400

    Update RequestSpec.flavor on resize_revert

    Since I8abdf58a6537dd5e15a012ea37a7b48abd726579 in Newton
    we update the RequestSpec.flavor to the new flavor during
    a resize. However, if the resize is reverted, we didn't
    revert the RequestSpec.flavor to the previous flavor
    on the instance, which could cause issues later when
    moving the instance since the scheduler will get a
    RequestSpec with a flavor that doesn't match the actual
    flavor on the instance.

    This fixes the bug by updating the RequestSpec.flavor
    with instance.old_flavor on resize_revert in the API.
    Functional test wrinkles are added.

    This fix was ported from the starlingx-staging/stx-nova
    repo commit 71acfeae0.

    Conflicts:
          nova/tests/functional/test_servers.py

    NOTE(mriedem): The conflict is due to not having change
    I40a244601e1612a87bd41cd6ad652202035a1ce4 in Pike, which
    would be difficult to backport because of change
    I89e2682c9210901cf1992dac2f9068b51f0373cd not being in
    Pike, so it's easier to just update the existing tests
    as they were in Pike.

    Change-Id: Ic6e74702f2a5b57b437f4ffdfbc86c1e34cdac7d
    Closes-Bug: #1785339
    (cherry picked from commit ef3849e2da1c94df519debcb14ba15af9bd01a60)
    (cherry picked from commit 9125fc7caf68fcecea47a3f0ac5068cf44a97821)
    (cherry picked from commit f2d2a9a7c538f87775092c6cbf3b03b463cbdc2a)

Reviewed: https://review.openstack.org/605880
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c4ea58eb867ee90785101663325a92f1d771842a
Submitter: Zuul
Branch: stable/ocata

commit c4ea58eb867ee90785101663325a92f1d771842a
Author: Matt Riedemann <email address hidden>
Date: Fri Aug 3 19:11:37 2018 -0400

    Update RequestSpec.flavor on resize_revert

    Since I8abdf58a6537dd5e15a012ea37a7b48abd726579 in Newton
    we update the RequestSpec.flavor to the new flavor during
    a resize. However, if the resize is reverted, we didn't
    revert the RequestSpec.flavor to the previous flavor
    on the instance, which could cause issues later when
    moving the instance since the scheduler will get a
    RequestSpec with a flavor that doesn't match the actual
    flavor on the instance.

    This fixes the bug by updating the RequestSpec.flavor
    with instance.old_flavor on resize_revert in the API.
    Functional test wrinkles are added.

    This fix was ported from the starlingx-staging/stx-nova
    repo commit 71acfeae0.

    Conflicts:
          nova/compute/api.py
          nova/tests/functional/test_servers.py
          nova/tests/unit/compute/test_compute_api.py

    NOTE(mriedem): The compute API conflict is due to not
    having change I9269ffa2b80e48db96c622d0dc0817738854f602
    in Ocata. The unit test conflict was due to mox->mock
    conversion in Pike. The functional test changes didn't
    even exist in Ocata because they were introduced in Pike
    with change If7b02bcd8d77e94c7fb42b721792c1391bc0e3b7
    and wouldn't apply to Ocata, so they are removed here.

    Change-Id: Ic6e74702f2a5b57b437f4ffdfbc86c1e34cdac7d
    Closes-Bug: #1785339
    (cherry picked from commit ef3849e2da1c94df519debcb14ba15af9bd01a60)
    (cherry picked from commit 9125fc7caf68fcecea47a3f0ac5068cf44a97821)
    (cherry picked from commit f2d2a9a7c538f87775092c6cbf3b03b463cbdc2a)
    (cherry picked from commit 556079a33997958d26fb7f03946998a6b06f488c)

This issue was fixed in the openstack/nova 16.1.6 release.

This issue was fixed in the openstack/nova 15.1.5 release.

This issue was fixed in the openstack/nova 17.0.7 release.

This issue was fixed in the openstack/nova 19.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers