Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Floating IP Association vs Floating IP

Hi all,

I'm relatively new to Openstack and I would like to have some clarifications about OS::Neutron::FloatingIP and OS::Neutron::FloatingIPAssociation.

My goal is to instantiate VMs via heat template and assign them a floating IP address. My heat templates creates a private management network (where the VMs are attached to) and a router that connects that private network to the external network.

I'm using Openstack Mitaka.

When it comes to assigning a floating IP to VMs, by looking at the documentation available on the web, the way to do it should be:

resources:
  port:
    type: OS::Neutron::Port
    properties:
      network: { get_resource: private_network }

  floating_ip:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: { get_param: public_network }

  floating_ip_assoc:
    type: OS::Neutron::FloatingIPAssociation
    properties:
      floatingip_id: { get_resource: floating_ip }
      port_id: { get_resource: port }

However, in my heat template, I do something like this:

resources:
  port:
    type: OS::Neutron::Port
    properties:
      network: { get_resource: private_network }

  floating_ip:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: { get_param: public_network }
      port_id: { get_resource: port }

In this example, I avoid using OS::Neutron::FloatingIPAssociation and I specify port_id directly in the OS::Neutron::FloatingIP resource.

This works well. So, my question is: what is the difference between the two (apparently both working) approaches? When is it better to use one over the other?

Thanks