os_vif: fix logging of exceptions during plug/unplug

The parameters to interpolate in the log message were being
passed directly, instead of in a dict, so they were never
actually merged into the message. While fixing this, we
can also avoid manually including the exception in the
message and leave it upto python logging by simply setting
exc_info=True.

Change-Id: Ib6adb52fb331ed148a6c250fd008e9c117f4cf68
This commit is contained in:
Daniel P. Berrange 2016-06-08 13:59:53 +01:00
parent 632db7791e
commit 8adde2fcb8
1 changed files with 4 additions and 4 deletions

View File

@ -76,8 +76,8 @@ def plug(vif, instance_info):
plugin.plug(vif, instance_info)
LOG.info(_LI("Successfully plugged vif %s"), vif)
except Exception as err:
LOG.error(_LE("Failed to plug vif %(vif)s. Got error: %(err)s"),
vif=vif, err=err)
LOG.error(_LE("Failed to plug vif %(vif)s"),
{"vif": vif}, exc_info=True)
raise os_vif.exception.PlugException(vif=vif, err=err)
@ -109,8 +109,8 @@ def unplug(vif, instance_info):
plugin.unplug(vif, instance_info)
LOG.info(_LI("Successfully unplugged vif %s"), vif)
except Exception as err:
LOG.error(_LE("Failed to unplug vif %(vif)s. Got error: %(err)s"),
vif=vif, err=err)
LOG.error(_LE("Failed to unplug vif %(vif)s"),
{"vif": vif}, exc_info=True)
raise os_vif.exception.UnplugException(vif=vif, err=err)