Browse Source

Wrap L3 synchronize function in try catch

When an exception happens in synchronize thread, it will die and not
recover. Wrapping in try/catch to protect against any error. Also added
some logging to know step in processing

Change-Id: Ic0c9016daebd547ffa23408444c43849b953d98b
tags/2019.1.2
Alin Iorga 4 months ago
parent
commit
ad57fb8ab4
2 changed files with 23 additions and 13 deletions
  1. +1
    -1
      networking_arista/l3Plugin/arista_l3_driver.py
  2. +22
    -12
      networking_arista/l3Plugin/l3_arista.py

+ 1
- 1
networking_arista/l3Plugin/arista_l3_driver.py View File

@@ -178,7 +178,7 @@ class AristaL3Driver(object):
router_info['name'])
self._delete_default_gateway(router_name)
self.add_router_interface(ctx, router_info)
self._setup_default_gateway(ctx, router_info)
self._setup_default_gateway(router_info)

def update_network(self, resource, event, trigger, **kwargs):
network_info = kwargs['network']


+ 22
- 12
networking_arista/l3Plugin/l3_arista.py View File

@@ -13,6 +13,7 @@
# under the License.

import copy
import traceback

from neutron_lib.agent import topics
from neutron_lib import constants as n_const
@@ -113,20 +114,29 @@ class AristaL3SyncWorker(worker.BaseWorker):
Uses idempotent properties of EOS configuration, which means
same commands can be repeated.
"""
LOG.info(_LI('Syncing Neutron Router DB <-> EOS'))
# Update vrf creation command support if needed
self.driver._update_vrf_commands()
try:
if self._use_vrf:
self.driver._update_vrf_commands()

LOG.info(_LI('Syncing Neutron Router DB <-> EOS'))
routers, router_interfaces = self.get_routers_and_interfaces()
expected_vrfs = set()
if self._use_vrf:
expected_vrfs.update(self.driver._arista_router_name(
r['id'], r['name']) for r in routers)
expected_vlans = set(r['seg_id'] for r in router_interfaces)
if self._enable_cleanup:
self.do_cleanup(expected_vrfs, expected_vlans)
self.create_routers(routers)
self.create_router_interfaces(router_interfaces)
routers, router_interfaces = self.get_routers_and_interfaces()
expected_vrfs = set()
if self._use_vrf:
expected_vrfs.update(self.driver._arista_router_name(
r['id'], r['name']) for r in routers)
expected_vlans = set(r['seg_id'] for r in router_interfaces)
if self._enable_cleanup:
LOG.info(_LI('Syncing Neutron Router DB - cleanup'))
self.do_cleanup(expected_vrfs, expected_vlans)
LOG.info(_LI('Syncing Neutron Router DB - creating routers'))
self.create_routers(routers)
LOG.info(_LI('Syncing Neutron Router DB - creating interfaces'))
self.create_router_interfaces(router_interfaces)
LOG.info(_LI('Syncing Neutron Router DB finished'))
except Exception:
exc_str = traceback.format_exc()
LOG.error(_LE("Error during synchronize processing %s"), exc_str)

def get_vrfs(self, server):
ret = self.driver._run_eos_cmds(['show vrf'], server)


Loading…
Cancel
Save