Merge "Log stack trace when fails launching a defined domain"

This commit is contained in:
Zuul
2020-10-06 00:30:47 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 4 deletions

View File

@@ -80,7 +80,7 @@ class GuestTestCase(test.NoDBTestCase):
self.domain.createWithFlags.assert_called_once_with(
fakelibvirt.VIR_DOMAIN_START_PAUSED)
@mock.patch.object(libvirt_guest.LOG, 'error')
@mock.patch.object(libvirt_guest.LOG, 'exception')
@mock.patch.object(encodeutils, 'safe_decode')
def test_launch_exception(self, mock_safe_decode, mock_log):
fake_xml = '<test>this is a test</test>'

View File

@@ -155,9 +155,8 @@ class Guest(object):
return self._domain.createWithFlags(flags)
except Exception:
with excutils.save_and_reraise_exception():
LOG.error('Error launching a defined domain '
'with XML: %s',
self._encoded_xml, errors='ignore')
LOG.exception('Error launching a defined domain with XML: %s',
self._encoded_xml, errors='ignore')
def poweroff(self):
"""Stops a running guest."""