On Fri, Feb 12, 2010 at 11:31:20AM +0000, Balazs Lecz wrote:

Hi,

> After an instance migration or failover some nodes will
> have stale routing information and these will continue to send traffic
> to the old node. This is detected by ganeti-nld on the old node.
> 
> This patch adds the capability to look up the source node based on the
> source instance IP.
> 
> Signed-off-by: Balazs Lecz <[email protected]>
> ---
>  daemons/ganeti-nld |   30 +++++++++++++++++++++++++++---
>  1 files changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/daemons/ganeti-nld b/daemons/ganeti-nld
> index d4fb9e7..85b83f0 100755
> --- a/daemons/ganeti-nld
> +++ b/daemons/ganeti-nld
> @@ -387,12 +387,36 @@ class MisroutedPacketHandler(object):
>      self.instance_node_maps = instance_node_maps
>  
>    def __call__(self, i, nflog_payload):
> +    # Look up the source IP in the instance->node maps. If found, it means 
> the
> +    # packet came from an instance in one of our clusters, which means the
> +    # node it's running on has stale routing information, so we have to
> +    # notify that node.
>      ip_packet = ip.disassemble(nflog_payload.get_data())
> -    logging.debug("misrouted packet detected. source IP: %s", ip_packet.src)
> +
> +    source_cluster = None
> +    source_link = None
> +    source_node = None
> +    for cluster, cluster_map in self.instance_node_maps.iteritems():
> +      for link, link_map in cluster_map.iteritems():
> +        source_node = link_map.get(ip_packet.src, None)
> +        if source_node:
> +          source_cluster = cluster
> +          source_link = link
> +          break
> +

Mmm... isn't it possible to deduce the link from the interface we got the
packet from? That would be better to deal with the same ip in different links.

Thanks,

Guido

Reply via email to