Replace static-routes with udev rules
When host is restarted, static-routes won't be able add route rules
because HIMN isn't brought up. Thus we need to use udev to add
those route rules back. As tested there is time gap between udev is
triggered and HIMN is ready, a 5-sec sleep is added just in case.
Change-Id: Ifa3260107265f400bde2a33640d4da2fc9f32ddf
(cherry picked from commit a28e0bbdc3
)
This commit is contained in:
parent
52cfbd77b1
commit
a7c2224505
|
@ -271,6 +271,8 @@ def route_to_compute(endpoints, himn_xs, himn_local, username):
|
|||
mask
|
||||
), out)
|
||||
|
||||
ssh(himn_xs, username,
|
||||
'printf "#!/bin/bash\nsleep 5\n" > /etc/udev/scripts/reroute.sh')
|
||||
endpoint_names = ['storage', 'mgmt']
|
||||
for endpoint_name in endpoint_names:
|
||||
endpoint = endpoints.get(endpoint_name)
|
||||
|
@ -281,11 +283,19 @@ 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)
|
||||
sh = 'echo \'%s\' >> /etc/sysconfig/static-routes' \
|
||||
% ' '.join(params)
|
||||
ssh(himn_xs, username, sh)
|
||||
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)
|
||||
else:
|
||||
logging.info('%s network ip is missing' % endpoint_name)
|
||||
ssh(himn_xs, username, 'chmod +x /etc/udev/scripts/reroute.sh')
|
||||
ssh(himn_xs, username, ('echo \'SUBSYSTEM=="net" ACTION=="add" '
|
||||
'KERNEL=="xenapi" RUN+="/etc/udev/scripts/reroute.sh"\' '
|
||||
'> /etc/udev/rules.d/90-reroute.rules'))
|
||||
|
||||
|
||||
def install_suppack(himn, username):
|
||||
|
|
|
@ -3,7 +3,7 @@ name: fuel-plugin-xenserver
|
|||
# Human-readable name for your plugin
|
||||
title: XenServer Plugin
|
||||
# Plugin version
|
||||
version: '3.1.0'
|
||||
version: '3.1.1'
|
||||
# Description
|
||||
description: Enable Mirantis OpenStack to integrate with Xenserver
|
||||
# Required fuel version
|
||||
|
|
Loading…
Reference in New Issue