Ask Your Question
0

[Heat] How to use meta-data exchange in Heat

asked 2014-03-25 09:32:44 -0500

andreas gravatar image

updated 2014-03-25 09:41:32 -0500

Hi there,

i'd like to use the meta-data service of heat to let two nodes exchange data.

My Scenario
1. server-i writes meta-data.
2. server-ii reads that meta-data and echos it during its cloud-init execution.

Therefore, I am looking for a tag similar to get_attr: to accomplish this.

My ideal understanding is something like this:

---
heat_template_version: "2013-05-23"
resources:
  server-i:
    metadata:
      a: test-value
    properties:
      flavor: "6"
      image: F17-i386-cfntools
      key_name: test-key
      user_data: |
          #!/bin/sh
          echo 'Start-Test'
          echo 'End-Test'
    type: "OS::Nova::Server"

  server-ii:
    properties:
      flavor: "6"
      image: F17-i386-cfntools
      key_name: test-key
      user_data:
        str_replace:
          template: |
            #!/bin/sh
            echo 'Start-Test'
            echo test-value
            echo 'End-Test'
          params:
           test-value: { get_metadata: [server-i, a] }
    type: "OS::Nova::Server"

I am looking for the correct syntax for the params line in the server-ii definition element.
Therefore: How can one accomplish the above described scenario with Heat/Hot?

Thanks!
-Andreas

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-04-23 12:01:05 -0500

zaneb gravatar image

I'm not 100% sure how to interpret your question... you say you want the nodes to exchange data, but in your example the data is already predefined in the template, just in a different resource.

I think what you mean is that you want the user_data script on server-i to produce some data that is then passed to the user-data script on server-ii. This is already supported, but in a non-obvious way and not using metadata. The way to do it is with a WaitCondition - server-i's user_data script can post some data to the WaitConditionHandle, which server-ii can then retrieve using get_attr on the WaitCondition.

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

2 followers

Stats

Asked: 2014-03-25 09:32:44 -0500

Seen: 581 times

Last updated: Apr 23 '14