Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos-mynij-dev
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mynij
slapos-mynij-dev
Commits
71b2a378
Commit
71b2a378
authored
Dec 10, 2018
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[kvm] Add information about tap IPv6 in connection parameters
parent
b89c4377
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
27 deletions
+74
-27
software/kvm/instance-kvm-cluster.cfg.jinja2.in
software/kvm/instance-kvm-cluster.cfg.jinja2.in
+5
-1
software/kvm/instance-kvm.cfg.jinja2
software/kvm/instance-kvm.cfg.jinja2
+67
-24
software/kvm/software.cfg
software/kvm/software.cfg
+2
-2
No files found.
software/kvm/instance-kvm-cluster.cfg.jinja2.in
View file @
71b2a378
...
@@ -135,8 +135,12 @@ return =
...
@@ -135,8 +135,12 @@ return =
{{ ' ' }}monitor-base-url
{{ ' ' }}monitor-base-url
{% if str(kvm_parameter_dict.get('use-tap', 'True')).lower() == 'true' -%}
{% if str(kvm_parameter_dict.get('use-tap', 'True')).lower() == 'true' -%}
{{ ' ' }}tap-ipv4
{{ ' ' }}tap-ipv4
{{ ' ' }}tap-ipv6
{{ ' ' }}ipv6-network-info
{% do publish_dict.__setitem__(instance_name ~ '-lan', '${' ~ 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-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 -%}
{% do monitor_base_url_dict.__setitem__(instance_name, '${' ~ section ~ ':connection-monitor-base-url}') -%}
{% do monitor_base_url_dict.__setitem__(instance_name, '${' ~ section ~ ':connection-monitor-base-url}') -%}
...
...
software/kvm/instance-kvm.cfg.jinja2
View file @
71b2a378
...
@@ -410,6 +410,10 @@ password = {{ slapparameter_dict['monitor-password'] }}
...
@@ -410,6 +410,10 @@ password = {{ slapparameter_dict['monitor-password'] }}
{% endif -%}
{% endif -%}
interface-url = {{ slapparameter_dict.get('monitor-interface-url', 'https://monitor.app.officejs.com') }}
interface-url = {{ slapparameter_dict.get('monitor-interface-url', 'https://monitor.app.officejs.com') }}
# this helper just gives a blank line to insert in multiline values
[helper]
blank-line =
[publish-connection-information]
[publish-connection-information]
<= monitor-publish
<= monitor-publish
recipe = slapos.cookbook:publish
recipe = slapos.cookbook:publish
...
@@ -418,9 +422,9 @@ backend-url = https://[${novnc-instance:ip}]:${novnc-instance:port}/vnc.html?hos
...
@@ -418,9 +422,9 @@ backend-url = https://[${novnc-instance:ip}]:${novnc-instance:port}/vnc.html?hos
url = ${request-slave-frontend:connection-url}/vnc.html?host=${request-slave-frontend:connection-domainname}&port=${request-slave-frontend:connection-port}&encrypt=1&path=${request-slave-frontend:connection-resource}&password=${kvm-controller-parameter-dict:vnc-passwd}
url = ${request-slave-frontend:connection-url}/vnc.html?host=${request-slave-frontend:connection-domainname}&port=${request-slave-frontend:connection-port}&encrypt=1&path=${request-slave-frontend:connection-resource}&password=${kvm-controller-parameter-dict:vnc-passwd}
{% set disk_number = len(storage_dict) -%}
{% set disk_number = len(storage_dict) -%}
maximum-extra-disk-amount = {{ disk_number }}
maximum-extra-disk-amount = {{ disk_number }}
{% set iface = 'e
th0
' -%}
{% set iface = 'e
ns3
' -%}
{% if use_nat == 'true' -%}
{% if use_nat == 'true' -%}
{% set iface = 'e
th1
' -%}
{% set iface = 'e
ns4
' -%}
{% if nat_rule_list -%}
{% if nat_rule_list -%}
# Publish NAT port mapping status
# Publish NAT port mapping status
{% for port in nat_rule_list.split(' ') -%}
{% for port in nat_rule_list.split(' ') -%}
...
@@ -439,6 +443,7 @@ nat-rule-url-{{port}} = [${slap-network-information:global-ipv6}]:${6tunnel-{{ex
...
@@ -439,6 +443,7 @@ nat-rule-url-{{port}} = [${slap-network-information:global-ipv6}]:${6tunnel-{{ex
{% endif -%}
{% endif -%}
{% if use_tap == 'true' -%}
{% if use_tap == 'true' -%}
tap-ipv4 = {{tap_ipv4_addr}}
tap-ipv4 = {{tap_ipv4_addr}}
tap-ipv6 = {{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) -%}
...
@@ -447,42 +452,80 @@ tap-ipv4 = {{tap_ipv4_addr}}
...
@@ -447,42 +452,80 @@ tap-ipv4 = {{tap_ipv4_addr}}
{% set kvm_http = 'http://10.0.2.100' -%}
{% set kvm_http = 'http://10.0.2.100' -%}
{% endif %}
{% endif %}
{% if slapparameter_dict.get('authorized-key', '') and slapparameter_dict.get('type', '') == 'cluster' -%}
{% if slapparameter_dict.get('authorized-key', '') and slapparameter_dict.get('type', '') == 'cluster' -%}
7
_info = Get the publick key file in your VM with the command: wget {{ kvm_http }}/authorized_keys
key
_info = Get the publick key file in your VM with the command: wget {{ kvm_http }}/authorized_keys
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%}
1_info = Use these configurations below to configure interface {{ iface }} in your VM.
ipv4-network-info =
2_info = ${network-config:ifconfig}
Use these configurations below to configure IPv4 on interface {{ iface }} in your VM.
3_info = ${network-config:route-iface}
IFACE={{ iface }}
4_info = ${network-config:route-network}
${network-config-ipv4:ifconfig}
5_info = ${network-config:route-default}
${network-config-ipv4:route-iface}
${network-config-ipv4:route-network}
${network-config-ipv4:route-default}
{% if enable_http == 'true' %}
{% if enable_http == 'true' %}
6_info = Or run in your VM the command: wget -O- {{ kvm_http }}/netconfig.sh | /bin/sh -
${helper:blank-line}
Or run in your VM the command: wget -O- {{ kvm_http }}/netconfig.sh | /bin/sh -
{% endif %}
{% endif %}
{% endif %}
[network-config]
{% if use_tap == 'true' and tap_ipv6_addr != "" -%}
ipv6-network-info =
Use these configurations below to configure IPv6 on interface {{ iface }} in your VM.
IFACE={{ iface }}
${network-config-ipv6:ipv6-add-address}
${network-config-ipv6:ipv6-add-default-route}
{% if enable_http == 'true' %}
${helper:blank-line}
Or run in your VM the command: wget -O- {{ kvm_http }}/ipv6_config.sh | /bin/sh -
{% endif %}
{% endif %}
{% if use_tap == 'true' and tap_ipv4_addr != "" -%}
[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
{{tap_ipv4_addr}} netmask {{tap_ipv4_netmask}}
route-iface = route add {{tap_ipv4_gateway}} dev
{{ iface }}
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}}
route-network = route add -net {{tap_ipv4_network}} netmask {{tap_ipv4_netmask}} gw {{tap_ipv4_gateway}}
{% if iface == 'eth0' -%}
{% if nat_restrict == 'true' -%}
route-default = route add default gw {{tap_ipv4_gateway}}
route-default = route add default gw {{tap_ipv4_gateway}} dev $IFACE
{% elif nat_restrict == 'true' -%}
route-default = route add default gw {{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 {tap_ipv4_gateway}} dev
$IFACE
src {{tap_ipv4_addr}}
{% else -%}
{%
else -%}
route-default =
route-default =
{% endif -%}
{% endif -%}
command =
command =
echo "#!/bin/sh" > ${:path}
cat > ${:path} << EOF
echo "" >> ${:path}
#!/bin/sh
echo "${:ifconfig}" >> ${:path}
IFACE={{ iface }}
echo "${:route-iface}" >> ${:path}
#try to be compatible with OS with old names
echo "${:route-network}" >> ${:path}
grep eth0 /etc/network/interfaces &> /dev/null && [ $IFACE = ens3 ] && IFACE=eth0
echo "${:route-default}" >> ${:path}
grep eth1 /etc/network/interfaces &> /dev/null && [ $IFACE = ens4 ] && IFACE=eth1
${:ifconfig}
${:route-iface}
${:route-network}
${:route-default}
EOF
update-command = ${:command}
{% endif -%}
{% if use_tap == 'true' and 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-default-route =
ip -6 route del default ; ip -6 route add default dev $IFACE via {{tap_ipv6_gateway}}
command =
cat > ${:path} << EOF
#!/bin/sh
IFACE={{ iface }}
${:ipv6-add-address}
${:ipv6-add-default-route}
EOF
update-command = ${:command}
update-command = ${:command}
{% endif -%}
{% endif -%}
...
...
software/kvm/software.cfg
View file @
71b2a378
...
@@ -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 =
602cdd2ed6d26d494f2dce697e8168d9
md5sum =
b74ab4ea985d44b4f1385a424958411d
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 =
1282296397d445ccae59e6de7915840c
md5sum =
c17903ba4d73361431851914f5ae549d
download-only = true
download-only = true
on-update = true
on-update = true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment