Ask Your Question
0

Problem with Heat Template using OS::Neutron::LoadBalancer

asked 2013-11-02 12:30:30 -0500

AJ gravatar image

Hi all. I recently created a two node Openstack deployment, running on CentOS6.4 with kernel 2.6.32-358.123.2.openstack.el6.x86_64, enabling namespaces, Neutron, Heat and LBaaS. Everything appears to be running nicely. Manually creating a loadbalancer via CLI works just fine. However, when trying to create one via Heat, I'm running into some difficulty. I'm working on a Heat template where I'm building two servers and a loadbalancer. I would like to add the two servers as members of the loadbalancer. Here are the pertinent snippets of my template:

  server1_port:
    type: OS::Neutron::Port
    properties:
      network_id:  70f112d7-2b69-4b5a-b4c5-d7016f7b0f2a
      fixed_ips:
        - subnet_id:  d9bdd754-5c57-41b0-ae50-a86ef41c8332

  server2_port:
    type: OS::Neutron::Port
    properties:
      network_id:  70f112d7-2b69-4b5a-b4c5-d7016f7b0f2a
      fixed_ips:
        - subnet_id:  d9bdd754-5c57-41b0-ae50-a86ef41c8332

    monitor:
        type: OS::Neutron::HealthMonitor
        properties:
          type: HTTP
          delay: 3
          max_retries: 5
          timeout: 10

      pool:
        type: OS::Neutron::Pool
        properties:
          name: mypool3
          protocol: HTTP
          subnet_id: d9bdd754-5c57-41b0-ae50-a86ef41c8332
          lb_method: ROUND_ROBIN
          monitors: [ { get_resource: monitor } ]
          vip: {"address": 10.100.1.250, "protocol_port": 80}

      mylb:
        type: OS::Neutron::LoadBalancer
        dependson: server1
        properties:
          members: [ XXXXX, XXXXX ]
          pool_id: { get_resource: pool }
          protocol_port: 80

My problem is I'm not quite sure how to populate the 'members' property (i.e. XXXXX in the above stanza) under OS::Neutron::LoadBalancer. I tried every built-in function (i.e. "ref", "get_reference", and "get_attr") combination I could think of, and nothing seems to work. From trial-and-error, I believe it's looking for a list of server IDs. The reason I suspect this is that the only way I could get this to work was hardcoding the IDs of two previously built servers. In other words, these servers had been created previous to running the Heat template. So once I changed that particular stanza to the below, everything worked perfectly.

mylb:
    type: OS::Neutron::LoadBalancer
    dependson: server1
    properties:
      members: [ c420bb4c-c748-47b1-a068-505683341ba5, 4d366207-f6de-41cf-b0d0-7b1f1a371a0b ]
      pool_id: { get_resource: pool }
      protocol_port: 80

Depending on which function I use, my heat-engine.log shows these types of messages when the template fails:

2013-11-01 12:15:22.802 8341 WARNING heat.engine.resources.nova_utils [-] Instance ({u'get_resource': u'server1'}) not found: Instance could not be found (HTTP 404) (Request-ID: req-631c9570-4370-4a73-9458-c9f37a36d1b3)

2013-11-01 12:36:13.378 8341 WARNING heat.engine.resources.nova_utils [-] Instance ({u'get_attr': [u'server1', u'instance_name']}) not found: Instance could not be found (HTTP 404) (Request-ID: req-a249fb64-90f3-476d-86a0-34bcc770315e)

Has anyone got this to work? Am I going about this incorrectly? Any tips would be greatly appreciated.

Thx!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-11-21 15:28:11 -0500

zaneb gravatar image

The members list should contain the IDs (not names) of the Nova servers, as you have discovered. The ID is returned as the RefId of an OS::Nova::Server resource. I'm inferring that you are using the HOT format, in which case the function to obtain this is get_resource. (In older Heat/CloudFormation templates it's Ref, with a capital 'R'.)

So this _should_ work:

members: [ { get_resource: server1 }, { get_resource: server2 } ]

Note that server1 needs to be defined in the same template (it doesn't appear in this snippet) for the reference to work.

Also note that your template must have a heat_template_version key at the top level to ensure that your template will be interpreted as HOT (i.e. for get_resource to work).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-11-02 12:30:30 -0500

Seen: 2,983 times

Last updated: Nov 21 '13