Specify floating IP address during creation

Starting from Kilo, neutron supports user to specify a floating IP during creation.

Before Kilo, neutron allocates floating IP automatically, user has no choice to specify the wanted IP, now this new feature introduced in Kilo gives user the possibility.

Before Kilo, you can only create floating IP in this way:

[[email protected] ~(admin)]# neutron floatingip-create external
Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    |                                      |
| floating_ip_address | 10.1.1.102                           |
| floating_network_id | c165824e-4eea-4ceb-a2fe-08a9ce1e20c7 |
| id                  | 1419a794-e291-4273-9a2d-78c234c3f78b |
| port_id             |                                      |
| router_id           |                                      |
| status              | DOWN                                 |
| tenant_id           | 45f80dc4851a4bc7b625cbd46bc5cb8f     |
+---------------------+--------------------------------------+

From Kilo onwards, you can create a specific floating IP:

[[email protected] ~(admin)]# neutron floatingip-create --floating-ip-address 10.1.1.200 external
Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    |                                      |
| floating_ip_address | 10.1.1.200                           |
| floating_network_id | c165824e-4eea-4ceb-a2fe-08a9ce1e20c7 |
| id                  | 812130c3-1272-45b4-8ebe-11571693f68e |
| port_id             |                                      |
| router_id           |                                      |
| status              | DOWN                                 |
| tenant_id           | 45f80dc4851a4bc7b625cbd46bc5cb8f     |
+---------------------+--------------------------------------+

If this wanted IP is in use, you get error when you try to create it:

[[email protected] ~(admin)]# neutron floatingip-create --floating-ip-address 10.1.1.200 external
Unable to complete operation for network c165824e-4eea-4ceb-a2fe-08a9ce1e20c7. The IP address 10.1.1.200 is in use.

Creating specific floating IP is controlled by neutron policy, by default, only admin user can do it:

[[email protected] ~(admin)]# grep floating_ip_address /etc/neutron/policy.json
    "create_floatingip:floating_ip_address": "rule:admin_only",