[maas] Adopt node role from scenario definitions 41/60641/2
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sun, 5 Aug 2018 05:44:09 +0000 (07:44 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Tue, 7 Aug 2018 04:22:23 +0000 (06:22 +0200)
Instead of hardcoding kvm hostnames in maas machine definitions,
read node roles/hostnames from current scenario and map them
accodingly.

JIRA: FUEL-382

Change-Id: I15d52e299e0353971f8d0c7da853c571ad5410da
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
mcp/reclass/classes/cluster/all-mcp-arch-common/infra/maas.yml.j2

index d980c29..4e9323b 100644 (file)
@@ -108,12 +108,14 @@ parameters:
 {%- endif %}
       machines:
       {%- set pxe_interface = conf.idf.net_config.admin.interface %}
+      {%- set ctl_roles = conf.virtual.nodes.control | length %}
       {%- for node in conf.nodes %}
-      {%- if node.node.type == 'baremetal' %}
+      {%- if (node.node.type == 'baremetal' and (
+              loop.index > nm.cmp001.idx or loop.index0 < ctl_roles)) %}
         {%- if loop.index > nm.cmp001.idx %}
         cmp{{ '%03d' | format(loop.index - nm.cmp001.idx) }}:
         {%- else %}
-        kvm{{ '%02d' | format(loop.index) }}:
+        {{ conf.virtual.nodes.control[loop.index0] }}:
         {%- endif %}
           interface:
             mac: {{ node.interfaces[pxe_interface].mac_address }}