Browse Source

Add logging for the original message

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
Hongbin Lu 10 months ago
parent
commit
2f38e07a38
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      kuryr/lib/binding/drivers/veth.py

+ 6
- 0
kuryr/lib/binding/drivers/veth.py View File

@@ -15,6 +15,7 @@ import pyroute2
15 15
 
16 16
 from oslo_concurrency import processutils
17 17
 from oslo_config import cfg
18
+from oslo_log import log
18 19
 from oslo_utils import excutils
19 20
 
20 21
 from kuryr.lib.binding.drivers import utils
@@ -24,6 +25,7 @@ from kuryr.lib import utils as lib_utils
24 25
 
25 26
 
26 27
 KIND = 'veth'
28
+LOG = log.getLogger(__name__)
27 29
 
28 30
 
29 31
 def 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 67
                 fixed_ips=port.get(utils.FIXED_IP_KEY),
66 68
                 mtu=mtu, hwaddr=port[utils.MAC_ADDRESS_KEY].lower())
67 69
     except pyroute2.CreateException:
70
+        LOG.exception("Error happened during virtual device creation")
68 71
         raise exceptions.VethCreationFailure(
69 72
             'Virtual device creation failed.')
70 73
     except pyroute2.CommitException:
74
+        LOG.exception("Error happened during configuring the container "
75
+                      "virtual device networking")
71 76
         raise exceptions.VethCreationFailure(
72 77
             'Could not configure the container virtual device networking.')
73 78
 
@@ -113,6 +118,7 @@ def port_unbind(endpoint_id, neutron_port, **kwargs):
113 118
     try:
114 119
         utils.remove_device(ifname)
115 120
     except pyroute2.NetlinkError:
121
+        LOG.exception("Error happened during deleting the veth pair")
116 122
         raise exceptions.VethDeletionFailure(
117 123
             'Deleting the veth pair failed.')
118 124
     return (stdout, stderr)

Loading…
Cancel
Save