summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hua <john.hua@citrix.com>2016-06-02 15:11:45 +0800
committerJohn Hua <john.hua@citrix.com>2016-06-02 16:08:08 +0800
commita28e0bbdc31f9caf9f7887fd980c2adb8d458bed (patch)
treef3777a92d689f0a191bb78a69d3ef384fe7c2c55
parente6e2adfd27a25543d78299d4d001f91d028b5289 (diff)
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
Notes
Notes (review): Code-Review+2: Jianghua Wang <jianghua.wang@citrix.com> Workflow+1: John Hua <john.hua@citrix.com> Workflow+1: Jianghua Wang <jianghua.wang@citrix.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 03 Jun 2016 02:39:16 +0000 Reviewed-on: https://review.openstack.org/324257 Project: openstack/fuel-plugin-xenserver Branch: refs/heads/8.0
-rwxr-xr-xdeployment_scripts/compute_post_deployment.py16
-rw-r--r--metadata.yaml2
2 files changed, 14 insertions, 4 deletions
diff --git a/deployment_scripts/compute_post_deployment.py b/deployment_scripts/compute_post_deployment.py
index 8e9a12b..26b0613 100755
--- a/deployment_scripts/compute_post_deployment.py
+++ b/deployment_scripts/compute_post_deployment.py
@@ -271,6 +271,8 @@ def route_to_compute(endpoints, himn_xs, himn_local, username):
271 mask 271 mask
272 ), out) 272 ), out)
273 273
274 ssh(himn_xs, username,
275 'printf "#!/bin/bash\nsleep 5\n" > /etc/udev/scripts/reroute.sh')
274 endpoint_names = ['storage', 'mgmt'] 276 endpoint_names = ['storage', 'mgmt']
275 for endpoint_name in endpoint_names: 277 for endpoint_name in endpoint_names:
276 endpoint = endpoints.get(endpoint_name) 278 endpoint = endpoints.get(endpoint_name)
@@ -281,11 +283,19 @@ def route_to_compute(endpoints, himn_xs, himn_local, username):
281 params = ['route', 'add', '-net', net, 'netmask', 283 params = ['route', 'add', '-net', net, 'netmask',
282 mask, 'gw', himn_local] 284 mask, 'gw', himn_local]
283 ssh(himn_xs, username, *params) 285 ssh(himn_xs, username, *params)
284 sh = 'echo \'%s\' >> /etc/sysconfig/static-routes' \ 286 cmd = (
285 % ' '.join(params) 287 "printf 'if !(/sbin/route -n | /bin/grep -q {net}); then\n"
286 ssh(himn_xs, username, sh) 288 "/sbin/route add -net {net} netmask {mask} gw {himn_local};\n"
289 "fi\n' >> /etc/udev/scripts/reroute.sh"
290 )
291 cmd = cmd.format(net=net, mask=mask, himn_local=himn_local)
292 ssh(himn_xs, username, cmd)
287 else: 293 else:
288 logging.info('%s network ip is missing' % endpoint_name) 294 logging.info('%s network ip is missing' % endpoint_name)
295 ssh(himn_xs, username, 'chmod +x /etc/udev/scripts/reroute.sh')
296 ssh(himn_xs, username, ('echo \'SUBSYSTEM=="net" ACTION=="add" '
297 'KERNEL=="xenapi" RUN+="/etc/udev/scripts/reroute.sh"\' '
298 '> /etc/udev/rules.d/90-reroute.rules'))
289 299
290 300
291def install_suppack(himn, username): 301def install_suppack(himn, username):
diff --git a/metadata.yaml b/metadata.yaml
index 1bac480..aafbed1 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -3,7 +3,7 @@ name: fuel-plugin-xenserver
3# Human-readable name for your plugin 3# Human-readable name for your plugin
4title: XenServer Plugin 4title: XenServer Plugin
5# Plugin version 5# Plugin version
6version: '3.1.0' 6version: '3.1.1'
7# Description 7# Description
8description: Enable Mirantis OpenStack to integrate with Xenserver 8description: Enable Mirantis OpenStack to integrate with Xenserver
9# Required fuel version 9# Required fuel version