Comment 10 for bug 1749215

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/pike)

Reviewed: https://review.openstack.org/548584
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=8f6371c868625351e3b017d6b2aaaa458cd73172
Submitter: Zuul
Branch: stable/pike

commit 8f6371c868625351e3b017d6b2aaaa458cd73172
Author: Claudiu Belu <email address hidden>
Date: Sun Feb 11 10:07:52 2018 -0800

    compute: Cleans up allocations after failed resize

    During cold resize, the ComputeManager's prep_resize calls the
    rpcapi.ComputeAPI's resize_instance method, which will then do an
    RPC cast (async).

    Because the RPC cast is asynchronous, the exception branch in prep_resize
    will not be executed if the cold resize failed, the allocations will not
    be cleaned up, and the instance will not be rescheduled.

    This patch adds allocation cleanup in the resize_instance and finish_resize
    methods.

    Conflicts:
          nova/compute/manager.py
          nova/tests/functional/test_servers.py
          nova/tests/unit/compute/test_compute_mgr.py

    NOTE(mriedem): The conflicts are due to not having these changes in Pike:

      Id2f352a68f99df430d20634695be51f74db95d87

      I4f0c99bb11d921d2875737c5cfbbb866be55c37c

      Icc3ffe4037a44f4f323bec2f80d99ca226742e22

      I9bcc1605945ddc35df2288be72e194c050b8ddd9

      I7c3c95d4e0836e1af054d076aad29172574eab2c

    Because we don't have I7c3c95d4e0836e1af054d076aad29172574eab2c which
    added the _revert_allocation method, this backport has to use the
    ResourceTracker.delete_allocation_for_failed_resize method to rollback
    the *new* flavor allocation for the instance (the new flavor is the one
    being used for the resize). When we fail, we remove the new flavor
    allocation so the instance is left with it's current (old) flavor
    allocation on the source compute node. As a result, several unit tests
    must be updated to mock delete_allocation_for_failed_resize.

    Change-Id: I2d9ab06b485f76550dbbff46f79f40ff4c97d12f
    Closes-Bug: #1749215
    (cherry picked from commit caf167862dd82e98f0189c9598856de57dfa7d35)
    (cherry picked from commit 5039511840bd64151f3111d9c8d7d8a01344193b)