Remove redundant call to add_instance_fault_from_exc in rebuild_instance

nova.scheduler.utils.set_vm_state_and_notify already calls
add_instance_fault_from_exc so we can remove the redundant call.

The assertion in the test_rebuild_with_image_novalidhost functional
test shows that the fault is still set on the instance.

Change-Id: I8c0074ac7953fe7f777ab23c56ccfa1c26820cc9
This commit is contained in:
Matt Riedemann 2018-01-29 14:50:37 -05:00
parent bccf26c93a
commit fa4737c009
2 changed files with 0 additions and 6 deletions

View File

@ -17,7 +17,6 @@
import contextlib
import copy
import functools
import sys
from oslo_config import cfg
from oslo_log import log as logging
@ -966,8 +965,6 @@ class ComputeTaskManager(base.Base):
'task_state': None}, ex, request_spec)
LOG.warning('Rebuild failed: %s',
six.text_type(ex), instance=instance)
compute_utils.add_instance_fault_from_exc(context,
instance, ex, sys.exc_info())
compute_utils.notify_about_instance_usage(
self.notifier, context, instance, "rebuild.scheduled")

View File

@ -1355,7 +1355,6 @@ class _BaseTaskTestCase(object):
set_vm_state_and_notify_mock.call_args[0][4]['vm_state'],
vm_states.ERROR)
self.assertFalse(rebuild_mock.called)
self.assertIn('No valid host', inst_obj.fault.message)
@mock.patch.object(conductor_manager.compute_rpcapi.ComputeAPI,
'rebuild_instance')
@ -1402,8 +1401,6 @@ class _BaseTaskTestCase(object):
exception, mock.ANY)
self.assertFalse(select_dest_mock.called)
self.assertFalse(rebuild_mock.called)
self.assertIn('ServerGroup policy is not supported',
inst_obj.fault.message)
# Assert the migration status was updated.
migration = objects.Migration.get_by_id(self.context, migration.id)