Ask Your Question
0

Heat Template CircularDependencyException

asked 2015-01-23 07:49:52 -0500

agti gravatar image

updated 2015-01-26 09:55:24 -0500

Hi, is there a way to reference on VM1 private IP of VM2 and viceversa?

I found the following exception: ERROR: Remote error: CircularDependencyException Circular Dependency Found: {Server "vm1": {Server "vm2"}, Server "vm2": {Server "vm1"}}

  vm1:
    type: OS::Nova::Server
    properties:
      name: vm1
      image: image1
      flavor: m1.small
      key_name: { get_param: KeyName }
      user_data:                                                        
        str_replace:                                                    
          template: |                                                   
            #!/bin/bash -x
            echo 'nameserver "%vm2_ip%"' | sudo tee -a /etc/resolv.conf
          params:       
            "%vm2_ip%": {get_attr: [vm2, first_address]}
      networks: 
        - port: { get_resource: vm1_port }

  vm2:
    type: OS::Nova::Server
    properties:
      name: vm2
      image: image1
      flavor: m1.small
      key_name: { get_param: KeyName }
      user_data:                                                        
        str_replace:                                                    
          template: |                                                   
            #!/bin/bash -x
            echo 'nameserver "%vm1_ip%"' | sudo tee -a /etc/resolv.conf
          params:       
            "%vm1_ip%": {get_attr: [vm1, first_address]}
      networks: 
        - port: { get_resource: vm2_port }

UPDATE 1 Is anyone aware of a solution to this problem? Could it be possible to cross reference Floating/static IP on resources?

Thanks

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2015-01-26 13:53:42 -0500

zaneb gravatar image

There's no way to do it through the user_data like this, because the user_data has to be passed to Nova at the time the server is created and the IP address only becomes available after that, so this is a true circular dependency.

The preferred way to solve this is to create an OS::Heat::SoftwareConfiguration resource and deploy it to the servers after they are created using OS::Heat::SoftwareDeployment resources.

Another option is to assign static IPs to the servers. Having the servers communicate using their public (i.e. Floating) IPs is not recommended.

edit flag offensive delete link more

Comments

Hi @zaneb, do you have a working example using those resources? I'm following this example

agti gravatar imageagti ( 2015-01-30 03:43:53 -0500 )edit
0

answered 2015-01-28 10:06:07 -0500

agti gravatar image

updated 2015-01-28 10:06:16 -0500

I'm trying to use your approach. Could you share with us a working sample-heat-template? I wrote a question on the issue. Thanks in advance

edit flag offensive delete link more
0

answered 2015-02-02 15:52:34 -0500

Steve Baker gravatar image

As per zaneb's answer, using OS::Heat::SoftwareDeployment resources allows you to avoid circular dependencies for referencing server attributes.

Take a look at the official hot-guide software-deployment section.

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: 2015-01-23 07:49:52 -0500

Seen: 978 times

Last updated: Feb 02 '15