Comment 24 for bug 1811235

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

Reviewed: https://review.opendev.org/666639
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1a11d5c7f35c17cfafc6b8ba57da88995c35b595
Submitter: Zuul
Branch: stable/stein

commit 1a11d5c7f35c17cfafc6b8ba57da88995c35b595
Author: Matt Riedemann <email address hidden>
Date: Fri Jan 25 10:55:00 2019 -0500

    Raise InstanceFaultRollback for UnableToMigrateToSelf from _prep_resize

    It is possible to cold migrate a stopped server. If, however, the
    cold migrate is scheduled to the instance's current host and the
    compute driver does not support cold migrating to the same host,
    then UnableToMigrateToSelf was being raised from _prep_resize. If
    _reschedule_resize_or_reraise re-raises that exception, then
    _error_out_instance_on_exception in prep_resize handles it and
    sets the instance vm_state to ACTIVE. This is wrong since the
    instance power state is unchanged at this point and the instance
    is actually stopped.

    This fixes the problem by wrapping UnableToMigrateToSelf in
    InstanceFaultRollback and raises that from _prep_resize, and
    _error_out_instance_on_exception is called with the initial
    vm_state (STOPPED in this case) so when _error_out_instance_on_exception
    handles the InstanceFaultRollback exception it sets the instance
    vm_state to STOPPED (what it already was) rather than ACTIVE.

    There were no existing unit tests for the UnableToMigrateToSelf
    case in _prep_resize so those are added here.

    Conflicts:
          nova/tests/unit/compute/test_compute_mgr.py

    NOTE(mriedem): The conflict is due to some unit tests from change
    I734cc01dce13f9e75a16639faf890ddb1661b7eb not being in Stein.

    Change-Id: I17543ecb572934ecc7d0bbc7a4ad2f537fa499bc
    Closes-Bug: #1811235
    (cherry picked from commit d1931ac0630415519f9c3d906caba9c83cc8162a)