Add protection from pyroute crashed
It may happen that if pyroute crashed with a dump interrupted, and the exception is not properly handled, the agent will stop processing further events Change-Id: I2416393a3c45f2424aefd342380d7f9e07df9123
This commit is contained in:
parent
16a7dccefe
commit
3d45f71476
@ -195,6 +195,7 @@ class NBOVNBGPDriver(driver_api.AgentDriverBase):
|
||||
def _expose_provider_port(self, port_ips, logical_switch, bridge_device,
|
||||
bridge_vlan, proxy_cidrs=None):
|
||||
# Connect to OVN
|
||||
try:
|
||||
if wire_utils.wire_provider_port(
|
||||
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
||||
bridge_vlan, self.ovn_routing_tables, proxy_cidrs):
|
||||
@ -204,6 +205,10 @@ class NBOVNBGPDriver(driver_api.AgentDriverBase):
|
||||
self._exposed_ips.setdefault(logical_switch, {}).update(
|
||||
{ip: {'bridge_device': bridge_device,
|
||||
'bridge_vlan': bridge_vlan}})
|
||||
except Exception as e:
|
||||
LOG.exception("Unexpected exception while wiring provider port: "
|
||||
"%s", e)
|
||||
return False
|
||||
|
||||
def _withdraw_provider_port(self, port_ips, logical_switch, bridge_device,
|
||||
bridge_vlan, proxy_cidrs=None):
|
||||
@ -211,9 +216,13 @@ class NBOVNBGPDriver(driver_api.AgentDriverBase):
|
||||
bgp_utils.withdraw_ips(port_ips)
|
||||
|
||||
# Disconnect IP from OVN
|
||||
try:
|
||||
wire_utils.unwire_provider_port(
|
||||
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
||||
bridge_vlan, self.ovn_routing_tables, proxy_cidrs)
|
||||
except Exception as e:
|
||||
LOG.exception("Unexpected exception while unwiring provider port: "
|
||||
"%s", e)
|
||||
for ip in port_ips:
|
||||
if self._exposed_ips.get(logical_switch, {}).get(ip):
|
||||
self._exposed_ips[logical_switch].pop(ip)
|
||||
|
@ -317,6 +317,7 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
||||
return False
|
||||
|
||||
# Connect to OVN
|
||||
try:
|
||||
if wire_utils.wire_provider_port(
|
||||
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
||||
bridge_vlan, self.ovn_routing_tables, proxy_cidrs, lladdr):
|
||||
@ -324,6 +325,10 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
||||
bgp_utils.announce_ips(port_ips)
|
||||
return True
|
||||
return False
|
||||
except Exception as e:
|
||||
LOG.exception("Unexpected exception while wiring provider port: "
|
||||
"%s", e)
|
||||
return False
|
||||
|
||||
def _expose_tenant_port(self, port, ip_version, exposed_ips=None,
|
||||
ovn_ip_rules=None):
|
||||
@ -386,9 +391,14 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
||||
provider_datapath)
|
||||
if not bridge_device:
|
||||
return False
|
||||
try:
|
||||
return wire_utils.unwire_provider_port(
|
||||
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
||||
bridge_vlan, self.ovn_routing_tables, proxy_cidrs, lladdr)
|
||||
except Exception as e:
|
||||
LOG.exception("Unexpected exception while unwiring provider port: "
|
||||
"%s", e)
|
||||
return False
|
||||
|
||||
def _get_bridge_for_datapath(self, datapath):
|
||||
network_name, network_tag = self.sb_idl.get_network_name_and_tag(
|
||||
@ -959,11 +969,15 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
||||
cr_lrp_info['subnets_cidr'].append(ip)
|
||||
self.ovn_local_lrps.update({lrp: associated_cr_lrp})
|
||||
|
||||
try:
|
||||
if not wire_utils.wire_lrp_port(
|
||||
self.ovn_routing_tables_routes, ip, bridge_device, bridge_vlan,
|
||||
self.ovn_routing_tables, cr_lrp_ips):
|
||||
self.ovn_routing_tables_routes, ip, bridge_device,
|
||||
bridge_vlan, self.ovn_routing_tables, cr_lrp_ips):
|
||||
LOG.warning("Not able to expose subnet with IP %s", ip)
|
||||
return
|
||||
except Exception as e:
|
||||
LOG.exception("Unexpected exception while wiring lrp port: %s", e)
|
||||
return
|
||||
if ovn_ip_rules:
|
||||
ovn_ip_rules.pop(ip, None)
|
||||
|
||||
@ -1024,9 +1038,13 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
||||
linux_net.delete_exposed_ips(vms_on_net, CONF.bgp_nic)
|
||||
|
||||
# Disconnect the network to OVN
|
||||
try:
|
||||
wire_utils.unwire_lrp_port(
|
||||
self.ovn_routing_tables_routes, ip, bridge_device, bridge_vlan,
|
||||
self.ovn_routing_tables, cr_lrp_ips)
|
||||
except Exception as e:
|
||||
LOG.exception("Unexpected exception while unwiring lrp port: %s",
|
||||
e)
|
||||
|
||||
@lockutils.synchronized('bgp')
|
||||
def expose_subnet(self, ip, row):
|
||||
|
Loading…
Reference in New Issue
Block a user