#!/bin/bash -x env > /tmp/antani.env if [ -f /etc/ganeti/common.sh ] ; then . /etc/ganeti/common.sh else exit 0 fi routes=$(gettags $GANETI_INSTANCE_NAME) primary=$(i_am_primary) #IFS=',' for tag in $routes do route=`echo $tag | awk -F ':' '{print $2":"$3}'` addr=`echo $route | awk -F ':' '{print $1}'` iface=`echo $route | awk -F ':' '{print $2}'` if [ $primary ] ; then echo "add_route $addr $iface" >> /tmp/antani.env 2>&1 add_route $addr $iface || true >> /tmp/antani.env 2>&1 else echo "del route $addr $iface" >> /tmp/antani.env 2>&1 del_route $addr loc || true >> /tmp/antani.env 2>&1 fi done v6routes=$(getv6tags $GANETI_INSTANCE_NAME) for tag in $v6routes do rtype=`echo $tag | awk -F '_' '{print $1}'` if [ x"$rtype" == x"v6" ] ; then route=`echo $tag | awk -F '_' '{print $2":"$3}'` addr=`echo $route | awk -F '_' '{print $1}'` iface=`echo $route | awk -F '_' '{print $2}'` # if [ $primary ] ; then add_v6route $addr $iface || true else del_v6route $addr $iface || true fi echo $route fi done #unset IFS