Fix circular reference error when live migration failed
When unexpected exception raised in live migration, the MigrationError carry another original exception in it. But when oslo.message serialize the exception, the circular reference error happended. This patch just pass the exception as unicode string into MigrationError. Change-Id: I4e449baae74bd9a15490ae7accbd2103bae90d57 Related-Bug: #1377644
This commit is contained in:
parent
af43e17f03
commit
64882d39d9
|
@ -589,7 +589,7 @@ class ComputeTaskManager(base.Base):
|
|||
' %(dest)s unexpectedly failed.'),
|
||||
{'instance_id': instance['uuid'], 'dest': destination},
|
||||
exc_info=True)
|
||||
raise exception.MigrationError(reason=ex)
|
||||
raise exception.MigrationError(reason=six.text_type(ex))
|
||||
|
||||
def build_instances(self, context, instances, image, filter_properties,
|
||||
admin_password, injected_files, requested_networks,
|
||||
|
|
|
@ -23,6 +23,7 @@ from oslo.config import cfg
|
|||
from oslo import messaging
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
|
||||
from nova.api.ec2 import ec2utils
|
||||
from nova.compute import arch
|
||||
|
@ -1743,18 +1744,19 @@ class ConductorTaskTestCase(_BaseTaskTestCase, test_compute.BaseTestCase):
|
|||
self.mox.StubOutWithMock(scheduler_utils,
|
||||
'set_vm_state_and_notify')
|
||||
|
||||
ex = IOError()
|
||||
expected_ex = IOError('fake error')
|
||||
live_migrate.execute(self.context, mox.IsA(objects.Instance),
|
||||
'destination', 'block_migration',
|
||||
'disk_over_commit').AndRaise(ex)
|
||||
'disk_over_commit').AndRaise(expected_ex)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
self.conductor = utils.ExceptionHelper(self.conductor)
|
||||
|
||||
self.assertRaises(exc.MigrationError,
|
||||
ex = self.assertRaises(exc.MigrationError,
|
||||
self.conductor.migrate_server, self.context, inst_obj,
|
||||
{'host': 'destination'}, True, False, None, 'block_migration',
|
||||
'disk_over_commit')
|
||||
self.assertEqual(ex.kwargs['reason'], six.text_type(expected_ex))
|
||||
|
||||
def test_set_vm_state_and_notify(self):
|
||||
self.mox.StubOutWithMock(scheduler_utils,
|
||||
|
|
Loading…
Reference in New Issue