summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHongbin Lu <hongbin034@gmail.com>2018-06-09 17:27:19 +0000
committerHongbin Lu <hongbin034@gmail.com>2018-06-09 22:07:34 +0000
commit2f38e07a38be59305c573311a04c8d4b6de5a912 (patch)
tree3643c0a5f54e7cd4059c7cdbda65fe9578b59b6b
parentce39e2aa44408d5288310f0b0cddfd21a31eb5c1 (diff)
Add logging for the original message0.8.0
On port binding/unbinding, Kuryr catches exception raised from pyroute2 and re-raise a new exception. As a result, the detailed information contained in the original exception loses. This patch adds a logging to record the original exception message and trace. Related-Bug: #1776035 Change-Id: I4b13724a460d84a2b953f750b8b88c0f60cee97d
Notes
Notes (review): Code-Review+2: Berezovsky Irena <irenab.dev@gmail.com> Code-Review+1: Liping Mao <limao@cisco.com> Code-Review+2: Daniel Mellado <dmellado@redhat.com> Workflow+1: Daniel Mellado <dmellado@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Sat, 16 Jun 2018 17:36:45 +0000 Reviewed-on: https://review.openstack.org/574042 Project: openstack/kuryr Branch: refs/heads/master
-rw-r--r--kuryr/lib/binding/drivers/veth.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/kuryr/lib/binding/drivers/veth.py b/kuryr/lib/binding/drivers/veth.py
index 5c4cedf..d0f56e3 100644
--- a/kuryr/lib/binding/drivers/veth.py
+++ b/kuryr/lib/binding/drivers/veth.py
@@ -15,6 +15,7 @@ import pyroute2
15 15
16from oslo_concurrency import processutils 16from oslo_concurrency import processutils
17from oslo_config import cfg 17from oslo_config import cfg
18from oslo_log import log
18from oslo_utils import excutils 19from oslo_utils import excutils
19 20
20from kuryr.lib.binding.drivers import utils 21from kuryr.lib.binding.drivers import utils
@@ -24,6 +25,7 @@ from kuryr.lib import utils as lib_utils
24 25
25 26
26KIND = 'veth' 27KIND = 'veth'
28LOG = log.getLogger(__name__)
27 29
28 30
29def port_bind(endpoint_id, port, subnets, network=None, vm_port=None, 31def port_bind(endpoint_id, port, subnets, network=None, vm_port=None,
@@ -65,9 +67,12 @@ def port_bind(endpoint_id, port, subnets, network=None, vm_port=None,
65 fixed_ips=port.get(utils.FIXED_IP_KEY), 67 fixed_ips=port.get(utils.FIXED_IP_KEY),
66 mtu=mtu, hwaddr=port[utils.MAC_ADDRESS_KEY].lower()) 68 mtu=mtu, hwaddr=port[utils.MAC_ADDRESS_KEY].lower())
67 except pyroute2.CreateException: 69 except pyroute2.CreateException:
70 LOG.exception("Error happened during virtual device creation")
68 raise exceptions.VethCreationFailure( 71 raise exceptions.VethCreationFailure(
69 'Virtual device creation failed.') 72 'Virtual device creation failed.')
70 except pyroute2.CommitException: 73 except pyroute2.CommitException:
74 LOG.exception("Error happened during configuring the container "
75 "virtual device networking")
71 raise exceptions.VethCreationFailure( 76 raise exceptions.VethCreationFailure(
72 'Could not configure the container virtual device networking.') 77 'Could not configure the container virtual device networking.')
73 78
@@ -113,6 +118,7 @@ def port_unbind(endpoint_id, neutron_port, **kwargs):
113 try: 118 try:
114 utils.remove_device(ifname) 119 utils.remove_device(ifname)
115 except pyroute2.NetlinkError: 120 except pyroute2.NetlinkError:
121 LOG.exception("Error happened during deleting the veth pair")
116 raise exceptions.VethDeletionFailure( 122 raise exceptions.VethDeletionFailure(
117 'Deleting the veth pair failed.') 123 'Deleting the veth pair failed.')
118 return (stdout, stderr) 124 return (stdout, stderr)