From 1b7e2e0637e89e1a32d8735eac89efa918d62331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com> Date: Mon, 4 Nov 2013 15:44:50 +0000 Subject: [PATCH] [KVM SR] publish nat rules as parameters. --- software/kvm/common.cfg | 4 ++-- software/kvm/instance-kvm-resilient.cfg.jinja2 | 4 ++-- software/kvm/instance-kvm.cfg.jinja2 | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/software/kvm/common.cfg b/software/kvm/common.cfg index 99a2397d3..2daedb0c8 100644 --- a/software/kvm/common.cfg +++ b/software/kvm/common.cfg @@ -88,7 +88,7 @@ mode = 0644 recipe = hexagonit.recipe.download url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2 mode = 644 -md5sum = 03550e647e07af99dcd2af8f4869ecbe +md5sum = e16c15f72fdeb92ce1854bc25daf5ad7 download-only = true on-update = true @@ -96,7 +96,7 @@ on-update = true recipe = hexagonit.recipe.download url = ${:_profile_base_location_}/instance-kvm-resilient.cfg.jinja2 mode = 644 -md5sum = 038c338e3ce545a73393ceee38a9ac7d +md5sum = a07c96b53fe9145278cd64a3b27a459a download-only = true on-update = true diff --git a/software/kvm/instance-kvm-resilient.cfg.jinja2 b/software/kvm/instance-kvm-resilient.cfg.jinja2 index 844af7587..ff920015a 100644 --- a/software/kvm/instance-kvm-resilient.cfg.jinja2 +++ b/software/kvm/instance-kvm-resilient.cfg.jinja2 @@ -29,13 +29,13 @@ return = # Resilient related parameters url ssh-public-key ssh-url notification-id ip # KVM related parameters - backend-url url ipv6 +# XXX: return ALL parameters (like nat rules), through jinja + backend-url url [publish-connection-informations] recipe = slapos.cookbook:publish backend-url = ${request-kvm:connection-backend-url} url = ${request-kvm:connection-url} -ipv6 = ${request-kvm:connection-ipv6} [kvm-frontend-url-promise] # Check that url parameter is complete diff --git a/software/kvm/instance-kvm.cfg.jinja2 b/software/kvm/instance-kvm.cfg.jinja2 index 9a1d8c7c4..db555542e 100644 --- a/software/kvm/instance-kvm.cfg.jinja2 +++ b/software/kvm/instance-kvm.cfg.jinja2 @@ -215,7 +215,13 @@ curl_path = {{ curl_executable_location }} recipe = slapos.cookbook:publish backend-url = https://[${novnc-instance:ip}]:${novnc-instance:port}/vnc_auto.html?host=[${novnc-instance:ip}]&port=${novnc-instance:port}&encrypt=1&password=${kvm-instance:vnc-passwd} url = ${request-slave-frontend:connection-url}/vnc_auto.html?host=${request-slave-frontend:connection-domainname}&port=${request-slave-frontend:connection-port}&encrypt=1&path=${request-slave-frontend:connection-resource}&password=${kvm-instance:vnc-passwd} -ipv6 = ${slap-network-information:global-ipv6} +# Publish NAT port mapping status +# XXX: hardcoded value from [slap-parameter] +{% set nat_rule_list = slapparameter_dict.get('nat-rules', '22 80 443') %} +{% for port in nat_rule_list.split(' ') -%} + {% set external_port = 10000 + port|int() -%} + nat-rule-port-{{port}} = ${slap-network-information:global-ipv6} : {{external_port}} +{% endfor -%} [slap-parameter] -- 2.30.9