Browse Source

openstack: make server ports be trunk ports (#713)

This ensures that the ports that the servers were using before this
commit will be parent ports of Neutron trunk ports. Thanks to this,
there can be nested Neutron ports inside the OS::NOva::Server resources
created either in the heat stack or dynamically inside the Instances.

Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
Antoni Segura Puimedon 7 years ago
parent
commit
1cf6275b98

+ 12 - 0
roles/openstack-stack/templates/heat_stack_server.yaml.j2

@@ -138,7 +138,11 @@ resources:
       image:     { get_param: image }
       flavor:    { get_param: flavor }
       networks:
+{% if use_trunk_ports|default(false)|bool %}
+        - port:  { get_attr: [trunk-port, port_id] }
+{% else %}
         - port:  { get_resource: port }
+{% endif %}
       user_data:
         get_file: user-data
       user_data_format: RAW
@@ -151,6 +155,14 @@ resources:
         sub-host-type:    { get_param: subtype }
         node_labels: { get_param: node_labels }
 
+{% if use_trunk_ports|default(false)|bool %}
+  trunk-port:
+    type: OS::Neutron::Trunk
+    properties:
+      name: { get_param: name }
+      port: { get_resource: port }
+{% endif %}
+
   port:
     type: OS::Neutron::Port
     properties:

+ 12 - 0
roles/openstack-stack/templates/heat_stack_server_nofloating.yaml.j2

@@ -115,7 +115,11 @@ resources:
       image:     { get_param: image }
       flavor:    { get_param: flavor }
       networks:
+{% if use_trunk_ports|default(false)|bool %}
+        - port:  { get_attr: [trunk-port, port_id] }
+{% else %}
         - port:  { get_resource: port }
+{% endif %}
       user_data:
         get_file: user-data
       user_data_format: RAW
@@ -128,6 +132,14 @@ resources:
         sub-host-type:    { get_param: subtype }
         node_labels: { get_param: node_labels }
 
+{% if use_trunk_ports|default(false)|bool %}
+  trunk-port:
+    type: OS::Neutron::Trunk
+    properties:
+      name: { get_param: name }
+      port: { get_resource: port }
+{% endif %}
+
   port:
     type: OS::Neutron::Port
     properties: