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,15 +195,20 @@ class NBOVNBGPDriver(driver_api.AgentDriverBase):
|
|||||||
def _expose_provider_port(self, port_ips, logical_switch, bridge_device,
|
def _expose_provider_port(self, port_ips, logical_switch, bridge_device,
|
||||||
bridge_vlan, proxy_cidrs=None):
|
bridge_vlan, proxy_cidrs=None):
|
||||||
# Connect to OVN
|
# Connect to OVN
|
||||||
if wire_utils.wire_provider_port(
|
try:
|
||||||
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
if wire_utils.wire_provider_port(
|
||||||
bridge_vlan, self.ovn_routing_tables, proxy_cidrs):
|
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
||||||
# Expose the IP now that it is connected
|
bridge_vlan, self.ovn_routing_tables, proxy_cidrs):
|
||||||
bgp_utils.announce_ips(port_ips)
|
# Expose the IP now that it is connected
|
||||||
for ip in port_ips:
|
bgp_utils.announce_ips(port_ips)
|
||||||
self._exposed_ips.setdefault(logical_switch, {}).update(
|
for ip in port_ips:
|
||||||
{ip: {'bridge_device': bridge_device,
|
self._exposed_ips.setdefault(logical_switch, {}).update(
|
||||||
'bridge_vlan': bridge_vlan}})
|
{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,
|
def _withdraw_provider_port(self, port_ips, logical_switch, bridge_device,
|
||||||
bridge_vlan, proxy_cidrs=None):
|
bridge_vlan, proxy_cidrs=None):
|
||||||
@ -211,9 +216,13 @@ class NBOVNBGPDriver(driver_api.AgentDriverBase):
|
|||||||
bgp_utils.withdraw_ips(port_ips)
|
bgp_utils.withdraw_ips(port_ips)
|
||||||
|
|
||||||
# Disconnect IP from OVN
|
# Disconnect IP from OVN
|
||||||
wire_utils.unwire_provider_port(
|
try:
|
||||||
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
wire_utils.unwire_provider_port(
|
||||||
bridge_vlan, self.ovn_routing_tables, proxy_cidrs)
|
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:
|
for ip in port_ips:
|
||||||
if self._exposed_ips.get(logical_switch, {}).get(ip):
|
if self._exposed_ips.get(logical_switch, {}).get(ip):
|
||||||
self._exposed_ips[logical_switch].pop(ip)
|
self._exposed_ips[logical_switch].pop(ip)
|
||||||
|
@ -317,13 +317,18 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# Connect to OVN
|
# Connect to OVN
|
||||||
if wire_utils.wire_provider_port(
|
try:
|
||||||
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
if wire_utils.wire_provider_port(
|
||||||
bridge_vlan, self.ovn_routing_tables, proxy_cidrs, lladdr):
|
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
||||||
# Expose the IP now that it is connected
|
bridge_vlan, self.ovn_routing_tables, proxy_cidrs, lladdr):
|
||||||
bgp_utils.announce_ips(port_ips)
|
# Expose the IP now that it is connected
|
||||||
return True
|
bgp_utils.announce_ips(port_ips)
|
||||||
return False
|
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,
|
def _expose_tenant_port(self, port, ip_version, exposed_ips=None,
|
||||||
ovn_ip_rules=None):
|
ovn_ip_rules=None):
|
||||||
@ -386,9 +391,14 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
|||||||
provider_datapath)
|
provider_datapath)
|
||||||
if not bridge_device:
|
if not bridge_device:
|
||||||
return False
|
return False
|
||||||
return wire_utils.unwire_provider_port(
|
try:
|
||||||
self.ovn_routing_tables_routes, port_ips, bridge_device,
|
return wire_utils.unwire_provider_port(
|
||||||
bridge_vlan, self.ovn_routing_tables, proxy_cidrs, lladdr)
|
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):
|
def _get_bridge_for_datapath(self, datapath):
|
||||||
network_name, network_tag = self.sb_idl.get_network_name_and_tag(
|
network_name, network_tag = self.sb_idl.get_network_name_and_tag(
|
||||||
@ -959,10 +969,14 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
|
|||||||
cr_lrp_info['subnets_cidr'].append(ip)
|
cr_lrp_info['subnets_cidr'].append(ip)
|
||||||
self.ovn_local_lrps.update({lrp: associated_cr_lrp})
|
self.ovn_local_lrps.update({lrp: associated_cr_lrp})
|
||||||
|
|
||||||
if not wire_utils.wire_lrp_port(
|
try:
|
||||||
self.ovn_routing_tables_routes, ip, bridge_device, bridge_vlan,
|
if not wire_utils.wire_lrp_port(
|
||||||
self.ovn_routing_tables, cr_lrp_ips):
|
self.ovn_routing_tables_routes, ip, bridge_device,
|
||||||
LOG.warning("Not able to expose subnet with IP %s", ip)
|
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
|
return
|
||||||
if ovn_ip_rules:
|
if ovn_ip_rules:
|
||||||
ovn_ip_rules.pop(ip, None)
|
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)
|
linux_net.delete_exposed_ips(vms_on_net, CONF.bgp_nic)
|
||||||
|
|
||||||
# Disconnect the network to OVN
|
# Disconnect the network to OVN
|
||||||
wire_utils.unwire_lrp_port(
|
try:
|
||||||
self.ovn_routing_tables_routes, ip, bridge_device, bridge_vlan,
|
wire_utils.unwire_lrp_port(
|
||||||
self.ovn_routing_tables, cr_lrp_ips)
|
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')
|
@lockutils.synchronized('bgp')
|
||||||
def expose_subnet(self, ip, row):
|
def expose_subnet(self, ip, row):
|
||||||
|
Loading…
Reference in New Issue
Block a user