(heat) reserving a variable number of ports

asked 2019-11-01 10:20:16 -0600

Hi All

I'm trying to write a heat stack where the server has a variable number of ports reserved on a specific network along with a fixed number of ports from other networks. My stack looks like this:

minion_mgmt_port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_param: mgmt_network }
      security_groups: [ get_param: k8s_secgroup ]
      fixed_ips:
      - subnet_id: { get_param: mgmt_subnet }

minion_api_port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_param: api_network }
      security_groups: [ get_param: open_secgroup ]
      fixed_ips:
      - subnet_id: { get_param: api_subnet }

minion_pod_port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_param: pod_network }
      security_groups: [ get_param: open_secgroup ]
      fixed_ips:
      - subnet_id: { get_param: pod_subnet }

sriov_ports:
    type: OS::Heat::ResourceGroup
    properties:
      count: { get_param: sriov_ports_num }
      resource_def:
        type: OS::Neutron::Port
        properties:
          network_id: { get_param: sriov_provider_net }
          security_groups: [ get_param: open_secgroup ]

minion_node:
    type: "OS::Nova::Server"
    properties:
      name: { get_param: name }
      networks:
        repeat:
          template:
            port: <%port%>
          for_each:
            <%port%>:
              list_concat:
              - [{get_resource: minion_mgmt_port}, {get_resource: minion_api_port}, {get_resource: minion_pod_port}]
              - if: ["sriov_enabled", get_attr: [sriov_ports, refs], null]
      flavor: { get_param: minion_flavor }
      image: { get_param: image }
      availability_zone: { get_param: availability_zone }
      key_name: { get_param: key_name }
      config_drive: true
      user_data_format: RAW
      user_data: { get_param: init_routine }

I keep getting this error when i try this stack:

ERROR: ValueError: : resources.minion_nodes<nested_stack>.resources.0<file:///lib/minion_node.yaml>.resources.minion_node: : coercing to Unicode: need string or buffer, NoneType found

Looks like the resources are not expanded in a list_concat context and the it's just a list of null values.

Stack trace from heat-engine:

2019-11-01 15:09:55.470 1 INFO heat.engine.stack [req-9a09d639-fda8-4367-a759-f85d87fceaee - admin - default default] Exception in stack validation
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack Traceback (most recent call last):
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack   File "/usr/lib/python2.7/site-packages/heat/engine/stack.py", line 909, in validate
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack     result = res.validate()
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack   File "/usr/lib/python2.7/site-packages/heat/engine/resources/openstack/nova/server.py", line 1533, in validate
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack     networks = self.properties[self.NETWORKS] or []
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack   File "/usr/lib/python2.7/site-packages/heat/engine/properties.py", line 512, in __getitem__
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack     return self._get_property_value(key)
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack   File "/usr/lib/python2.7/site-packages/heat/engine/properties.py", line 497, in _get_property_value
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack     return self.get_user_value(key, validate)
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack   File "/usr/lib/python2.7/site-packages/heat/engine/properties.py", line 489, in get_user_value
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack     raise ValueError(six.text_type(e))
2019-11-01 15:09:55.470 1 ERROR heat.engine.stack ValueError: coercing to Unicode: need string or buffer, NoneType found

Is there any way to make this work or a workaround to address the problem. Appreciate any help.

Thanks - Arvind

edit retag flag offensive close merge delete

Comments

Yeah, during validation get_attr returns None. What version of Heat are you using? This may or may not have been fixed already.

zaneb gravatar imagezaneb ( 2019-11-06 20:05:36 -0600 )edit