Commit e0ed7b64 authored by Alain Takoudjou's avatar Alain Takoudjou

kvm: don't request update tap route if not needed

parent 262e6629
......@@ -105,7 +105,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
mode = 644
md5sum = 730d1b066f606e64b3652d83c3c54026
md5sum = abd3663d78591888284838efc08f094e
download-only = true
on-update = true
......
......@@ -13,6 +13,7 @@
{% set part_list = [] -%}
{% set monitor = str(slapparameter_dict.get('enable-monitor', True)).lower() == 'true' -%}
{% set monitor_interface_url = slapparameter_dict.get('monitor-interface-url', 'https://monitor.app.officejs.com') -%}
{% set allow_to_move = str(slapparameter_dict.get('allow-to-move-vm', True)).lower() == 'true' -%}
{% set bootstrap_url = '' -%}
{% set bootstrap_url_md5sum = '' -%}
......@@ -24,7 +25,7 @@
{% if instance_type == 'cluster' -%}
{% set nat_rule_list = slapparameter_dict.get('nat-rules', '') -%}
{% if str(slapparameter_dict.get('allow-to-move-vm', True)).lower() == 'true' -%}
{% allow_to_move -%}
[before-server-ready-script]
# Script to run before allow to clone this VM (only for kvm-cluster)
......@@ -479,12 +480,16 @@ command =
BASE_DIR=${directory:public}
if [ -s "$DATA_DIR/ipv4" ]; then
IPv4=$(cat $DATA_DIR/ipv4)
cat << EOF > ${buildout:directory}/.${slap-connection:partition-id}-request-update-route
[${slap-connection:partition-id}-routes]
ip-to-interface = $IPv4
ip-to-interface-dnat = true
interface = ${slap-network-information:network-interface}
EOF
if [ "$IPv4" = "${:local-ipv4}" ]; then
rm -f $DATA_DIR/ipv4 $DATA_DIR/hostname
else
cat << EOF > ${buildout:directory}/.${slap-connection:partition-id}-request-update-route
[${slap-connection:partition-id}-routes]
ip-to-interface = $IPv4
ip-to-interface-dnat = true
interface = ${slap-network-information:network-interface}
EOF
fi
else
IPv4=${:local-ipv4}
fi
......@@ -550,7 +555,7 @@ command =
rm -f ${directory:var}/request-bang-done
rm -f ${directory:var}/server-is-ready
rm -f ${buildout:directory}/.${slap-connection:partition-id}-request-update-route
update-command =
update-command = ${:command}
#############################
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment