nova/nova/tests
Matt Riedemann 834adeae9a Rollback instance.image_ref on failed rebuild
When rebuilding and changing the image, we run the new image
through the scheduler to see if it's valid for the instance
on its current compute host. The API saves off the new image
ref on the instance before casting to conductor to run through
the scheduler. If the scheduler fails, the instance.image_ref was
not being rolled back, which meant a user could attempt the rebuild
with the same invalid image a second time and the API, seeing the
instance.image_ref hasn't changed (even though it's not the actual
backing image for the server), will bypass the scheduler and rebuild
the instance with that invalid image.

This fixes the issue by using the original image ref, passed from
API to conductor during rebuild, to reset the instance.image_ref
in the case of a failure.

Note that there are other things changed on the instance in the API
which this patch does not attempt to recover as that's a bigger
work item which likely involves substantial refactoring of the code.

Closes-Bug: #1746032

Conflicts:
      nova/conductor/manager.py

NOTE(mriedem): The conflict is due to not having change
Ibc44e3b2261b314bb92062a88ca9ee6b81298dc3 in Pike. Also, six
had to be imported in the functional test.

Change-Id: I3399a66fe9b1297cd6b0dca440145393ceaef41f
(cherry picked from commit 4a2c9a4887)
2018-01-29 14:16:53 -05:00
..
functional Rollback instance.image_ref on failed rebuild 2018-01-29 14:16:53 -05:00
live_migration/hooks nfs fix for xenial images 2017-06-07 21:04:45 +00:00
unit Set server status to ERROR if rebuild failed 2018-01-23 21:44:56 +00:00
__init__.py
fixtures.py Merge "Fix CellDatabases fixture swallowing exceptions" into stable/pike 2017-12-18 09:01:44 +00:00
uuidsentinel.py Remove redundant str typecasting 2016-09-23 12:53:34 +05:30