Commit 65ad3322 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

[KVM] better information for IPv6

use address 1 instead of address 0 and display a /etc/network/interfaces syntax.

Also display the info for resilient KVM.

Note that formatting is not perfect due to softwaretype recipe (which doesn't preserve spaces).

/cc @jm @rafael @alain.takoudjou

/reviewed-on !521
parent 98b747a1
......@@ -19,7 +19,7 @@ md5sum = 028b6a6456d744c11b1bb2c51ecd51b2
[template-kvm]
filename = instance-kvm.cfg.jinja2
md5sum = e30912b1256bb093329ee3c108666f05
md5sum = c51026e815ca43b5de5ddc6cbd8bf1e2
[template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in
......@@ -27,7 +27,7 @@ md5sum = 63fa784d8946d0b6e3fbd6381e1ea9f4
[template-kvm-resilient]
filename = instance-kvm-resilient.cfg.jinja2
md5sum = c189bce8b196a3b5bcb01526a3f9b2aa
md5sum = 6677ac6074f6be671fe8e8b8a6a4afe8
[template-kvm-import]
filename = instance-kvm-import.cfg.jinja2.in
......
......@@ -68,12 +68,14 @@ return =
# KVM related parameters
# XXX: return ALL parameters (like nat rules), through jinja
backend-url url ip
{{ ' ' }}ipv6-network-info
[publish-connection-information]
recipe = slapos.cookbook:publish
backend-url = ${request-kvm:connection-backend-url}
url = ${request-kvm:connection-url}
ipv6 = ${request-kvm:connection-ip}
ipv6-network-info = ${request-kvm:connection-ipv6-network-info}
monitor-password = ${publish-early:monitor-password}
monitor-user = ${monitor-publish-parameters:monitor-user}
{% if monitor_dict -%}
......
......@@ -133,7 +133,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 slap_configuration.get('tap-ipv4-addr', '') != "") -%}
{% if enable_http == 'true' -%}
httpd-port = ${slap-parameter:httpd-port}
{% else -%}
httpd-port = 0
......@@ -464,14 +464,14 @@ key_info = Get the publick key file in your VM with the command: wget {{ kvm_htt
{% endif %}
{% endif %}
{% if use_tap == 'true' and slap_configuration.get('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 }}
${network-config-ipv4:ifconfig}
${network-config-ipv4:route-iface}
${network-config-ipv4:route-network}
${network-config-ipv4:route-default}
Use this configuration in /etc/network/interfaces to configure IPv4 on interface {{ iface }} in your VM.
auto {{ iface }}
iface {{ iface }} inet static
address {{ slap_configuration.get('tap-ipv4-addr') }}
netmask {{ slap_configuration.get('tap-ipv4-netmask') }}
gateway {{ slap_configuration.get('tap-ipv4-gateway') }}
{% if enable_http == 'true' %}
${helper:blank-line}
Or run in your VM the command: wget -O- {{ kvm_http }}/netconfig.sh | /bin/sh -
......@@ -479,20 +479,21 @@ ipv4-network-info =
{% endif %}
ipv6-network-info =
{% if use_tap == 'true' and slap_configuration.get('tap-ipv6-addr', '') != "" %}
Use these configurations below to configure IPv6 on interface {{ iface }} in your VM.
IFACE={{ iface }}
ip link set dev $IFACE up
${network-config-ipv6:ipv6-add-address}
${network-config-ipv6:ipv6-add-default-route}
{% if use_tap == 'true' and slap_configuration.get('tap-ipv6-addr') %}
Use this configuration in /etc/network/interfaces to configure IPv6 on interface {{ iface }} in your VM.
auto {{ iface }}
iface {{ iface }} inet6 static
address {{ slap_configuration.get('tap-ipv6-gateway') }}
netmask {{ slap_configuration.get('tap-ipv6-network').split('/')[1] }}
gateway {{ slap_configuration.get('tap-ipv6-addr') }}
{% if enable_http == 'true' %}
${helper:blank-line}
Or run in your VM the command: wget -O- {{ kvm_http }}/ipv6_config.sh | /bin/sh -
Or run in your VM the command: wget -O- {{ kvm_http }}/${network-config-ipv6:filename} | /bin/sh -
{% endif %}
{% endif %}
{% if use_tap == 'true' and slap_configuration.get('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
......@@ -521,19 +522,22 @@ command =
update-command = ${:command}
{% endif -%}
{% if use_tap == 'true' and slap_configuration.get('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 {{ slap_configuration.get('tap-ipv6-network') }} dev \$IFACE
filename = ipv6_config.sh
path = ${directory:public}/${:filename}
ipv6-add-address = ip -6 address add {{ slap_configuration.get('tap-ipv6-gateway') }}/{{ slap_configuration.get('tap-ipv6-network').split('/')[1] }} dev \$IFACE
ipv6-add-default-route =
ip -6 route del default ; ip -6 route add default dev \$IFACE via {{ slap_configuration.get('tap-ipv6-gateway') }}
ip -6 route del default ; ip -6 route add default dev \$IFACE via {{ slap_configuration.get('tap-ipv6-addr') }}
ipv6-set-link-up = ip link set dev \$IFACE up
command =
cat > ${:path} << EOF
#!/bin/sh
IFACE={{ iface }}
${:ipv6-add-address}
${:ipv6-add-default-route}
${:ipv6-set-link-up}
EOF
update-command = ${:command}
{% endif -%}
......@@ -565,7 +569,7 @@ mode = {{ mode }}
[publish-host-config]
recipe = plone.recipe.command
name = {{ slapparameter_dict.get('name', 'localhost') }}
{% if use_tap == 'true' and slap_configuration.get('tap-ipv4-addr', '') != "" -%}
{% 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') }}
......
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