example42/puppet-network

apply host route without restarting full network stack

JOJ0 opened this issue · 4 comments

JOJ0 commented

OS is RHEL7

Expected Behavior

adding a new host route via mroutes_hash does not restart network service stack but applies new route (execute "ip route add ...." command) and write route-xxx file

Actual Behavior

if i add a hostroute, "systemtctl restart network" is called which interrupts service for several seconds.

Steps to Reproduce the Problem

  1. add a new line to "routes" hash in an mroute_hash to yaml file and deploy and run puppet
    eg.
network::mroutes_hash:
    eth0:
        routes:
            default: 'x.x.x.x dev eth0 table xxx_tablename'
            y.y.y.y.y/24: '123.23.24.46 dev eth0'
            z.z.z.z/24: '123.23.25.46 dev eth0'

I am aware of network:config_file_notify, if I set it to empty string network service is not restarted, but certainly then the new host route is not applied. Is there a way to savely apply a new host route without having puppet restart the full network stack, eg. systemctl restart network. This results in a network interruptions of several seconds on our machines. If I would just add a host route by hand I wouldnt have to touch the network service at all. Is there any way to achive this with whit puppet module?

thanks in advance
all the best

JOJ0 commented

put differently: when I add new additional IPs to a hosts network interface, then I just set "restart_all_nic: false" and the behaviour is fine. the new IP address is applied and network service is not interrupted. I am looking for something similar when applying host routes.

The network::mroute define has a config_file_notify option which allows to customise, or disable, the way network is restarted when a configuration changes.

JOJ0 commented

Hi Alessandro, do you have a direct link to documentation and/or code? Which values does the network::mroute:config_file_notify variable accept? Thanks a lot!

@JOJ0 buried here https://github.com/example42/puppet-network/blob/master/manifests/mroute.pp#L37

Set to undef ( tilde symbol in hiera/yaml) to not notify anything set to , for example: 'Exec[network_restart]' to trigger a custom exec resource (you have to take care of declaring it in your profiles), this resource can have a refreshonly => true argument to be run only on notifications.