37a8d92724474d2389130659ae5437325bb9fa0e
[fuel.git] / mcp / scripts / virsh_net / net_public.xml.j2
1 <!--
2  Copyright (c) 2017 Mirantis Inc., Enea AB and others.
3
4  All rights reserved. This program and the accompanying materials
5  are made available under the terms of the Apache License, Version 2.0
6  which accompanies this distribution, and is available at
7  http://www.apache.org/licenses/LICENSE-2.0
8 -->
9 {%- for node in conf.nodes %}
10   {%- if node.node.type == 'virtual' %}
11     {%- set cluster_has_virtual_nodes = True %}
12   {%- endif %}
13 {%- endfor %}
14 {%- if conf.idf.net_config.public is defined %}
15   {%- set public_network = conf.idf.net_config.public.network %}
16   {%- set public_prefix = conf.idf.net_config.public.mask %}
17 {%- else %}
18   {%- set public_network = '10.16.0.0' %}
19   {%- set public_prefix = '24' %}
20 {%- endif %}
21 <network>
22   <name>public</name>
23   <bridge name="public"/>
24 {%- if cluster_has_virtual_nodes %}
25 {#- Ideally, jumpserver would have a real Linux bridge we will hook to.
26     In case it doesn't, we use this virsh network as a *mock* public.
27     The *mock* public should NOT overlap with the real public in any way. #}
28   <forward mode="nat"/>
29   <ip address="{{ public_network | ipaddr_index(1) }}" netmask="{{ public_prefix | netmask }}"/>
30 {%- endif %}
31 </network>