Floatingips-multi-vnic


 * Launchpad Entry: floatingips-multi-vnic
 * Created: 2011-06-03
 * Contributors: Tushar Patil, Koji Iida, Ishii Hisaharu

Summary
Currently nova supports only one vnic per instance, but soon multiple vnics per instance will be supported by diablo-2 timeframe. Multi-nic is going to add floating IPs only to the first fixed IP of an instance. Idea here is to extend and make it more flexible so that user can associate floating IP of his/her choice to one or more fixed IP of the instance.

Release Note
This set of changes will not impact users those who are happy having only one floating IP associated to the first fixed IP of the instance. Those who wants to assign floating IP to each fixed IP of the instance, will need to specify optional parameter --fixed_ip_address to the OS API. This optional parameter is the fixed IP address you want to associate the floating IP.

Rationale
Multi-nic will support to add floating IP only to the first fixed IP of the instance i.e. you cannot assign floating IP address to more than one fixed IP of the instance. Secondly, administrator has diligently need to ensure that the networks for a project is created in the proper sequence order so that correct network (fixed IP from this network) is used to assign floating IP.

User stories
TBD

Assumptions
1) BP "openstack-api-floating-ips" is implemented and it will support associate floating IP OS API

2) Owner of nova-client will make appropriate changes to support this feature.

Blueprint
Name : openstack-api-floating-ips

URL : https://blueprints.launchpad.net/nova/+spec/openstack-api-floating-ips

Design
OS doesn't support APIs to associate floating IP address to the instance. User using OS API has to rely on the auto_assign_floating_ip flag, if this flag is set to True then a new floating IP will be allocated by nova itself and it will be associated to the first fixed IP of the instance. There is already a BP "openstack-api-floating-ips" (https://blueprints.launchpad.net/nova/+spec/openstack-api-floating-ips) to support floating IPs to the OS API. Our feature has a dependency on this BP. Once the floating IPs are supported in the OS API, we will add our funcionality to it. To allow floating IP to be associated to each fixed IP of the instance, the OS API will accept additional optional parameter i.e. fixed IP to which you want to associate a particular floating IP address.

Code changes required:

1) File nova/compute/api.py   Method: associate_floating_ip(self, context, instance_id, address)    should be changed to     associate_floating_ip(self, context, instance_id, fixed_address, floating_address)

In this method, do some basic validations for fixed_address and instance_id: a) check if fixed_address is None        If None, then the existing logic should remain the same          i.e. floating_address will be assigned to the first vnic of the instance         If Not None, check if the fixed_address is actually assigned to the instance_id you have passed to this method.           If no, throw the exception.           If yes, then instead of passing fixed IP address of the first vnic, pass the fixed_address to the network_api.associate_floating_ip method  2) Need to make changes upward in the openstack API to pass fixed_address

Implementation
OS APIs to associate floating IP to the instance will be modified to accept optional parameter "fixed_address". This optional parameter will be sent downward to the compute/api.py to do some validations to ensure fixed_address passed is actually assigned to the instance. The call to nova/network/api->associate_floating_ip will remain unchanged except passing the correct fixed IP address.

UI Changes
There should be no visible changes to the end users, all this work will be behind the API servers.

Code Changes
Only compute/api and OS APIs will be changed. No major changes in the OS API except to pass the optional parameter fixed_ip_address upward to the compute api.

Migration
No changes required in database and there is no need to migrate any kind of data.

Test/Demo Plan
Unit/smoke tests will be provided as code is developed

Unresolved issues
None.