Static routes should always be added.

Even if the route exists on the current host, we are re-writing the
script run by udev, so the static routes must always be added to the
script.

Also, always check fixed strings rather than regular expressions
for the networks (which contain periods!)

Change-Id: I94cfd53506a915309095da0f5f8b9db397f81892
This commit is contained in:
Bob Ball 2016-06-06 11:49:55 +01:00
parent c7a1a414f1
commit ee86d2d0f0
2 changed files with 9 additions and 8 deletions

View File

@ -283,13 +283,14 @@ def route_to_compute(endpoints, himn_xs, himn_local, username):
params = ['route', 'add', '-net', net, 'netmask',
mask, 'gw', himn_local]
ssh(himn_xs, username, *params)
cmd = (
"printf 'if !(/sbin/route -n | /bin/grep -q {net}); then\n"
"/sbin/route add -net {net} netmask {mask} gw {himn_local};\n"
"fi\n' >> /etc/udev/scripts/reroute.sh"
)
cmd = cmd.format(net=net, mask=mask, himn_local=himn_local)
ssh(himn_xs, username, cmd)
# Always add the route to the udev, even if it's currently active
cmd = (
"printf 'if !(/sbin/route -n | /bin/grep -q -F {net}); then\n"
"/sbin/route add -net {net} netmask {mask} gw {himn_local};\n"
"fi\n' >> /etc/udev/scripts/reroute.sh"
)
cmd = cmd.format(net=net, mask=mask, himn_local=himn_local)
ssh(himn_xs, username, cmd)
else:
logging.info('%s network ip is missing' % endpoint_name)
ssh(himn_xs, username, 'chmod +x /etc/udev/scripts/reroute.sh')

View File

@ -3,7 +3,7 @@ name: fuel-plugin-xenserver
# Human-readable name for your plugin
title: XenServer Plugin
# Plugin version
version: '3.1.1'
version: '3.1.2'
# Description
description: Enable Mirantis OpenStack to integrate with Xenserver
# Required fuel version