Comment 22 for bug 1811235

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

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

commit d1931ac0630415519f9c3d906caba9c83cc8162a
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.

    Change-Id: I17543ecb572934ecc7d0bbc7a4ad2f537fa499bc
    Closes-Bug: #1811235