Commit 691028c2 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

[kvm SR] fixes after 9345c81b

parent ea259373
......@@ -139,7 +139,7 @@ return =
{{ ' ' }}ipv6-network-info
{% 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 kvm_hostname_list.append(instance_name ~ ' ' ~ '${' ~ section ~ ':connection-tap-ipv4}') -%}
{% endif -%}
......
......@@ -87,7 +87,7 @@ nbd-port = ${slap-parameter:nbd-port}
nbd2-host = ${slap-parameter:nbd2-host}
nbd2-port = ${slap-parameter:nbd2-port}
tap-interface = {{ tap_name }}
tap-interface = {{ slap_configuration.get('tap-name', '') }}
disk-size = ${slap-parameter:disk-size}
disk-type = ${slap-parameter:disk-type}
......@@ -132,7 +132,7 @@ external-disk-number = ${slap-parameter:external-disk-number}
external-disk-size = ${slap-parameter:external-disk-size}
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}
{% else -%}
httpd-port = 0
......@@ -442,8 +442,8 @@ nat-rule-url-{{port}} = [${slap-network-information:global-ipv6}]:${6tunnel-{{ex
{% endif -%}
{% endif -%}
{% if use_tap == 'true' -%}
tap-ipv4 = {{tap_ipv4_addr}}
tap-ipv6 = {{tap_ipv6_addr}}
tap-ipv4 = {{ slap_configuration.get('tap-ipv4-addr', '') }}
tap-ipv6 = {{ slap_configuration.get('tap-ipv6-addr', '') }}
{% endif -%}
{% 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
{% endif %}
{% endif %}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%}
{% if use_tap == 'true' and slap_configuration.get('tap-ipv4-addr', '') != "" -%}
ipv4-network-info =
Use these configurations below to configure IPv4 on interface {{ iface }} in your VM.
IFACE={{ iface }}
......@@ -470,7 +470,7 @@ ipv4-network-info =
{% endif %}
{% endif %}
{% if use_tap == 'true' and tap_ipv6_addr != "" -%}
{% if use_tap == 'true' and slap_configuration.get('tap-ipv6-addr', '') != "" -%}
ipv6-network-info =
Use these configurations below to configure IPv6 on interface {{ iface }} in your VM.
IFACE={{ iface }}
......@@ -483,17 +483,17 @@ ipv6-network-info =
{% endif %}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%}
{% if use_tap == 'true' and slap_configuration.get('tap-ipv4-addr', '') != "" -%}
[network-config-ipv4]
recipe = plone.recipe.command
path = ${directory:public}/netconfig.sh
ifconfig = ifconfig $IFACE {{tap_ipv4_addr}} netmask {{tap_ipv4_netmask}}
route-iface = route add {{tap_ipv4_gateway}} dev $IFACE
route-network = route add -net {{tap_ipv4_network}} netmask {{tap_ipv4_netmask}} gw {{tap_ipv4_gateway}}
ifconfig = ifconfig $IFACE {{ slap_configuration.get('tap-ipv4-addr') }} netmask {{ slap_configuration.get('tap-ipv4-netmask') }}
route-iface = route add {{ slap_configuration.get('tap-ipv4-gateway') }} dev $IFACE
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' -%}
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 -%}
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 -%}
route-default =
{% endif -%}
......@@ -512,13 +512,13 @@ command =
update-command = ${:command}
{% endif -%}
{% if use_tap == 'true' and tap_ipv6_addr != "" -%}
{% if use_tap == 'true' and slap_configuration.get('tap-ipv6-addr', '') != "" -%}
[network-config-ipv6]
recipe = plone.recipe.command
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 =
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 =
cat > ${:path} << EOF
#!/bin/sh
......@@ -556,11 +556,11 @@ mode = {{ mode }}
[publish-host-config]
recipe = plone.recipe.command
name = {{ slapparameter_dict.get('name', 'localhost') }}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%}
local-ipv4 = {{tap_ipv4_addr}}
gateway = {{tap_ipv4_gateway}}
netmask = {{tap_ipv4_network}}
network = {{tap_ipv4_netmask}}
{% if use_tap == 'true' and slap_configuration.get('tap-ipv4-addr', '') != "" -%}
local-ipv4 = {{ slap_configuration('tap-ipv4-addr') }}
gateway = {{ slap_configuration.get('tap-ipv4-gateway') }}
netmask = {{ slap_configuration.get('tap-ipv4-network') }}
network = {{ slap_configuration.get('tap-ipv4-netmask') }}
{% else -%}
local-ipv4 = 127.0.0.1
gateway =
......@@ -619,7 +619,7 @@ template = {{ ansible_promise_tpl }}
rendered = ${directory:promises}/ansible_{{ name }}
extensions = jinja2.ext.do
context =
key host {{ tap_ipv4_addr }}
key host {{ slap_configuration.get('tap-ipv4-addr', '') }}
raw logs ${directory:public}/ansible
raw name {{ name }}
......
......@@ -74,15 +74,7 @@ extra-context =
template = ${template-kvm:location}/instance-kvm.cfg.jinja2
filename = template-kvm.cfg
extra-context =
key tap_ipv4_addr slap-configuration:tap-ipv4-addr
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
section slap_configuration slap-configuration
raw ansible_promise_tpl ${template-ansible-promise:location}/${template-ansible-promise:filename}
raw curl_executable_location ${curl:location}/bin/curl
raw dash_executable_location ${dash:location}/bin/dash
......
......@@ -90,7 +90,7 @@ command =
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
md5sum = 2e3fba2f0f6483e62f19a8d2616554bc
md5sum = 028b6a6456d744c11b1bb2c51ecd51b2
output = ${buildout:directory}/template.cfg
mode = 0644
......@@ -99,7 +99,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
mode = 644
md5sum = b74ab4ea985d44b4f1385a424958411d
md5sum = 6c1ef6acf06e43e7e75429aa587df309
download-only = true
on-update = true
......@@ -108,7 +108,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true
url = ${:_profile_base_location_}/instance-kvm-cluster.cfg.jinja2.in
mode = 644
md5sum = c17903ba4d73361431851914f5ae549d
md5sum = 0a3e8fa290b78fa92367c9167077f520
download-only = 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