Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to associate floating IP to specific interface with Heat

i am trying to create a stack using openstack HEAT, one of the VMs (NOVA::Server) needs to have 2 network interfaces

so in my hot template i create 2 ports and associate them to the NOVA::Server and give a floating IP to one of them gw_float_port

....
gw_instance:
     type: "OS::Nova::Server"
     properties:
       key_name: { get_param: key_name }
       image: { get_param: image_id }
       flavor: { get_param: instance_type }          
       user_data:"#!/bin/sh \necho \"Starting the OVS setup!\" ... "
       user_data_format: RAW
       networks:
          - port: {get_resource: gw_float_port}
          - port: {get_resource: gw_ovs_port }

gw_float_port:
   type: "OS::Neutron::Port"
   properties:
      network_id: {get_resource: "private_net"}

gw_ovs_port:
   type: "OS::Neutron::Port"
   properties:
      network_id: {get_resource: "private_net"}

floating_ip:
   type: "OS::Neutron::FloatingIP"
   properties:
      floating_network_id: {get_param: "public_network"}
      port_id: {get_resource: "gw_float_port"}
....

And when i do an ifconfig inside the VM i get the following:

 ens3      Link encap:Ethernet  HWaddr fa:16:3e:76:98:82
           inet addr:10.4.0.47  Bcast:10.4.0.255  Mask:255.255.255.0
           ....
 ens4      Link encap:Ethernet  HWaddr fa:16:3e:11:9f:ed
           BROADCAST MULTICAST  MTU:1500  Metric:1
           ....
 lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           ....

what i want to know is how to map the NICs from the ifconfig with the NICs in the template and control which one gets the floating IP?

within the template (automatically while creating the stack not with manual manipulation after it is created)

thanks for you help in advance.