Stop logging traceback when skipping quiesce

During snapshot of a volume-backed instance, we attempt to quiesce the
instance before doing the snapshot. If quiesce is not supported or the
qemu guest agent is not enabled, we will skip the quiesce and move on
to the snapshot.

Because quiesce is a call to nova-compute over RPC, when the libvirt
driver raises QemuGuestAgentNotEnabled, oslo.messaging will append the
full traceback to the exception message [1] for the remote caller. So,
a LOG.info(..., exp) log of the exception object will result in a log
of the full traceback. Logging of the full traceback causes confusion
for those debugging CI failures.

We would rather not log the full traceback in this case where we are
catching the exception and emitting an INFO message, so we should use
exp.format_message() instead of oslo.messaging's __str__ override.

[1] https://github.com/openstack/oslo.messaging/blob/40c25c2/oslo_messaging/_drivers/common.py#L212

Related-Bug: #1824315

Change-Id: Ibfedcb8814437c53081f5a2993ab84b25d73e557
(cherry picked from commit 66070416ab)
(cherry picked from commit 2f7b1031a9)
This commit is contained in:
melanie witt 2019-05-15 20:51:41 +00:00 committed by Lee Yarwood
parent 8e130e2be7
commit b9caf7d9c7
1 changed files with 7 additions and 2 deletions

View File

@ -3019,10 +3019,15 @@ class API(base.Base):
if strutils.bool_from_string(instance.system_metadata.get(
'image_os_require_quiesce')):
raise
else:
if isinstance(err, exception.NovaException):
LOG.info('Skipping quiescing instance: %(reason)s.',
{'reason': err},
{'reason': err.format_message()},
instance=instance)
else:
LOG.info('Skipping quiescing instance because the '
'operation is not supported by the underlying '
'compute driver.', instance=instance)
# NOTE(tasker): discovered that an uncaught exception could occur
# after the instance has been frozen. catch and thaw.
except Exception as ex: