Commit f38436a9 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼 Committed by Alain Takoudjou

[kvm SR] fixes after 9345c81b

parent 574e1409
...@@ -139,7 +139,7 @@ return = ...@@ -139,7 +139,7 @@ return =
{{ ' ' }}ipv6-network-info {{ ' ' }}ipv6-network-info
{% do publish_dict.__setitem__(instance_name ~ '-ipv4', '${' ~ section ~ ':connection-tap-ipv4}') -%} {% do publish_dict.__setitem__(instance_name ~ '-ipv4', '${' ~ section ~ ':connection-tap-ipv4}') -%}
{% do publish_dict.__setitem__(instance_name ~ '-ipv6', '${' ~ section ~ ':connection-tap-ipv4}') -%} {% do publish_dict.__setitem__(instance_name ~ '-ipv6', '${' ~ section ~ ':connection-tap-ipv6}') -%}
{% do publish_dict.__setitem__(instance_name ~ '-ipv6-info', '${' ~ section ~ ':connection-ipv6-network-info}') -%} {% do publish_dict.__setitem__(instance_name ~ '-ipv6-info', '${' ~ section ~ ':connection-ipv6-network-info}') -%}
{% do kvm_hostname_list.append(instance_name ~ ' ' ~ '${' ~ section ~ ':connection-tap-ipv4}') -%} {% do kvm_hostname_list.append(instance_name ~ ' ' ~ '${' ~ section ~ ':connection-tap-ipv4}') -%}
{% endif -%} {% endif -%}
......
...@@ -87,7 +87,7 @@ nbd-port = ${slap-parameter:nbd-port} ...@@ -87,7 +87,7 @@ nbd-port = ${slap-parameter:nbd-port}
nbd2-host = ${slap-parameter:nbd2-host} nbd2-host = ${slap-parameter:nbd2-host}
nbd2-port = ${slap-parameter:nbd2-port} nbd2-port = ${slap-parameter:nbd2-port}
tap-interface = {{ tap_name }} tap-interface = {{ slap_configuration.get('tap-name', '') }}
disk-size = ${slap-parameter:disk-size} disk-size = ${slap-parameter:disk-size}
disk-type = ${slap-parameter:disk-type} disk-type = ${slap-parameter:disk-type}
...@@ -132,7 +132,7 @@ external-disk-number = ${slap-parameter:external-disk-number} ...@@ -132,7 +132,7 @@ external-disk-number = ${slap-parameter:external-disk-number}
external-disk-size = ${slap-parameter:external-disk-size} external-disk-size = ${slap-parameter:external-disk-size}
external-disk-format = ${slap-parameter:external-disk-format} external-disk-format = ${slap-parameter:external-disk-format}
{% if enable_http == 'true' or ( use_tap == 'true' and tap_ipv4_addr != "") -%} {% if enable_http == 'true' or ( use_tap == 'true' and slap_configuration.get('tap-ipv4-addr', '') != "") -%}
httpd-port = ${slap-parameter:httpd-port} httpd-port = ${slap-parameter:httpd-port}
{% else -%} {% else -%}
httpd-port = 0 httpd-port = 0
...@@ -442,8 +442,8 @@ nat-rule-url-{{port}} = [${slap-network-information:global-ipv6}]:${6tunnel-{{ex ...@@ -442,8 +442,8 @@ nat-rule-url-{{port}} = [${slap-network-information:global-ipv6}]:${6tunnel-{{ex
{% endif -%} {% endif -%}
{% endif -%} {% endif -%}
{% if use_tap == 'true' -%} {% if use_tap == 'true' -%}
tap-ipv4 = {{tap_ipv4_addr}} tap-ipv4 = {{ slap_configuration.get('tap-ipv4-addr', '') }}
tap-ipv6 = {{tap_ipv6_addr}} tap-ipv6 = {{ slap_configuration.get('tap-ipv6-addr', '') }}
{% endif -%} {% endif -%}
{% set kvm_http = 'http://${slap-network-information:local-ipv4}:' ~ slapparameter_dict.get('httpd-port', 8081) -%} {% set kvm_http = 'http://${slap-network-information:local-ipv4}:' ~ slapparameter_dict.get('httpd-port', 8081) -%}
...@@ -456,7 +456,7 @@ key_info = Get the publick key file in your VM with the command: wget {{ kvm_htt ...@@ -456,7 +456,7 @@ key_info = Get the publick key file in your VM with the command: wget {{ kvm_htt
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%} {% if use_tap == 'true' and slap_configuration.get('tap-ipv4-addr', '') != "" -%}
ipv4-network-info = ipv4-network-info =
Use these configurations below to configure IPv4 on interface {{ iface }} in your VM. Use these configurations below to configure IPv4 on interface {{ iface }} in your VM.
IFACE={{ iface }} IFACE={{ iface }}
...@@ -470,7 +470,7 @@ ipv4-network-info = ...@@ -470,7 +470,7 @@ ipv4-network-info =
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if use_tap == 'true' and tap_ipv6_addr != "" -%} {% if use_tap == 'true' and slap_configuration.get('tap-ipv6-addr', '') != "" -%}
ipv6-network-info = ipv6-network-info =
Use these configurations below to configure IPv6 on interface {{ iface }} in your VM. Use these configurations below to configure IPv6 on interface {{ iface }} in your VM.
IFACE={{ iface }} IFACE={{ iface }}
...@@ -483,17 +483,17 @@ ipv6-network-info = ...@@ -483,17 +483,17 @@ ipv6-network-info =
{% endif %} {% endif %}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%} {% if use_tap == 'true' and slap_configuration.get('tap-ipv4-addr', '') != "" -%}
[network-config-ipv4] [network-config-ipv4]
recipe = plone.recipe.command recipe = plone.recipe.command
path = ${directory:public}/netconfig.sh path = ${directory:public}/netconfig.sh
ifconfig = ifconfig $IFACE {{tap_ipv4_addr}} netmask {{tap_ipv4_netmask}} ifconfig = ifconfig \$IFACE {{ slap_configuration.get('tap-ipv4-addr') }} netmask {{ slap_configuration.get('tap-ipv4-netmask') }}
route-iface = route add {{tap_ipv4_gateway}} dev $IFACE route-iface = route add {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE
route-network = route add -net {{tap_ipv4_network}} netmask {{tap_ipv4_netmask}} gw {{tap_ipv4_gateway}} route-network = route add -net {{ slap_configuration.get('tap-ipv4-network') }} netmask {{ slap_configuration.get('tap-ipv4-netmask') }} gw {{ slap_configuration.get('tap-ipv4-gateway') }}
{% if nat_restrict == 'true' -%} {% if nat_restrict == 'true' -%}
route-default = route add default gw {{tap_ipv4_gateway}} dev $IFACE route-default = route add default gw {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE
{% elif global_ipv4_prefix -%} {% elif global_ipv4_prefix -%}
route-default = ip route add {{ global_ipv4_prefix }} via {tap_ipv4_gateway}} dev $IFACE src {{tap_ipv4_addr}} route-default = ip route add {{ global_ipv4_prefix }} via {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE src {{ slap_configuration.get('tap-ipv4-addr') }}
{% else -%} {% else -%}
route-default = route-default =
{% endif -%} {% endif -%}
...@@ -502,8 +502,8 @@ command = ...@@ -502,8 +502,8 @@ command =
#!/bin/sh #!/bin/sh
IFACE={{ iface }} IFACE={{ iface }}
#try to be compatible with OS with old names #try to be compatible with OS with old names
grep eth0 /etc/network/interfaces &> /dev/null && [ $IFACE = ens3 ] && IFACE=eth0 grep eth0 /etc/network/interfaces &> /dev/null && [ \$IFACE = ens3 ] && IFACE=eth0
grep eth1 /etc/network/interfaces &> /dev/null && [ $IFACE = ens4 ] && IFACE=eth1 grep eth1 /etc/network/interfaces &> /dev/null && [ \$IFACE = ens4 ] && IFACE=eth1
${:ifconfig} ${:ifconfig}
${:route-iface} ${:route-iface}
${:route-network} ${:route-network}
...@@ -512,13 +512,13 @@ command = ...@@ -512,13 +512,13 @@ command =
update-command = ${:command} update-command = ${:command}
{% endif -%} {% endif -%}
{% if use_tap == 'true' and tap_ipv6_addr != "" -%} {% if use_tap == 'true' and slap_configuration.get('tap-ipv6-addr', '') != "" -%}
[network-config-ipv6] [network-config-ipv6]
recipe = plone.recipe.command recipe = plone.recipe.command
path = ${directory:public}/ipv6_config.sh path = ${directory:public}/ipv6_config.sh
ipv6-add-address = ip -6 address add {{tap_ipv6_network }} dev $IFACE ipv6-add-address = ip -6 address add {{ slap_configuration.get('tap-ipv6-network') }} dev \$IFACE
ipv6-add-default-route = ipv6-add-default-route =
ip -6 route del default ; ip -6 route add default dev $IFACE via {{tap_ipv6_gateway}} ip -6 route del default ; ip -6 route add default dev \$IFACE via {{ slap_configuration.get('tap-ipv6-gateway') }}
command = command =
cat > ${:path} << EOF cat > ${:path} << EOF
#!/bin/sh #!/bin/sh
...@@ -556,11 +556,11 @@ mode = {{ mode }} ...@@ -556,11 +556,11 @@ mode = {{ mode }}
[publish-host-config] [publish-host-config]
recipe = plone.recipe.command recipe = plone.recipe.command
name = {{ slapparameter_dict.get('name', 'localhost') }} name = {{ slapparameter_dict.get('name', 'localhost') }}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%} {% if use_tap == 'true' and slap_configuration.get('tap-ipv4-addr', '') != "" -%}
local-ipv4 = {{tap_ipv4_addr}} local-ipv4 = {{ slap_configuration('tap-ipv4-addr') }}
gateway = {{tap_ipv4_gateway}} gateway = {{ slap_configuration.get('tap-ipv4-gateway') }}
netmask = {{tap_ipv4_network}} netmask = {{ slap_configuration.get('tap-ipv4-network') }}
network = {{tap_ipv4_netmask}} network = {{ slap_configuration.get('tap-ipv4-netmask') }}
{% else -%} {% else -%}
local-ipv4 = 127.0.0.1 local-ipv4 = 127.0.0.1
gateway = gateway =
...@@ -619,7 +619,7 @@ template = {{ ansible_promise_tpl }} ...@@ -619,7 +619,7 @@ template = {{ ansible_promise_tpl }}
rendered = ${directory:promises}/ansible_{{ name }} rendered = ${directory:promises}/ansible_{{ name }}
extensions = jinja2.ext.do extensions = jinja2.ext.do
context = context =
key host {{ tap_ipv4_addr }} key host {{ slap_configuration.get('tap-ipv4-addr', '') }}
raw logs ${directory:public}/ansible raw logs ${directory:public}/ansible
raw name {{ name }} raw name {{ name }}
......
...@@ -74,15 +74,7 @@ extra-context = ...@@ -74,15 +74,7 @@ extra-context =
template = ${template-kvm:location}/instance-kvm.cfg.jinja2 template = ${template-kvm:location}/instance-kvm.cfg.jinja2
filename = template-kvm.cfg filename = template-kvm.cfg
extra-context = extra-context =
key tap_ipv4_addr slap-configuration:tap-ipv4-addr section slap_configuration slap-configuration
key tap_ipv4_gateway slap-configuration:tap-ipv4-gateway
key tap_ipv4_netmask slap-configuration:tap-ipv4-netmask
key tap_ipv4_network slap-configuration:tap-ipv4-network
key tap_ipv6_addr slap-configuration:tap-ipv6-addr
key tap_ipv6_gateway slap-configuration:tap-ipv6-gateway
key tap_ipv6_netmask slap-configuration:tap-ipv6-netmask
key tap_ipv6_network slap-configuration:tap-ipv6-network
key tap_name slap-configuration:tap-name
raw ansible_promise_tpl ${template-ansible-promise:location}/${template-ansible-promise:filename} raw ansible_promise_tpl ${template-ansible-promise:location}/${template-ansible-promise:filename}
raw curl_executable_location ${curl:location}/bin/curl raw curl_executable_location ${curl:location}/bin/curl
raw dash_executable_location ${dash:location}/bin/dash raw dash_executable_location ${dash:location}/bin/dash
......
...@@ -90,7 +90,7 @@ command = ...@@ -90,7 +90,7 @@ command =
[template] [template]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in url = ${:_profile_base_location_}/instance.cfg.in
md5sum = 2e3fba2f0f6483e62f19a8d2616554bc md5sum = 028b6a6456d744c11b1bb2c51ecd51b2
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
mode = 0644 mode = 0644
...@@ -99,7 +99,7 @@ recipe = hexagonit.recipe.download ...@@ -99,7 +99,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2 url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
mode = 644 mode = 644
md5sum = b74ab4ea985d44b4f1385a424958411d md5sum = bc7e721577715ae777a963bbe3c3623d
download-only = true download-only = true
on-update = true on-update = true
...@@ -108,7 +108,7 @@ recipe = hexagonit.recipe.download ...@@ -108,7 +108,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm-cluster.cfg.jinja2.in url = ${:_profile_base_location_}/instance-kvm-cluster.cfg.jinja2.in
mode = 644 mode = 644
md5sum = c17903ba4d73361431851914f5ae549d md5sum = 0a3e8fa290b78fa92367c9167077f520
download-only = true download-only = true
on-update = true on-update = true
......
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