live-mig: Mark migration as failed on fail to schedule
In case we reach maximum retires to schedule - we want to mark the migration record as failed, since the whole operation will be aborted at that point. Change-Id: I3528e98b2dc596995556aec83bb65104b671571d Partial-bug: #1417667
This commit is contained in:
parent
2005cdfb27
commit
5a8ba1d69d
|
@ -183,6 +183,9 @@ class LiveMigrationTask(base.TaskBase):
|
|||
|
||||
retries = len(attempted_hosts) - 1
|
||||
if retries > CONF.migrate_max_retries:
|
||||
if self.migration:
|
||||
self.migration.status = 'failed'
|
||||
self.migration.save()
|
||||
msg = (_('Exceeded max scheduling retries %(max_retries)d for '
|
||||
'instance %(instance_uuid)s during live migration')
|
||||
% {'max_retries': retries,
|
||||
|
|
|
@ -425,8 +425,11 @@ class LiveMigrationTaskTestCase(test.NoDBTestCase):
|
|||
.AndRaise(exception.DestinationHypervisorTooOld)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
self.assertRaises(exception.MaxRetriesExceeded,
|
||||
self.task._find_destination)
|
||||
with mock.patch.object(self.task.migration, 'save') as save_mock:
|
||||
self.assertRaises(exception.MaxRetriesExceeded,
|
||||
self.task._find_destination)
|
||||
self.assertEqual('failed', self.task.migration.status)
|
||||
save_mock.assert_called_once_with()
|
||||
|
||||
def test_find_destination_when_runs_out_of_hosts(self):
|
||||
self.mox.StubOutWithMock(utils, 'get_image_from_system_metadata')
|
||||
|
|
Loading…
Reference in New Issue